Skip to content

Commit e3e8101

Browse files
authored
Merge pull request #1330 from pimms/cmake-hot-reload
Add hot reload support to CMakeLists.txt
2 parents daf6ad3 + 0a078d9 commit e3e8101

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# GODOT_GDEXTENSION_DIR: Path to the directory containing GDExtension interface header and API JSON file
66
# GODOT_CPP_SYSTEM_HEADERS Mark the header files as SYSTEM. This may be useful to suppress warnings in projects including this one.
77
# 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.
89
# GODOT_CUSTOM_API_FILE: Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`)
910
# FLOAT_PRECISION: Floating-point precision level ("single", "double")
1011
#
@@ -57,6 +58,13 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "")
5758
set(CMAKE_BUILD_TYPE Debug)
5859
endif()
5960

61+
# Hot reload is enabled by default in Debug-builds
62+
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
63+
option(GODOT_ENABLE_HOT_RELOAD "Build with hot reload support" ON)
64+
else()
65+
option(GODOT_ENABLE_HOT_RELOAD "Build with hot reload support" OFF)
66+
endif()
67+
6068
if(NOT DEFINED BITS)
6169
set(BITS 32)
6270
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
@@ -116,6 +124,10 @@ else()
116124
endif()
117125
endif()
118126

127+
if (GODOT_ENABLE_HOT_RELOAD)
128+
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -D HOT_RELOAD_ENABLED")
129+
endif()
130+
119131
# Generate source from the bindings file
120132
find_package(Python3 3.4 REQUIRED) # pathlib should be present
121133
if(GENERATE_TEMPLATE_GET_NODE)

0 commit comments

Comments
 (0)