11# 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)
33#
44# 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")
1111#
1212# 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)
1717# More info here: https://godot.readthedocs.io/en/latest/development/compiling/compiling_for_android.html
1818#
1919# Examples
4545cmake_minimum_required (VERSION 3.13)
4646project (godot-cpp LANGUAGES CXX)
4747
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 )
5151
5252set ( GODOT_SYMBOL_VISIBILITY "hidden" CACHE STRING "Symbols visibility on GNU platforms. Use 'auto' to apply the default value. (auto|visible|hidden)" )
5353set_property ( CACHE GODOT_SYMBOL_VISIBILITY PROPERTY STRINGS "auto;visible;hidden" )
@@ -76,9 +76,9 @@ endif()
7676
7777# Hot reload is enabled by default in Debug-builds
7878if ("${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 )
8080else ()
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 )
8282endif ()
8383
8484if (NOT DEFINED BITS)
@@ -89,20 +89,22 @@ if(NOT DEFINED BITS)
8989endif ()
9090
9191# 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 )" )
9496
9597set (GODOT_GDEXTENSION_API_FILE "${GODOT_GDEXTENSION_DIR} /extension_api.json" )
9698if (NOT "${GODOT_CUSTOM_API_FILE} " STREQUAL "" ) # User-defined override.
9799 set (GODOT_GDEXTENSION_API_FILE "${GODOT_CUSTOM_API_FILE} " )
98100endif ()
99101
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" )
102104 add_definitions (-DREAL_T_IS_DOUBLE)
103105endif ()
104106
105- set (GODOT_COMPILE_FLAGS )
107+ set ( GODOT_COMPILE_FLAGS )
106108
107109if ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "MSVC" )
108110 # using Visual Studio C++
@@ -127,7 +129,7 @@ endif()
127129
128130# Disable exception handling. Godot doesn't use exceptions anywhere, and this
129131# 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 )
131133if (GODOT_DISABLE_EXCEPTIONS)
132134 if ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "MSVC" )
133135 set (GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -D_HAS_EXCEPTIONS=0" )
@@ -142,7 +144,7 @@ endif()
142144
143145# Generate source from the bindings file
144146find_package (Python3 3.4 REQUIRED) # pathlib should be present
145- if (GENERATE_TEMPLATE_GET_NODE )
147+ if (GODOT_GENERATE_TEMPLATE_GET_NODE )
146148 set (GENERATE_BINDING_PARAMETERS "True" )
147149else ()
148150 set (GENERATE_BINDING_PARAMETERS "False" )
@@ -155,7 +157,7 @@ execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" "import binding_generator;
155157)
156158
157159add_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} \" )"
159161 VERBATIM
160162 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
161163 MAIN_DEPENDENCY ${GODOT_GDEXTENSION_API_FILE}
@@ -182,7 +184,7 @@ target_compile_features(${PROJECT_NAME}
182184 cxx_std_17
183185)
184186
185- if (GODOT_ENABLE_HOT_RELOAD )
187+ if (GODOT_USE_HOT_RELOAD )
186188 target_compile_definitions (${PROJECT_NAME} PUBLIC HOT_RELOAD_ENABLED)
187189 target_compile_options (${PROJECT_NAME} PUBLIC $<${compiler_is_gnu} :-fno-gnu-unique>)
188190endif ()
@@ -206,12 +208,12 @@ target_link_options(${PROJECT_NAME} PRIVATE
206208)
207209
208210# 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 )
212214endif ()
213215
214- target_include_directories (${PROJECT_NAME} ${GODOT_CPP_SYSTEM_HEADERS_ATTRIBUTE } PUBLIC
216+ target_include_directories (${PROJECT_NAME} ${GODOT_SYSTEM_HEADERS_ATTRIBUTE } PUBLIC
215217 include
216218 ${CMAKE_CURRENT_BINARY_DIR} /gen/include
217219 ${GODOT_GDEXTENSION_DIR}
0 commit comments