Skip to content

Commit d0dd282

Browse files
committed
CMake: Rename all GODOT_ to GODOTCPP_
This is for discussion primarily at this stage.
1 parent c8c25cd commit d0dd282

8 files changed

+85
-85
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ jobs:
202202
run: |
203203
mkdir cmake-build
204204
cd cmake-build
205-
cmake ../ -DGODOT_ENABLE_TESTING=YES
205+
cmake ../ -DGODOTCPP_ENABLE_TESTING=YES
206206
cmake --build . --verbose -j $(nproc) -t godot-cpp.test.template_release --config Release
207207
208208
windows-msvc-cmake:
@@ -218,5 +218,5 @@ jobs:
218218
run: |
219219
mkdir cmake-build
220220
cd cmake-build
221-
cmake ../ -DGODOT_ENABLE_TESTING=YES
221+
cmake ../ -DGODOTCPP_ENABLE_TESTING=YES
222222
cmake --build . --verbose -t godot-cpp.test.template_release --config Release

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ compiler_detection()
5252
godotcpp_generate()
5353

5454
# Conditionally enable the godot-cpp.test.<target> integration testing targets
55-
if( GODOT_ENABLE_TESTING )
55+
if( GODOTCPP_ENABLE_TESTING )
5656
add_subdirectory( test )
5757
endif()
5858

cmake/GodotCPPModule.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function( binding_generator_generate_bindings API_FILE USE_TEMPLATE_GET_NODE, BI
106106
COMMAND "${Python3_EXECUTABLE}" "-c" "${PYTHON_SCRIPT}"
107107
VERBATIM
108108
WORKING_DIRECTORY ${godot-cpp_SOURCE_DIR}
109-
MAIN_DEPENDENCY ${GODOT_GDEXTENSION_API_FILE}
109+
MAIN_DEPENDENCY ${GODOTCPP_GDEXTENSION_API_FILE}
110110
DEPENDS ${godot-cpp_SOURCE_DIR}/binding_generator.py
111111
COMMENT "Generating bindings"
112112
)

cmake/common_compiler_flags.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ function( common_compiler_flags )
152152

153153
$<${HOT_RELOAD}:HOT_RELOAD_ENABLED>
154154

155-
$<$<STREQUAL:${GODOT_PRECISION},double>:REAL_T_IS_DOUBLE>
155+
$<$<STREQUAL:${GODOTCPP_PRECISION},double>:REAL_T_IS_DOUBLE>
156156

157157
$<${IS_MSVC}:$<${DISABLE_EXCEPTIONS}:_HAS_EXCEPTIONS=0>>
158158

cmake/godotcpp.cmake

+56-56
Original file line numberDiff line numberDiff line change
@@ -102,46 +102,46 @@ endfunction()
102102
function( godotcpp_options )
103103
#NOTE: platform is managed using toolchain files.
104104
#NOTE: arch is managed by using toolchain files.
105-
# Except for macos universal, which can be set by GODOT_MACOS_UNIVERSAL=YES
105+
# Except for macos universal, which can be set by GODOTCPP_MACOS_UNIVERSAL=YES
106106

107107
# Input from user for GDExtension interface header and the API JSON file
108-
set(GODOT_GDEXTENSION_DIR "gdextension" CACHE PATH
108+
set( GODOTCPP_GDEXTENSION_DIR "gdextension" CACHE PATH
109109
"Path to a custom directory containing GDExtension interface header and API JSON file ( /path/to/gdextension_dir )" )
110-
set(GODOT_CUSTOM_API_FILE "" CACHE FILEPATH
111-
"Path to a custom GDExtension API JSON file (takes precedence over `GODOT_GDEXTENSION_DIR`) ( /path/to/custom_api_file )")
110+
set( GODOTCPP_CUSTOM_API_FILE "" CACHE FILEPATH
111+
"Path to a custom GDExtension API JSON file (takes precedence over `GODOTCPP_GDEXTENSION_DIR`) ( /path/to/custom_api_file )")
112112

113113
#TODO generate_bindings
114114

115-
option(GODOT_GENERATE_TEMPLATE_GET_NODE
115+
option( GODOTCPP_GENERATE_TEMPLATE_GET_NODE
116116
"Generate a template version of the Node class's get_node. (ON|OFF)" ON)
117117

118118
#TODO build_library
119119

120-
set(GODOT_PRECISION "single" CACHE STRING
120+
set( GODOTCPP_PRECISION "single" CACHE STRING
121121
"Set the floating-point precision level (single|double)")
122122

123-
set( GODOT_THREADS ON CACHE BOOL "Enable threading support" )
123+
set( GODOTCPP_THREADS ON CACHE BOOL "Enable threading support" )
124124

125125
#TODO compiledb
126126
#TODO compiledb_file
127127

128-
set( GODOT_BUILD_PROFILE "" CACHE PATH
128+
set( GODOTCPP_BUILD_PROFILE "" CACHE PATH
129129
"Path to a file containing a feature build profile" )
130130

131-
set(GODOT_USE_HOT_RELOAD "" CACHE BOOL
131+
set( GODOTCPP_USE_HOT_RELOAD "" CACHE BOOL
132132
"Enable the extra accounting required to support hot reload. (ON|OFF)")
133133

134134
# Disable exception handling. Godot doesn't use exceptions anywhere, and this
135135
# saves around 20% of binary size and very significant build time (GH-80513).
136-
option(GODOT_DISABLE_EXCEPTIONS "Force disabling exception handling code (ON|OFF)" ON )
136+
option( GODOTCPP_DISABLE_EXCEPTIONS "Force disabling exception handling code (ON|OFF)" ON )
137137

138-
set( GODOT_SYMBOL_VISIBILITY "hidden" CACHE STRING
138+
set( GODOTCPP_SYMBOL_VISIBILITY "hidden" CACHE STRING
139139
"Symbols visibility on GNU platforms. Use 'auto' to apply the default value. (auto|visible|hidden)")
140-
set_property( CACHE GODOT_SYMBOL_VISIBILITY PROPERTY STRINGS "auto;visible;hidden" )
140+
set_property( CACHE GODOTCPP_SYMBOL_VISIBILITY PROPERTY STRINGS "auto;visible;hidden" )
141141

142142
#TODO optimize
143143

144-
option( GODOT_DEV_BUILD "Developer build with dev-only debugging code (DEV_ENABLED)" OFF )
144+
option( GODOTCPP_DEV_BUILD "Developer build with dev-only debugging code (DEV_ENABLED)" OFF )
145145

146146
#[[ debug_symbols
147147
Debug symbols are enabled by using the Debug or RelWithDebInfo build configurations.
@@ -156,11 +156,11 @@ function( godotcpp_options )
156156
]]
157157

158158
# FIXME These options are not present in SCons, and perhaps should be added there.
159-
option( GODOT_SYSTEM_HEADERS "Expose headers as SYSTEM." OFF )
160-
option( GODOT_WARNING_AS_ERROR "Treat warnings as errors" OFF )
159+
option( GODOTCPP_SYSTEM_HEADERS "Expose headers as SYSTEM." OFF )
160+
option( GODOTCPP_WARNING_AS_ERROR "Treat warnings as errors" OFF )
161161

162162
# Enable Testing
163-
option( GODOT_ENABLE_TESTING "Enable the godot-cpp.test.<target> integration testing targets" OFF )
163+
option( GODOTCPP_ENABLE_TESTING "Enable the godot-cpp.test.<target> integration testing targets" OFF )
164164

165165
#[[ Target Platform Options ]]
166166
android_options()
@@ -192,64 +192,64 @@ function( godotcpp_generate )
192192
message( " eg. cmake --build . -j 7 ...")
193193
endif ()
194194

195-
#[[ GODOT_SYMBOL_VISIBLITY
195+
#[[ GODOTCPP_SYMBOL_VISIBLITY
196196
To match the SCons options, the allowed values are "auto", "visible", and "hidden"
197197
This effects the compiler flag_ -fvisibility=[default|internal|hidden|protected]
198198
The corresponding target option CXX_VISIBILITY_PRESET accepts the compiler values.
199199
200200
TODO: It is probably worth a pull request which changes both to use the compiler values
201201
.. _flag:https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fvisibility
202202
]]
203-
if( ${GODOT_SYMBOL_VISIBILITY} STREQUAL "auto" OR ${GODOT_SYMBOL_VISIBILITY} STREQUAL "visible" )
204-
set( GODOT_SYMBOL_VISIBILITY "default" )
203+
if( ${GODOTCPP_SYMBOL_VISIBILITY} STREQUAL "auto" OR ${GODOTCPP_SYMBOL_VISIBILITY} STREQUAL "visible" )
204+
set( GODOTCPP_SYMBOL_VISIBILITY "default" )
205205
endif ()
206206

207207
# Setup variable to optionally mark headers as SYSTEM
208-
set(GODOT_SYSTEM_HEADERS_ATTRIBUTE "")
209-
if (GODOT_SYSTEM_HEADERS)
210-
set(GODOT_SYSTEM_HEADERS_ATTRIBUTE SYSTEM)
208+
set( GODOTCPP_SYSTEM_HEADERS_ATTRIBUTE "")
209+
if( GODOTCPP_SYSTEM_HEADERS)
210+
set( GODOTCPP_SYSTEM_HEADERS_ATTRIBUTE SYSTEM)
211211
endif ()
212212

213213
#[[ Configure Binding Variables ]]
214214
# Generate Binding Parameters (True|False)
215215
set( USE_TEMPLATE_GET_NODE "False" )
216-
if( GODOT_GENERATE_TEMPLATE_GET_NODE )
216+
if( GODOTCPP_GENERATE_TEMPLATE_GET_NODE )
217217
set( USE_TEMPLATE_GET_NODE "True" )
218218
endif()
219219

220220
# Bits (32|64)
221221
math( EXPR BITS "${CMAKE_SIZEOF_VOID_P} * 8" ) # CMAKE_SIZEOF_VOID_P refers to target architecture.
222222

223223
# API json File
224-
set(GODOT_GDEXTENSION_API_FILE "${GODOT_GDEXTENSION_DIR}/extension_api.json")
225-
if( GODOT_CUSTOM_API_FILE ) # User-defined override.
226-
set(GODOT_GDEXTENSION_API_FILE "${GODOT_CUSTOM_API_FILE}")
224+
set( GODOTCPP_GDEXTENSION_API_FILE "${GODOTCPP_GDEXTENSION_DIR}/extension_api.json")
225+
if( GODOTCPP_CUSTOM_API_FILE ) # User-defined override.
226+
set( GODOTCPP_GDEXTENSION_API_FILE "${GODOTCPP_CUSTOM_API_FILE}")
227227
endif()
228228

229229
# Build Profile
230-
if( GODOT_BUILD_PROFILE )
230+
if( GODOTCPP_BUILD_PROFILE )
231231
message( STATUS "Using build profile to trim api file")
232-
message( "\tBUILD_PROFILE = '${GODOT_BUILD_PROFILE}'")
233-
message( "\tAPI_SOURCE = '${GODOT_GDEXTENSION_API_FILE}'")
232+
message( "\tBUILD_PROFILE = '${GODOTCPP_BUILD_PROFILE}'")
233+
message( "\tAPI_SOURCE = '${GODOTCPP_GDEXTENSION_API_FILE}'")
234234
build_profile_generate_trimmed_api(
235-
"${GODOT_BUILD_PROFILE}"
236-
"${GODOT_GDEXTENSION_API_FILE}"
235+
"${GODOTCPP_BUILD_PROFILE}"
236+
"${GODOTCPP_GDEXTENSION_API_FILE}"
237237
"${CMAKE_CURRENT_BINARY_DIR}/extension_api.json" )
238-
set( GODOT_GDEXTENSION_API_FILE "${CMAKE_CURRENT_BINARY_DIR}/extension_api.json" )
238+
set( GODOTCPP_GDEXTENSION_API_FILE "${CMAKE_CURRENT_BINARY_DIR}/extension_api.json" )
239239
endif()
240240

241-
message( STATUS "GODOT_GDEXTENSION_API_FILE = '${GODOT_GDEXTENSION_API_FILE}'")
241+
message( STATUS "GODOTCPP_GDEXTENSION_API_FILE = '${GODOTCPP_GDEXTENSION_API_FILE}'")
242242

243243
# generate the file list to use
244244
binding_generator_get_file_list( GENERATED_FILES_LIST
245-
"${GODOT_GDEXTENSION_API_FILE}"
245+
"${GODOTCPP_GDEXTENSION_API_FILE}"
246246
"${CMAKE_CURRENT_BINARY_DIR}" )
247247

248248
binding_generator_generate_bindings(
249-
"${GODOT_GDEXTENSION_API_FILE}"
249+
"${GODOTCPP_GDEXTENSION_API_FILE}"
250250
"${USE_TEMPLATE_GET_NODE}"
251251
"${BITS}"
252-
"${GODOT_PRECISION}"
252+
"${GODOTCPP_PRECISION}"
253253
"${CMAKE_CURRENT_BINARY_DIR}" )
254254

255255
add_custom_target( godot-cpp.generate_bindings DEPENDS ${GENERATED_FILES_LIST} )
@@ -271,36 +271,36 @@ function( godotcpp_generate )
271271
godot_arch_name( ARCH_NAME )
272272

273273
# Transform options into generator expressions
274-
set( HOT_RELOAD-UNSET "$<STREQUAL:${GODOT_USE_HOT_RELOAD},>")
274+
set( HOT_RELOAD-UNSET "$<STREQUAL:${GODOTCPP_USE_HOT_RELOAD},>")
275275

276-
set( DISABLE_EXCEPTIONS "$<BOOL:${GODOT_DISABLE_EXCEPTIONS}>")
276+
set( DISABLE_EXCEPTIONS "$<BOOL:${GODOTCPP_DISABLE_EXCEPTIONS}>")
277277

278-
set( THREADS_ENABLED "$<BOOL:${GODOT_THREADS}>" )
278+
set( THREADS_ENABLED "$<BOOL:${GODOTCPP_THREADS}>" )
279279

280-
# GODOT_DEV_BUILD
280+
# GODOTCPP_DEV_BUILD
281281
set( RELEASE_TYPES "Release;MinSizeRel")
282282
get_property( IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG )
283283
if( IS_MULTI_CONFIG )
284284
message( NOTICE "=> Default build type is Debug. For other build types add --config <type> to build command")
285-
elseif( GODOT_DEV_BUILD AND CMAKE_BUILD_TYPE IN_LIST RELEASE_TYPES )
286-
message( WARNING "=> GODOT_DEV_BUILD implies a Debug-like build but CMAKE_BUILD_TYPE is '${CMAKE_BUILD_TYPE}'")
285+
elseif( GODOTCPP_DEV_BUILD AND CMAKE_BUILD_TYPE IN_LIST RELEASE_TYPES )
286+
message( WARNING "=> GODOTCPP_DEV_BUILD implies a Debug-like build but CMAKE_BUILD_TYPE is '${CMAKE_BUILD_TYPE}'")
287287
endif ()
288-
set( IS_DEV_BUILD "$<BOOL:${GODOT_DEV_BUILD}>")
288+
set( IS_DEV_BUILD "$<BOOL:${GODOTCPP_DEV_BUILD}>")
289289

290290
### Define our godot-cpp library targets
291291
foreach ( TARGET_ALIAS template_debug template_release editor )
292292
set( TARGET_NAME "godot-cpp.${TARGET_ALIAS}" )
293293

294294
# Generator Expressions that rely on the target
295295
set( DEBUG_FEATURES "$<NOT:$<STREQUAL:${TARGET_ALIAS},template_release>>" )
296-
set( HOT_RELOAD "$<IF:${HOT_RELOAD-UNSET},${DEBUG_FEATURES},$<BOOL:${GODOT_USE_HOT_RELOAD}>>" )
296+
set( HOT_RELOAD "$<IF:${HOT_RELOAD-UNSET},${DEBUG_FEATURES},$<BOOL:${GODOTCPP_USE_HOT_RELOAD}>>" )
297297

298298
# Suffix
299-
string( CONCAT GODOT_SUFFIX
299+
string( CONCAT GODOTCPP_SUFFIX
300300
"$<1:.${SYSTEM_NAME}>"
301301
"$<1:.${TARGET_ALIAS}>"
302302
"$<${IS_DEV_BUILD}:.dev>"
303-
"$<$<STREQUAL:${GODOT_PRECISION},double>:.double>"
303+
"$<$<STREQUAL:${GODOTCPP_PRECISION},double>:.double>"
304304
"$<1:.${ARCH_NAME}>"
305305
# TODO IOS_SIMULATOR
306306
"$<$<NOT:${THREADS_ENABLED}>:.nothreads>"
@@ -318,33 +318,33 @@ function( godotcpp_generate )
318318
${GENERATED_FILES_LIST}
319319
)
320320

321-
target_include_directories( ${TARGET_NAME} ${GODOT_SYSTEM_HEADERS_ATTRIBUTE} PUBLIC
321+
target_include_directories( ${TARGET_NAME} ${GODOTCPP_SYSTEM_HEADERS_ATTRIBUTE} PUBLIC
322322
include
323323
${CMAKE_CURRENT_BINARY_DIR}/gen/include
324-
${GODOT_GDEXTENSION_DIR}
324+
${GODOTCPP_GDEXTENSION_DIR}
325325
)
326326

327327
set_target_properties( ${TARGET_NAME}
328328
PROPERTIES
329329
CXX_STANDARD 17
330330
CXX_EXTENSIONS OFF
331-
CXX_VISIBILITY_PRESET ${GODOT_SYMBOL_VISIBILITY}
331+
CXX_VISIBILITY_PRESET ${GODOTCPP_SYMBOL_VISIBILITY}
332332

333-
COMPILE_WARNING_AS_ERROR ${GODOT_WARNING_AS_ERROR}
333+
COMPILE_WARNING_AS_ERROR ${GODOTCPP_WARNING_AS_ERROR}
334334
POSITION_INDEPENDENT_CODE ON
335335
BUILD_RPATH_USE_ORIGIN ON
336336

337337
PREFIX "lib"
338-
OUTPUT_NAME "${PROJECT_NAME}${GODOT_SUFFIX}"
338+
OUTPUT_NAME "${PROJECT_NAME}${GODOTCPP_SUFFIX}"
339339

340340
ARCHIVE_OUTPUT_DIRECTORY "$<1:${CMAKE_BINARY_DIR}/bin>"
341341

342342
# Things that are handy to know for dependent targets
343-
GODOT_PLATFORM "${SYSTEM_NAME}"
344-
GODOT_TARGET "${TARGET_ALIAS}"
345-
GODOT_ARCH "${ARCH_NAME}"
346-
GODOT_PRECISION "${GODOT_PRECISION}"
347-
GODOT_SUFFIX "${GODOT_SUFFIX}"
343+
GODOTCPP_PLATFORM "${SYSTEM_NAME}"
344+
GODOTCPP_TARGET "${TARGET_ALIAS}"
345+
GODOTCPP_ARCH "${ARCH_NAME}"
346+
GODOTCPP_PRECISION "${GODOTCPP_PRECISION}"
347+
GODOTCPP_SUFFIX "${GODOTCPP_SUFFIX}"
348348

349349
# Some IDE's respect this property to logically group targets
350350
FOLDER "godot-cpp"

cmake/windows.cmake

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,21 @@ documentation.
5454
5555
]=======================================================================]
5656
function( windows_options )
57-
option( GODOT_USE_STATIC_CPP "Link MinGW/MSVC C++ runtime libraries statically" ON )
58-
option( GODOT_DEBUG_CRT "Compile with MSVC's debug CRT (/MDd)" OFF )
57+
option( GODOTCPP_USE_STATIC_CPP "Link MinGW/MSVC C++ runtime libraries statically" ON )
58+
option( GODOTCPP_DEBUG_CRT "Compile with MSVC's debug CRT (/MDd)" OFF )
5959

6060
message( STATUS "If not already cached, setting CMAKE_MSVC_RUNTIME_LIBRARY.\n"
6161
"\tFor more information please read godot-cpp/cmake/windows.cmake")
6262

6363
set( CMAKE_MSVC_RUNTIME_LIBRARY
64-
"MultiThreaded$<IF:$<BOOL:${GODOT_DEBUG_CRT}>,DebugDLL,$<$<NOT:$<BOOL:${GODOT_USE_STATIC_CPP}>>:DLL>>"
64+
"MultiThreaded$<IF:$<BOOL:${GODOTCPP_DEBUG_CRT}>,DebugDLL,$<$<NOT:$<BOOL:${GODOTCPP_USE_STATIC_CPP}>>:DLL>>"
6565
CACHE STRING "Select the MSVC runtime library for use by compilers targeting the MSVC ABI.")
6666
endfunction()
6767

6868

6969
#[===========================[ Target Generation ]===========================]
7070
function( windows_generate )
71-
set( STATIC_CPP "$<BOOL:${GODOT_USE_STATIC_CPP}>")
71+
set( STATIC_CPP "$<BOOL:${GODOTCPP_USE_STATIC_CPP}>")
7272

7373
set_target_properties( ${TARGET_NAME}
7474
PROPERTIES

0 commit comments

Comments
 (0)