From 31179ee47c9b6a0d59dc09467b5c2619e6853427 Mon Sep 17 00:00:00 2001 From: Joakim Stien Date: Sat, 9 Dec 2023 15:13:32 +0100 Subject: [PATCH 1/2] Added hot reload support to CMakeLists.txt --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e7151026..7ba159f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,7 @@ project(godot-cpp LANGUAGES CXX) option(GENERATE_TEMPLATE_GET_NODE "Generate a template version of the Node class's get_node." ON) option(GODOT_CPP_SYSTEM_HEADERS "Expose headers as SYSTEM." ON) option(GODOT_CPP_WARNING_AS_ERROR "Treat warnings as errors" OFF) +option(GODOT_ENABLE_HOT_RELOAD "Build with hot reload support" OFF) # Add path to modules list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" ) @@ -116,6 +117,10 @@ else() endif() endif() +if (GODOT_ENABLE_HOT_RELOAD) + set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -D HOT_RELOAD_ENABLED") +endif() + # Generate source from the bindings file find_package(Python3 3.4 REQUIRED) # pathlib should be present if(GENERATE_TEMPLATE_GET_NODE) From 0a078d9ec95baba15783bfe4159b6377380cb3cf Mon Sep 17 00:00:00 2001 From: Joakim Stien Date: Sun, 10 Dec 2023 11:25:38 +0100 Subject: [PATCH 2/2] =?UTF-8?q?PR=20comments=20=E2=80=94=20added=20doc,=20?= =?UTF-8?q?default=20'ON'=20in=20Debug,=20'OFF'=20in=20Release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ba159f0..11f6c958 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ # GODOT_GDEXTENSION_DIR: Path to the directory containing GDExtension interface header and API JSON file # GODOT_CPP_SYSTEM_HEADERS Mark the header files as SYSTEM. This may be useful to supress warnings in projects including this one. # GODOT_CPP_WARNING_AS_ERROR Treat any warnings as errors +# GODOT_ENABLE_HOT_RELOAD Build with hot reload support. Defaults to YES for Debug-builds and NO for Release-builds. # GODOT_CUSTOM_API_FILE: Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`) # FLOAT_PRECISION: Floating-point precision level ("single", "double") # @@ -43,7 +44,6 @@ project(godot-cpp LANGUAGES CXX) option(GENERATE_TEMPLATE_GET_NODE "Generate a template version of the Node class's get_node." ON) option(GODOT_CPP_SYSTEM_HEADERS "Expose headers as SYSTEM." ON) option(GODOT_CPP_WARNING_AS_ERROR "Treat warnings as errors" OFF) -option(GODOT_ENABLE_HOT_RELOAD "Build with hot reload support" OFF) # Add path to modules list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" ) @@ -58,6 +58,13 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "") set(CMAKE_BUILD_TYPE Debug) endif() +# Hot reload is enabled by default in Debug-builds +if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + option(GODOT_ENABLE_HOT_RELOAD "Build with hot reload support" ON) +else() + option(GODOT_ENABLE_HOT_RELOAD "Build with hot reload support" OFF) +endif() + if(NOT DEFINED BITS) set(BITS 32) if(CMAKE_SIZEOF_VOID_P EQUAL 8)