godot-cpp icon indicating copy to clipboard operation
godot-cpp copied to clipboard

Added hot reload support to CMakeLists.txt

Open pimms opened this issue 1 year ago • 6 comments

Add support for hot reloading when building godot-cpp using CMake.

CMake projects can enable the reloading by setting GODOT_ENABLE_HOT_RELOAD to ON before including the godot-cpp subdirectory.

Example:

set(GODOT_ENABLE_HOT_RELOAD ON)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/godot-cpp/" build-godot-cpp)

I believe I've done all of this correctly — I'm super new to both Godot and Scons, but from how I understand the Scons-support for hot reloading in https://github.com/godotengine/godot-cpp/pull/1200, I believe this to be correct.

pimms avatar Dec 09 '23 14:12 pimms

This does not match what the code does for scons, it defaults to true if you are not on a release build:

if env.get("use_hot_reload") is None:
    env["use_hot_reload"] = env["target"] != "template_release"

This should be reflected here

AThousandShips avatar Dec 09 '23 15:12 AThousandShips

Thanks for the comments! I've made changes accordingly, but I was not able to set the default value in a particularly elegant manner. My CMake skills are quite basic, and I couldn't get generator expressions to work as I wanted, hence the ugly if (...)/else().

pimms avatar Dec 10 '23 10:12 pimms

@AThousandShips

pimms avatar Dec 19 '23 10:12 pimms

Why are you pinging me with no question or anything? Please don't just ping people to boost things 🙁

AThousandShips avatar Dec 19 '23 10:12 AThousandShips

I'm not sure how reviews and merging in Godot typically goes, but I fixed the comments 10 days ago and left a comment about it. The ping was just a friendly notification in case you didn't see it.

pimms avatar Dec 20 '23 10:12 pimms

Understood, but then please make that clear, just pinging someone without any details isn't very friendly 🙂

The review process can be slow at times, especially at this time of year, I mainly gave some minor details and would have approved had it been something I was ready to do, I get updates when things change so no worries, no need to remind

Also for the future, if you want a new review, just push the little icon next to the reviewer to re-request review (don't do it for me here though, as I have nothing to add here)

It can be confusing I know 🙂, but I hope you can see that just tagging someone without actually stating your intent (and assuming it's clear from assumptions) is a bit like just yelling "hey!" at someone

AThousandShips avatar Dec 20 '23 10:12 AThousandShips