Commit Graph

3 Commits (1f6f05e7ae1ef38fd7f4a673da858dfe9598f13a)

Author SHA1 Message Date
ytnuf 1f6f05e7ae Also install a pkg-config file
This for interoperability with other build systems
2024-11-19 13:04:17 +00:00
ytnuf cd6bb165fa Make godot-cpp installable with cmake config
godot-cpp can be installed like this:
cmake && make && make install

It can be used like this:
find_pacakge("godot")
target_link_libraries("my_gdextension_project" PRIVATE "godot::cpp")

The install destination uses CMAKE_INSTALL_ so that package managers
can choose the best location for these artifacts

As BUILD_INTERFACE requires absolute path, this means that
GODOT_GDEXTENSION_DIR needs to be an absolute path
2024-11-19 13:04:12 +00:00
Samuel Nicholas 2402a044eb Re-Structure cmake solution to be closer to the scons solution.
This is just a single step, re-arranging the code without actually changing its functionality.

new docs/cmake.md
moved the block of comments from the start of the CMakeLists.txt into the cmake.md file and converted content to markdown.

new cmake/godotcpp.cmake
Moved all exposed options into a new function godotcpp_options()
Moved configuration and generation code into godotcpp_generate()

To get all the options into the godotcpp_options() I changed the logic of GODOT_USE_HOT_RELOAD which I believe is a closer match to scons, that if the options is not set, and the build type is not release, then it defaults to ON.

I msvc builds require the default flags to be modified or it will throw errors. I have added the links to articles in the commit, but its about removing the runtime error checks /RTC1 from the CMAKE_CXX_FLAGS_DEBUG variable. This needs to happen before the files are included.
https://stackoverflow.com/questions/74426638/how-to-remove-rtc1-from-specific-target-or-file-in-cmake
https://discourse.cmake.org/t/how-do-i-remove-compile-options-from-target/5965

Renamed GodotCompilerWarnings.cmake to common_compiler_flags.cmake to match scons

Included files explicitly by path, as we dont need to append to the CMAKE_MODULES_PATH which effects the whole build tree.

This prevents consumers of the library from clobbering the names of the cmake include files and breaking the build.
2024-09-24 16:27:28 +09:30