updated godot-cpp
This commit is contained in:
41
templates/CMakeLists.txt
Normal file
41
templates/CMakeLists.txt
Normal file
@@ -0,0 +1,41 @@
|
||||
# SPDX-License-Identifier: Unlicense
|
||||
|
||||
add_custom_target( templates
|
||||
SOURCES
|
||||
template.debug.gdextension.in
|
||||
template.release.gdextension.in
|
||||
)
|
||||
|
||||
add_dependencies( ${PROJECT_NAME} templates )
|
||||
|
||||
# We shouldn't be relying on CMAKE_BUILD_TYPE (see https://github.com/asmaloney/GDExtensionTemplate/issues/25)
|
||||
# But until we fix it here and in godot-cpp, ensure it's one we expect.
|
||||
set ( ALLOWED_BUILDS "Debug;Release" )
|
||||
if ( NOT "${CMAKE_BUILD_TYPE}" IN_LIST ALLOWED_BUILDS )
|
||||
message( FATAL_ERROR "CMAKE_BUILD_TYPE must be set to Debug or Release" )
|
||||
endif()
|
||||
|
||||
# Get our gdextension input file name based on build type
|
||||
string( TOLOWER ${CMAKE_BUILD_TYPE} BUILD_TYPE )
|
||||
set( GD_EXTENSION_FILE_INPUT template.${BUILD_TYPE}.gdextension.in )
|
||||
|
||||
# Workaround to add the "lib" prefix to the library in our template file if using MSYS2.
|
||||
if ( MINGW )
|
||||
set( LIB_PREFIX "lib")
|
||||
endif()
|
||||
|
||||
# Generate our project's .gdextension file from the template
|
||||
set( GD_EXTENSION_FILE ${PROJECT_NAME}.gdextension )
|
||||
configure_file( ${GD_EXTENSION_FILE_INPUT} ${PROJECT_BINARY_DIR}/${PROJECT_NAME}/${GD_EXTENSION_FILE} )
|
||||
|
||||
# Install the gdextension file from the build directory
|
||||
install(
|
||||
FILES ${BUILD_OUTPUT_DIR}/${GD_EXTENSION_FILE}
|
||||
DESTINATION ${INSTALL_DIR}
|
||||
)
|
||||
|
||||
unset( ALLOWED_BUILDS )
|
||||
unset( BUILD_TYPE )
|
||||
unset( GD_EXTENSION_FILE )
|
||||
unset( GD_EXTENSION_FILE_INPUT )
|
||||
unset( LIB_PREFIX )
|
||||
11
templates/template.debug.gdextension.in
Normal file
11
templates/template.debug.gdextension.in
Normal file
@@ -0,0 +1,11 @@
|
||||
[configuration]
|
||||
entry_symbol = "GDExtensionInit"
|
||||
compatibility_minimum = 4.1
|
||||
|
||||
[icons]
|
||||
Example = "icons/Example.svg"
|
||||
|
||||
[libraries]
|
||||
linux.debug.x86_64 = "lib/Linux-x86_64/lib${PROJECT_NAME}-d.so"
|
||||
macos.debug = "lib/Darwin-Universal/lib${PROJECT_NAME}-d.dylib"
|
||||
windows.debug.x86_64 = "lib/Windows-AMD64/${LIB_PREFIX}${PROJECT_NAME}-d.dll"
|
||||
11
templates/template.release.gdextension.in
Normal file
11
templates/template.release.gdextension.in
Normal file
@@ -0,0 +1,11 @@
|
||||
[configuration]
|
||||
entry_symbol = "GDExtensionInit"
|
||||
compatibility_minimum = 4.1
|
||||
|
||||
[icons]
|
||||
Example = "icons/Example.svg"
|
||||
|
||||
[libraries]
|
||||
linux.release.x86_64 = "lib/Linux-x86_64/lib${PROJECT_NAME}.so"
|
||||
macos.release = "lib/Darwin-universal/lib${PROJECT_NAME}.dylib"
|
||||
windows.release.x86_64 = "lib/Windows-AMD64/${LIB_PREFIX}${PROJECT_NAME}.dll"
|
||||
Reference in New Issue
Block a user