Compare commits

...

5 Commits

Author SHA1 Message Date
Slawomir Grabowski 6f774d5916
Merge 6b02a58e5a into 36847f6af0 2024-01-30 08:28:30 -07:00
David Snopek 36847f6af0
Merge pull request #1370 from MJacred/patch-1
Update README: fix godot-cpp issue tracker url
2024-01-22 08:57:08 -06:00
MJacred 8a535d0ecc
Update README: fix godot-cpp issue tracker url 2024-01-22 10:50:27 +01:00
Slawomir Grabowski 6b02a58e5a Merge remote-tracking branch 'godot/master' into cmake-exporting-config 2023-12-23 08:41:06 +01:00
Slawomir Grabowski 79a0d64f8a CMake config exporting 2023-11-14 21:41:58 +01:00
3 changed files with 52 additions and 5 deletions

View File

@ -6,6 +6,7 @@
# GODOT_CPP_SYSTEM_HEADERS Mark the header files as SYSTEM. This may be useful to supress warnings in projects including this one. # 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_CPP_WARNING_AS_ERROR Treat any warnings as errors
# GODOT_CUSTOM_API_FILE: Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`) # GODOT_CUSTOM_API_FILE: Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`)
# GODOT_CPP_INSTALL: Enables target install for exporting godot-cpp cmake configuration
# FLOAT_PRECISION: Floating-point precision level ("single", "double") # FLOAT_PRECISION: Floating-point precision level ("single", "double")
# #
# Android cmake arguments # Android cmake arguments
@ -43,6 +44,8 @@ project(godot-cpp LANGUAGES CXX)
option(GENERATE_TEMPLATE_GET_NODE "Generate a template version of the Node class's get_node." ON) 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_SYSTEM_HEADERS "Expose headers as SYSTEM." ON)
option(GODOT_CPP_WARNING_AS_ERROR "Treat warnings as errors" OFF) option(GODOT_CPP_WARNING_AS_ERROR "Treat warnings as errors" OFF)
option(GODOT_CPP_INSTALL "Enables target install for exporting godot-cpp cmake configuration" ON)
# Add path to modules # Add path to modules
list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" ) list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" )
@ -65,7 +68,7 @@ if(NOT DEFINED BITS)
endif() endif()
# Input from user for GDExtension interface header and the API JSON file # Input from user for GDExtension interface header and the API JSON file
set(GODOT_GDEXTENSION_DIR "gdextension" CACHE STRING "") set(GODOT_GDEXTENSION_DIR "${CMAKE_CURRENT_SOURCE_DIR}/gdextension" CACHE STRING "")
set(GODOT_CUSTOM_API_FILE "" CACHE STRING "") set(GODOT_CUSTOM_API_FILE "" CACHE STRING "")
set(GODOT_GDEXTENSION_API_FILE "${GODOT_GDEXTENSION_DIR}/extension_api.json") set(GODOT_GDEXTENSION_API_FILE "${GODOT_GDEXTENSION_DIR}/extension_api.json")
@ -183,9 +186,10 @@ if (GODOT_CPP_SYSTEM_HEADERS)
endif () endif ()
target_include_directories(${PROJECT_NAME} ${GODOT_CPP_SYSTEM_HEADERS_ATTRIBUTE} PUBLIC target_include_directories(${PROJECT_NAME} ${GODOT_CPP_SYSTEM_HEADERS_ATTRIBUTE} PUBLIC
include $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
${CMAKE_CURRENT_BINARY_DIR}/gen/include $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/gen/include>
${GODOT_GDEXTENSION_DIR} $<BUILD_INTERFACE:${GODOT_GDEXTENSION_DIR}>
$<INSTALL_INTERFACE:include>
) )
# Add the compile flags # Add the compile flags
@ -214,3 +218,43 @@ set_target_properties(${PROJECT_NAME}
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
OUTPUT_NAME "${OUTPUT_NAME}" OUTPUT_NAME "${OUTPUT_NAME}"
) )
if ($CACHE{GODOT_CPP_INSTALL})
install(TARGETS ${PROJECT_NAME}
EXPORT GodotCppTargets
)
install(EXPORT GodotCppTargets
FILE GodotCppTargets.cmake
NAMESPACE godot::
DESTINATION lib/cmake/GodotCpp
)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
DESTINATION include
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gen/include/
DESTINATION include
)
if (GODOT_GDEXTENSION_DIR AND EXISTS ${GODOT_GDEXTENSION_DIR})
install(DIRECTORY ${GODOT_GDEXTENSION_DIR}/
DESTINATION include
)
endif ()
include(CMakePackageConfigHelpers)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/GodotCppConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/GodotCppConfig.cmake"
INSTALL_DESTINATION "lib/cmake/GodotCpp"
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/GodotCppConfig.cmake
DESTINATION lib/cmake/GodotCpp
)
endif ()

View File

@ -58,7 +58,7 @@ first-party `godot-cpp` extension.
Some compatibility breakage is to be expected as GDExtension and `godot-cpp` Some compatibility breakage is to be expected as GDExtension and `godot-cpp`
get more used, documented, and critical issues get resolved. See the get more used, documented, and critical issues get resolved. See the
[Godot issue tracker](https://github.com/godotengine/godot/issues?q=is%3Aissue+is%3Aopen+label%3Atopic%3Agdextension) [Godot issue tracker](https://github.com/godotengine/godot/issues?q=is%3Aissue+is%3Aopen+label%3Atopic%3Agdextension)
and the [godot-cpp issue tracker](https://github.com/godotengine/godot/issues) and the [godot-cpp issue tracker](https://github.com/godotengine/godot-cpp/issues)
for a list of known issues, and be sure to provide feedback on issues and PRs for a list of known issues, and be sure to provide feedback on issues and PRs
which affect your use of this extension. which affect your use of this extension.

View File

@ -0,0 +1,3 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/GodotCppTargets.cmake")