1
1
# cmake arguments
2
- # CMAKE_BUILD_TYPE: Compilation target (Debug or Release defaults to Debug)
2
+ # CMAKE_BUILD_TYPE: Compilation target (Debug or Release defaults to Debug)
3
3
#
4
4
# godot-cpp cmake arguments
5
- # GODOT_GDEXTENSION_DIR: Path to the directory containing GDExtension interface header and API JSON file
6
- # GODOT_CPP_SYSTEM_HEADERS Mark the header files as SYSTEM. This may be useful to suppress warnings in projects including this one.
7
- # GODOT_CPP_WARNING_AS_ERROR Treat any warnings as errors
8
- # GODOT_ENABLE_HOT_RELOAD Build with hot reload support. Defaults to YES for Debug-builds and NO for Release-builds.
9
- # GODOT_CUSTOM_API_FILE: Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`)
10
- # FLOAT_PRECISION: Floating-point precision level ("single", "double")
5
+ # GODOT_GDEXTENSION_DIR: Path to the directory containing GDExtension interface header and API JSON file
6
+ # GODOT_SYSTEM_HEADERS: Mark the header files as SYSTEM. This may be useful to suppress warnings in projects including this one.
7
+ # GODOT_WARNING_AS_ERROR: Treat any warnings as errors
8
+ # GODOT_USE_HOT_RELOAD: Build with hot reload support. Defaults to YES for Debug-builds and NO for Release-builds.
9
+ # GODOT_CUSTOM_API_FILE: Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`)
10
+ # GODOT_PRECISION: Floating-point precision level ("single", "double")
11
11
#
12
12
# Android cmake arguments
13
- # CMAKE_TOOLCHAIN_FILE: The path to the android cmake toolchain ($ANDROID_NDK/build/cmake/android.toolchain.cmake)
14
- # ANDROID_NDK: The path to the android ndk root folder
15
- # ANDROID_TOOLCHAIN_NAME: The android toolchain (arm-linux-androideabi-4.9 or aarch64-linux-android-4.9 or x86-4.9 or x86_64-4.9)
16
- # ANDROID_PLATFORM: The android platform version (android-23)
13
+ # CMAKE_TOOLCHAIN_FILE: The path to the android cmake toolchain ($ANDROID_NDK/build/cmake/android.toolchain.cmake)
14
+ # ANDROID_NDK: The path to the android ndk root folder
15
+ # ANDROID_TOOLCHAIN_NAME: The android toolchain (arm-linux-androideabi-4.9 or aarch64-linux-android-4.9 or x86-4.9 or x86_64-4.9)
16
+ # ANDROID_PLATFORM: The android platform version (android-23)
17
17
# More info here: https://godot.readthedocs.io/en/latest/development/compiling/compiling_for_android.html
18
18
#
19
19
# Examples
45
45
cmake_minimum_required (VERSION 3.13 )
46
46
project (godot-cpp LANGUAGES CXX )
47
47
48
- option (GENERATE_TEMPLATE_GET_NODE "Generate a template version of the Node class's get_node." ON )
49
- option (GODOT_CPP_SYSTEM_HEADERS "Expose headers as SYSTEM." ON )
50
- option (GODOT_CPP_WARNING_AS_ERROR "Treat warnings as errors" OFF )
48
+ option (GODOT_GENERATE_TEMPLATE_GET_NODE "Generate a template version of the Node class's get_node. (ON|OFF) " ON )
49
+ option (GODOT_SYSTEM_HEADERS "Expose headers as SYSTEM." ON )
50
+ option (GODOT_WARNING_AS_ERROR "Treat warnings as errors" OFF )
51
51
52
52
set ( GODOT_SYMBOL_VISIBILITY "hidden" CACHE STRING "Symbols visibility on GNU platforms. Use 'auto' to apply the default value. (auto|visible|hidden)" )
53
53
set_property ( CACHE GODOT_SYMBOL_VISIBILITY PROPERTY STRINGS "auto;visible;hidden" )
@@ -76,9 +76,9 @@ endif()
76
76
77
77
# Hot reload is enabled by default in Debug-builds
78
78
if ("${CMAKE_BUILD_TYPE} " STREQUAL "Debug" )
79
- option (GODOT_ENABLE_HOT_RELOAD "Build with hot reload support " ON )
79
+ option (GODOT_USE_HOT_RELOAD "Enable the extra accounting required to support hot reload. (ON|OFF) " ON )
80
80
else ()
81
- option (GODOT_ENABLE_HOT_RELOAD "Build with hot reload support " OFF )
81
+ option (GODOT_USE_HOT_RELOAD "Enable the extra accounting required to support hot reload. (ON|OFF) " OFF )
82
82
endif ()
83
83
84
84
if (NOT DEFINED BITS )
@@ -89,20 +89,22 @@ if(NOT DEFINED BITS)
89
89
endif ()
90
90
91
91
# Input from user for GDExtension interface header and the API JSON file
92
- set (GODOT_GDEXTENSION_DIR "gdextension" CACHE STRING "" )
93
- set (GODOT_CUSTOM_API_FILE "" CACHE STRING "" )
92
+ set (GODOT_GDEXTENSION_DIR "gdextension" CACHE PATH
93
+ "Path to a custom directory containing GDExtension interface header and API JSON file ( /path/to/gdextension_dir )" )
94
+ set (GODOT_CUSTOM_API_FILE "" CACHE FILEPATH
95
+ "Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`) ( /path/to/custom_api_file )" )
94
96
95
97
set (GODOT_GDEXTENSION_API_FILE "${GODOT_GDEXTENSION_DIR} /extension_api.json" )
96
98
if (NOT "${GODOT_CUSTOM_API_FILE} " STREQUAL "" ) # User-defined override.
97
99
set (GODOT_GDEXTENSION_API_FILE "${GODOT_CUSTOM_API_FILE} " )
98
100
endif ()
99
101
100
- set (FLOAT_PRECISION "single" CACHE STRING "" )
101
- if ("${FLOAT_PRECISION } " STREQUAL "double" )
102
+ set (GODOT_PRECISION "single" CACHE STRING "Set the floating-point precision level (single|double) " )
103
+ if ("${GODOT_PRECISION } " STREQUAL "double" )
102
104
add_definitions (-DREAL_T_IS_DOUBLE )
103
105
endif ()
104
106
105
- set (GODOT_COMPILE_FLAGS )
107
+ set ( GODOT_COMPILE_FLAGS )
106
108
107
109
if ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "MSVC" )
108
110
# using Visual Studio C++
@@ -127,7 +129,7 @@ endif()
127
129
128
130
# Disable exception handling. Godot doesn't use exceptions anywhere, and this
129
131
# saves around 20% of binary size and very significant build time (GH-80513).
130
- option (GODOT_DISABLE_EXCEPTIONS ON "Force disabling exception handling code" )
132
+ option (GODOT_DISABLE_EXCEPTIONS "Force disabling exception handling code (ON|OFF)" ON )
131
133
if (GODOT_DISABLE_EXCEPTIONS )
132
134
if ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "MSVC" )
133
135
set (GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -D_HAS_EXCEPTIONS=0" )
@@ -142,7 +144,7 @@ endif()
142
144
143
145
# Generate source from the bindings file
144
146
find_package (Python3 3.4 REQUIRED ) # pathlib should be present
145
- if (GENERATE_TEMPLATE_GET_NODE )
147
+ if (GODOT_GENERATE_TEMPLATE_GET_NODE )
146
148
set (GENERATE_BINDING_PARAMETERS "True" )
147
149
else ()
148
150
set (GENERATE_BINDING_PARAMETERS "False" )
@@ -155,7 +157,7 @@ execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" "import binding_generator;
155
157
)
156
158
157
159
add_custom_command (OUTPUT ${GENERATED_FILES_LIST}
158
- COMMAND "${Python3_EXECUTABLE} " "-c" "import binding_generator; binding_generator.generate_bindings(\" ${GODOT_GDEXTENSION_API_FILE} \" , \" ${GENERATE_BINDING_PARAMETERS} \" , \" ${BITS} \" , \" ${FLOAT_PRECISION } \" , \" ${CMAKE_CURRENT_BINARY_DIR} \" )"
160
+ COMMAND "${Python3_EXECUTABLE} " "-c" "import binding_generator; binding_generator.generate_bindings(\" ${GODOT_GDEXTENSION_API_FILE} \" , \" ${GENERATE_BINDING_PARAMETERS} \" , \" ${BITS} \" , \" ${GODOT_PRECISION } \" , \" ${CMAKE_CURRENT_BINARY_DIR} \" )"
159
161
VERBATIM
160
162
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
161
163
MAIN_DEPENDENCY ${GODOT_GDEXTENSION_API_FILE}
@@ -182,7 +184,7 @@ target_compile_features(${PROJECT_NAME}
182
184
cxx_std_17
183
185
)
184
186
185
- if (GODOT_ENABLE_HOT_RELOAD )
187
+ if (GODOT_USE_HOT_RELOAD )
186
188
target_compile_definitions (${PROJECT_NAME} PUBLIC HOT_RELOAD_ENABLED )
187
189
target_compile_options (${PROJECT_NAME} PUBLIC $< ${compiler_is_gnu} :-fno-gnu-unique> )
188
190
endif ()
@@ -206,12 +208,12 @@ target_link_options(${PROJECT_NAME} PRIVATE
206
208
)
207
209
208
210
# Optionally mark headers as SYSTEM
209
- set (GODOT_CPP_SYSTEM_HEADERS_ATTRIBUTE "" )
210
- if (GODOT_CPP_SYSTEM_HEADERS )
211
- set (GODOT_CPP_SYSTEM_HEADERS_ATTRIBUTE SYSTEM )
211
+ set (GODOT_SYSTEM_HEADERS_ATTRIBUTE "" )
212
+ if (GODOT_SYSTEM_HEADERS )
213
+ set (GODOT_SYSTEM_HEADERS_ATTRIBUTE SYSTEM )
212
214
endif ()
213
215
214
- target_include_directories (${PROJECT_NAME} ${GODOT_CPP_SYSTEM_HEADERS_ATTRIBUTE } PUBLIC
216
+ target_include_directories (${PROJECT_NAME} ${GODOT_SYSTEM_HEADERS_ATTRIBUTE } PUBLIC
215
217
include
216
218
${CMAKE_CURRENT_BINARY_DIR} /gen/include
217
219
${GODOT_GDEXTENSION_DIR}
0 commit comments