Skip to content

Commit 9050295

Browse files
committed
re-format using gersemi
1 parent 0af2395 commit 9050295

File tree

12 files changed

+494
-446
lines changed

12 files changed

+494
-446
lines changed

CMakeLists.txt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,28 @@ function is run.
3737
The CMake equivalent is below.
3838
]=======================================================================]
3939

40-
include( cmake/godotcpp.cmake )
40+
include(cmake/godotcpp.cmake)
4141

4242
godotcpp_options()
4343

4444
#[[ Python is required for code generation ]]
4545
find_package(Python3 3.4 REQUIRED) # pathlib should be present
4646

4747
# Define our project.
48-
project( godot-cpp
49-
VERSION 4.4
50-
DESCRIPTION "C++ bindings for the Godot Engine's GDExtensions API."
51-
HOMEPAGE_URL "https://github.com/godotengine/godot-cpp"
52-
LANGUAGES CXX)
48+
project(
49+
godot-cpp
50+
VERSION 4.4
51+
DESCRIPTION "C++ bindings for the Godot Engine's GDExtensions API."
52+
HOMEPAGE_URL "https://github.com/godotengine/godot-cpp"
53+
LANGUAGES CXX
54+
)
5355

5456
compiler_detection()
5557
godotcpp_generate()
5658

5759
# Conditionally enable the godot-cpp.test.<target> integration testing targets
58-
if( GODOT_ENABLE_TESTING )
59-
add_subdirectory( test )
60+
if(GODOT_ENABLE_TESTING)
61+
add_subdirectory(test)
6062
endif()
6163

6264
# If this is the top level CMakeLists.txt, Generators which honor the

cmake/android.cmake

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,14 @@ Android platforms.
2525
There is further information and examples in the doc/cmake.rst file.
2626
2727
]=======================================================================]
28-
function( android_options )
28+
function(android_options)
2929
# Android Options
3030
endfunction()
3131

32-
function( android_generate )
33-
target_compile_definitions(${TARGET_NAME}
34-
PUBLIC
35-
ANDROID_ENABLED
36-
UNIX_ENABLED
32+
function(android_generate)
33+
target_compile_definitions(
34+
${TARGET_NAME}
35+
PUBLIC ANDROID_ENABLED UNIX_ENABLED
3736
)
3837

3938
common_compiler_flags()

cmake/common_compiler_flags.cmake

Lines changed: 69 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ features. For target platform specific flags look to each of the
1010
]=======================================================================]
1111

1212
#[[ Compiler Configuration, not to be confused with build targets ]]
13-
set( DEBUG_SYMBOLS "$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>" )
13+
set(DEBUG_SYMBOLS "$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>")
1414

1515
#[[ Compiler Identification ]]
16-
set( IS_CLANG "$<CXX_COMPILER_ID:Clang>" )
17-
set( IS_APPLECLANG "$<CXX_COMPILER_ID:AppleClang>" )
18-
set( IS_GNU "$<CXX_COMPILER_ID:GNU>" )
19-
set( IS_MSVC "$<CXX_COMPILER_ID:MSVC>" )
20-
set( NOT_MSVC "$<NOT:$<CXX_COMPILER_ID:MSVC>>" )
21-
22-
set( GNU_LT_V8 "$<VERSION_LESS:$<CXX_COMPILER_VERSION>,8>" )
23-
set( GNU_GE_V9 "$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,9>" )
24-
set( GNU_GT_V11 "$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,11>" )
25-
set( GNU_LT_V11 "$<VERSION_LESS:$<CXX_COMPILER_VERSION>,11>" )
26-
set( GNU_GE_V12 "$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,12>" )
16+
set(IS_CLANG "$<CXX_COMPILER_ID:Clang>")
17+
set(IS_APPLECLANG "$<CXX_COMPILER_ID:AppleClang>")
18+
set(IS_GNU "$<CXX_COMPILER_ID:GNU>")
19+
set(IS_MSVC "$<CXX_COMPILER_ID:MSVC>")
20+
set(NOT_MSVC "$<NOT:$<CXX_COMPILER_ID:MSVC>>")
21+
22+
set(GNU_LT_V8 "$<VERSION_LESS:$<CXX_COMPILER_VERSION>,8>")
23+
set(GNU_GE_V9 "$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,9>")
24+
set(GNU_GT_V11 "$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,11>")
25+
set(GNU_LT_V11 "$<VERSION_LESS:$<CXX_COMPILER_VERSION>,11>")
26+
set(GNU_GE_V12 "$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,12>")
2727

2828
#[[ Check for clang-cl with MSVC frontend
2929
The compiler is tested and set when the project command is called.
@@ -33,143 +33,125 @@ until CMake 3.30 so we can't use it yet.
3333
3434
So to support clang downloaded from llvm.org which uses the MSVC frontend
3535
by default, we need to test for it. ]]
36-
function( compiler_detection )
37-
if( ${CMAKE_CXX_COMPILER_ID} STREQUAL Clang )
38-
if( ${CMAKE_CXX_COMPILER_FRONTEND_VARIANT} STREQUAL MSVC )
39-
message( "Using clang-cl" )
40-
set( IS_CLANG "0" PARENT_SCOPE )
41-
set( IS_MSVC "1" PARENT_SCOPE )
42-
set( NOT_MSVC "0" PARENT_SCOPE )
43-
endif ()
44-
endif ()
45-
endfunction( )
46-
47-
function( common_compiler_flags )
36+
function(compiler_detection)
37+
if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
38+
if(${CMAKE_CXX_COMPILER_FRONTEND_VARIANT} STREQUAL MSVC)
39+
message("Using clang-cl")
40+
set(IS_CLANG "0" PARENT_SCOPE)
41+
set(IS_MSVC "1" PARENT_SCOPE)
42+
set(NOT_MSVC "0" PARENT_SCOPE)
43+
endif()
44+
endif()
45+
endfunction()
4846

49-
target_compile_features(${TARGET_NAME}
50-
PUBLIC
51-
cxx_std_17
52-
)
47+
function(common_compiler_flags)
48+
target_compile_features(${TARGET_NAME} PUBLIC cxx_std_17)
5349

5450
# These compiler options reflect what is in godot/SConstruct.
55-
target_compile_options( ${TARGET_NAME}
51+
target_compile_options(
52+
${TARGET_NAME}
5653
PUBLIC
5754
# Disable exception handling. Godot doesn't use exceptions anywhere, and this
5855
# saves around 20% of binary size and very significant build time.
5956
$<${DISABLE_EXCEPTIONS}:
60-
$<${NOT_MSVC}:-fno-exceptions>
57+
$<${NOT_MSVC}:-fno-exceptions>
6158
>
62-
6359
# Enabling Debug Symbols
6460
$<${DEBUG_SYMBOLS}:
65-
# Adding dwarf-4 explicitly makes stacktraces work with clang builds,
66-
# otherwise addr2line doesn't understand them.
67-
$<${NOT_MSVC}:
68-
-gdwarf-4
69-
$<IF:${IS_DEV_BUILD},-g3,-g2>
70-
>
61+
# Adding dwarf-4 explicitly makes stacktraces work with clang builds,
62+
# otherwise addr2line doesn't understand them.
63+
$<${NOT_MSVC}:
64+
-gdwarf-4
65+
$<IF:${IS_DEV_BUILD},-g3,-g2>
66+
>
7167
>
72-
7368
$<${IS_DEV_BUILD}:
74-
$<${NOT_MSVC}:-fno-omit-frame-pointer -O0>
69+
$<${NOT_MSVC}:-fno-omit-frame-pointer
70+
-O0>
7571
>
76-
7772
$<${HOT_RELOAD}:
78-
$<${IS_GNU}:-fno-gnu-unique>
73+
$<${IS_GNU}:-fno-gnu-unique>
7974
>
80-
81-
# MSVC only
82-
$<${IS_MSVC}:
75+
# MSVC only
76+
$<${IS_MSVC}:
8377
# /MP isn't valid for clang-cl with msvc frontend
8478
$<$<CXX_COMPILER_ID:MSVC>:/MP${PROC_N}>
8579
/W4
86-
8780
# Disable warnings which we don't plan to fix.
88-
/wd4100 # C4100 (unreferenced formal parameter): Doesn't play nice with polymorphism.
89-
/wd4127 # C4127 (conditional expression is constant)
90-
/wd4201 # C4201 (non-standard nameless struct/union): Only relevant for C89.
91-
/wd4244 # C4244 C4245 C4267 (narrowing conversions): Unavoidable at this scale.
81+
/wd4100 # C4100 (unreferenced formal parameter): Doesn't play nice with polymorphism.
82+
/wd4127 # C4127 (conditional expression is constant)
83+
/wd4201 # C4201 (non-standard nameless struct/union): Only relevant for C89.
84+
/wd4244 # C4244 C4245 C4267 (narrowing conversions): Unavoidable at this scale.
9285
/wd4245
9386
/wd4267
94-
/wd4305 # C4305 (truncation): double to float or real_t, too hard to avoid.
95-
/wd4514 # C4514 (unreferenced inline function has been removed)
96-
/wd4714 # C4714 (function marked as __forceinline not inlined)
97-
/wd4820 # C4820 (padding added after construct)
98-
87+
/wd4305 # C4305 (truncation): double to float or real_t, too hard to avoid.
88+
/wd4514 # C4514 (unreferenced inline function has been removed)
89+
/wd4714 # C4714 (function marked as __forceinline not inlined)
90+
/wd4820 # C4820 (padding added after construct)
9991
/utf-8
100-
>
101-
102-
# Clang and GNU common options
103-
$<$<OR:${IS_CLANG},${IS_GNU}>:
92+
>
93+
# Clang and GNU common options
94+
$<$<OR:${IS_CLANG},${IS_GNU}>:
10495
-Wall
10596
-Wctor-dtor-privacy
10697
-Wextra
10798
-Wno-unused-parameter
10899
-Wnon-virtual-dtor
109100
-Wwrite-strings
110-
>
111-
112-
# Clang only
113-
$<${IS_CLANG}:
101+
>
102+
# Clang only
103+
$<${IS_CLANG}:
114104
-Wimplicit-fallthrough
115105
-Wno-ordered-compare-function-pointers
116-
>
117-
118-
# GNU only
119-
$<${IS_GNU}:
106+
>
107+
# GNU only
108+
$<${IS_GNU}:
120109
-Walloc-zero
121110
-Wduplicated-branches
122111
-Wduplicated-cond
123112
-Wno-misleading-indentation
124113
-Wplacement-new=1
125114
-Wshadow-local
126115
-Wstringop-overflow=4
127-
128116
# Bogus warning fixed in 8+.
129117
$<${GNU_LT_V8}:-Wno-strict-overflow>
130-
131118
$<${GNU_GE_V9}:-Wattribute-alias=2>
132-
133119
# Broke on MethodBind templates before GCC 11.
134120
$<${GNU_GT_V11}:-Wlogical-op>
135-
136121
# Regression in GCC 9/10, spams so much in our variadic templates that we need to outright disable it.
137122
$<${GNU_LT_V11}:-Wno-type-limits>
138-
139123
# False positives in our error macros, see GH-58747.
140124
$<${GNU_GE_V12}:-Wno-return-type>
141-
>
125+
>
142126
)
143127

144-
target_compile_definitions(${TARGET_NAME}
128+
target_compile_definitions(
129+
${TARGET_NAME}
145130
PUBLIC
146131
GDEXTENSION
147-
148132
# features
149-
$<${DEBUG_FEATURES}:DEBUG_ENABLED DEBUG_METHODS_ENABLED>
150-
133+
$<${DEBUG_FEATURES}:DEBUG_ENABLED
134+
DEBUG_METHODS_ENABLED>
151135
$<${IS_DEV_BUILD}:DEV_ENABLED>
152-
153136
$<${HOT_RELOAD}:HOT_RELOAD_ENABLED>
154-
155137
$<$<STREQUAL:${GODOT_PRECISION},double>:REAL_T_IS_DOUBLE>
156-
157138
$<${IS_MSVC}:$<${DISABLE_EXCEPTIONS}:_HAS_EXCEPTIONS=0>>
158139
)
159140

160-
target_link_options( ${TARGET_NAME}
141+
target_link_options(
142+
${TARGET_NAME}
161143
PUBLIC
162144
$<${IS_MSVC}:
163-
/WX # treat link warnings as errors.
164-
/MANIFEST:NO # We dont need a manifest
145+
/WX # treat link warnings as errors.
146+
/MANIFEST:NO # We dont need a manifest
165147
>
166-
167148
$<${DEBUG_SYMBOLS}:$<${IS_MSVC}:/DEBUG:FULL>>
168149
$<$<NOT:${DEBUG_SYMBOLS}>:
169-
$<${IS_GNU}:-s>
170-
$<${IS_CLANG}:-s>
171-
$<${IS_APPLECLANG}:-Wl,-S -Wl,-x -Wl,-dead_strip>
150+
$<${IS_GNU}:-s>
151+
$<${IS_CLANG}:-s>
152+
$<${IS_APPLECLANG}:-Wl,-S
153+
-Wl,-x
154+
-Wl,-dead_strip>
172155
>
173156
)
174-
175157
endfunction()

cmake/emsdkHack.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ More information on cmake's `code injection`_
2323
2424
Overwrite Shared Library Properties to allow shared libs to be generated.
2525
]=======================================================================]
26-
if( EMSCRIPTEN )
26+
if(EMSCRIPTEN)
2727
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
2828
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-sSIDE_MODULE=1")
2929
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-sSIDE_MODULE=1")
3030
set(CMAKE_SHARED_LIBRARY_SUFFIX) # remove the suffix from the shared lib
31-
set(CMAKE_STRIP FALSE) # used by default in pybind11 on .so modules
31+
set(CMAKE_STRIP FALSE) # used by default in pybind11 on .so modules
3232

3333
# The Emscripten toolchain sets the default value for EMSCRIPTEN_SYSTEM_PROCESSOR to x86
3434
# and CMAKE_SYSTEM_PROCESSOR to this value. I don't want that.
35-
set(CMAKE_SYSTEM_PROCESSOR "wasm32" )
35+
set(CMAKE_SYSTEM_PROCESSOR "wasm32")
3636
# the above prevents the need for logic like:
3737
#if( ${CMAKE_SYSTEM_NAME} STREQUAL Emscripten )
3838
# set( SYSTEM_ARCH wasm32 )
3939
#endif ()
40-
endif ()
40+
endif()

0 commit comments

Comments
 (0)