Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 158 additions & 3 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,3 +1,158 @@
BasedOnStyle: Google
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe leave the old commented out and explain why we copy all these in.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this file copied from clang-format? Or generated? We should indicate where the file content came from.

Copy link
Contributor Author

@ilijapuaca ilijapuaca Apr 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's generated using a command from the link I put at the top of the file, will elaborate more

IndentWidth: 2
ColumnLimit: 120
# Generated by running clang-format -style=Google -dump-config > .clang-format, with a few Unfolded modifications at the bottom
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
---
# Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
# Unfolded
ColumnLimit: 120
...
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "cpp/deps"]
path = cpp/deps
url = git@github.com:UnfoldedInc/deck.gl-native-dependencies.git
url = https://github.com/UnfoldedInc/deck.gl-native-dependencies.git
34 changes: 17 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ matrix:
packages:
- clang-format-9
script: make format && git diff --exit-code
# TODO: Doesn't install arrow correctly on OSX
# - name: "Mac OSX (Xcode 11.3)"
# os: osx
# osx_image: xcode11.3
- name: "Linux (Clang)"
os: linux
compiler: clang
- name: "Linux (GCC) with Valgrind"
os: linux
compiler: gcc
addons:
apt:
packages:
- valgrind
script:
- make -j
- valgrind --error-exitcode=99 ./tests
- name: "macOS (Xcode 11.3)"
os: osx
osx_image: xcode11.3
# TODO: Does not build on Linux currently due to dependency issues
# - name: "Linux (Clang)"
# os: linux
# compiler: clang
# - name: "Linux (GCC) with Valgrind"
# os: linux
# compiler: gcc
# addons:
# apt:
# packages:
# - valgrind
# script:
# - make -j
# - valgrind --error-exitcode=99 ./tests

before_script:
# Build out of source
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ option(DECK_BUILD_EXAMPLES "Enables building examples" ON)
option(DECK_BUILD_TESTS "Enables building tests" ON)
option(DECK_ENABLE_GRAPHICS "When set to OFF, no graphics libraries will be included. Useful for running on CI" ON)

find_program(CLANG_FORMAT_PATH clang-format)
# We're using clang-format-9 Linux package, which should have priority over any other version
find_program(CLANG_FORMAT_PATH NAMES clang-format-9 clang-format)
cmake_dependent_option(
DECK_ENABLE_FORMAT "Enable running clang-format before compiling" ON
"CLANG_FORMAT_PATH" OFF
Expand Down
18 changes: 15 additions & 3 deletions cpp/modules/luma.gl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ target_link_libraries(luma.gl PUBLIC ${DECK_LINK_FLAGS}
)
target_link_libraries(luma.gl PUBLIC ${DECK_CONFIG_LIBRARY})

# GLFW dependencies
if (APPLE)
find_library(Cocoa_LIB Cocoa)
find_library(IOKit_LIB IOKit)
find_library(CoreFoundation_LIB CoreFoundation)
find_library(CoreVideo_LIB CoreVideo)
target_link_libraries(luma.gl PUBLIC ${DECK_LINK_FLAGS}
${Cocoa_LIB}
${IOKit_LIB}
${CoreFoundation_LIB}
${CoreVideo_LIB}
)
endif()

# Backend specific files and libraries
if (DECK_ENABLE_D3D12)
list(APPEND WEBGPU_SOURCE_FILE_LIST webgpu/src/backends/d3d12-binding.cpp)
Expand All @@ -81,13 +95,11 @@ if (DECK_ENABLE_METAL)
# macOS frameworks related to Metal
find_library(Metal_LIB Metal)
find_library(QuartzCore_LIB QuartzCore)
find_library(Cocoa_LIB Cocoa)
find_library(IOKit_LIB IOKit)
find_library(IOSurface_LIB IOSurface)
target_link_libraries(luma.gl PUBLIC
target_link_libraries(luma.gl PUBLIC ${DECK_LINK_FLAGS}
${Metal_LIB}
${QuartzCore_LIB}
${Cocoa_LIB}
${IOKit_LIB}
${IOSurface_LIB}
)
Expand Down
1 change: 1 addition & 0 deletions cpp/modules/luma.gl/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#ifndef LUMAGL_CORE_H
#define LUMAGL_CORE_H

#include "./core/src/animation-loop.h"
#include "./core/src/glfw-animation-loop.h"
#include "./core/src/model.h"

Expand Down
2 changes: 2 additions & 0 deletions cpp/modules/luma.gl/core/src/glfw-animation-loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "./glfw-animation-loop.h" // NOLINT(build/include)

#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>
#include <dawn/dawn_wsi.h>
#include <dawn/webgpu_cpp.h>
Expand Down Expand Up @@ -57,6 +58,7 @@ GLFWAnimationLoop::GLFWAnimationLoop(const wgpu::BackendType backendType, std::s
}

GLFWAnimationLoop::~GLFWAnimationLoop() {
glfwDestroyWindow(this->_window);
glfwTerminate();

// TODO(ilija@unfolded.ai): Additional cleanup?
Expand Down
4 changes: 2 additions & 2 deletions cpp/modules/luma.gl/core/src/glfw-animation-loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
#ifndef LUMAGL_CORE_GLFW_ANIMATION_LOOP_H
#define LUMAGL_CORE_GLFW_ANIMATION_LOOP_H

#include <GLFW/glfw3.h>

#include <memory>

#include "./animation-loop.h"
#include "luma.gl/webgpu/src/backends/backend-binding.h"
#include "luma.gl/webgpu/src/webgpu-utils.h"

struct GLFWwindow;

namespace lumagl {

class GLFWAnimationLoop : public AnimationLoop {
Expand Down
10 changes: 5 additions & 5 deletions cpp/modules/luma.gl/webgpu/src/backends/backend-binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@

#include "./backend-binding.h" // NOLINT(build/include)

#include "GLFW/glfw3.h"
#include "luma.gl/core.h"
#include "probe.gl/core.h"

#include <GLFW/glfw3.h>
#if defined(LUMAGL_ENABLE_BACKEND_OPENGL)
#include "dawn_native/OpenGLBackend.h"
#include <dawn_native/OpenGLBackend.h>
#endif // defined(LUMAGL_ENABLE_BACKEND_OPENGL)

#include "luma.gl/core.h"
#include "probe.gl/core.h"

namespace lumagl {
namespace utils {

Expand Down
4 changes: 2 additions & 2 deletions cpp/modules/luma.gl/webgpu/src/backends/backend-binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#ifndef LUMAGL_WEBGPU_BACKENDS_BACKEND_BINDING_H
#define LUMAGL_WEBGPU_BACKENDS_BACKEND_BINDING_H

#include "dawn/webgpu_cpp.h"
#include "dawn_native/DawnNative.h"
#include <dawn/webgpu_cpp.h>
#include <dawn_native/DawnNative.h>

struct GLFWwindow;

Expand Down
9 changes: 5 additions & 4 deletions cpp/modules/luma.gl/webgpu/src/backends/d3d12-binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
// Note: This file was inspired by the Dawn codebase at https://dawn.googlesource.com/dawn/
// Copyright 2017 The Dawn Authors http://www.apache.org/licenses/LICENSE-2.0

#include <GLFW/glfw3.h>
#include <dawn_native/D3D12Backend.h>
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h>

#include <memory>

#include "GLFW/glfw3.h"
#include "dawn_native/D3D12Backend.h"
#define GLFW_EXPOSE_NATIVE_WIN32
#include "./backend-binding.h"
#include "GLFW/glfw3native.h"
#include "probe.gl/core.h"

namespace lumagl {
Expand Down
11 changes: 5 additions & 6 deletions cpp/modules/luma.gl/webgpu/src/backends/metal-binding.mm
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@
// Note: This file was inspired by the Dawn codebase at https://dawn.googlesource.com/dawn/
// Copyright 2017 The Dawn Authors http://www.apache.org/licenses/LICENSE-2.0

#include "./backend-binding.h"

#import <QuartzCore/CAMetalLayer.h>
#include <dawn/dawn_wsi.h>
#include <dawn_native/MetalBackend.h>

#include "dawn/dawn_wsi.h"
#include "dawn_native/MetalBackend.h"
#include "./backend-binding.h"

#define GLFW_EXPOSE_NATIVE_COCOA
#include "GLFW/glfw3.h"
#include "GLFW/glfw3native.h"
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>

#include "luma.gl/core.h"
#include "probe.gl/core.h"
Expand Down
7 changes: 4 additions & 3 deletions cpp/modules/luma.gl/webgpu/src/backends/opengl-binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
// Note: This file was inspired by the Dawn codebase at https://dawn.googlesource.com/dawn/
// Copyright 2017 The Dawn Authors http://www.apache.org/licenses/LICENSE-2.0

#include <GLFW/glfw3.h>
#include <dawn/dawn_wsi.h>
#include <dawn_native/OpenGLBackend.h>

#include <cstdio>

#include "./backend-binding.h"
#include "GLFW/glfw3.h"
#include "dawn/dawn_wsi.h"
#include "dawn_native/OpenGLBackend.h"
#include "luma.gl/core.h"

namespace lumagl {
Expand Down
Loading