commit
560f786599
|
@ -155,6 +155,8 @@ function( common_compiler_flags )
|
|||
$<$<STREQUAL:${GODOT_PRECISION},double>:REAL_T_IS_DOUBLE>
|
||||
|
||||
$<${IS_MSVC}:$<${DISABLE_EXCEPTIONS}:_HAS_EXCEPTIONS=0>>
|
||||
|
||||
$<${THREADS_ENABLED}:THREADS_ENABLED>
|
||||
)
|
||||
|
||||
target_link_options( ${TARGET_NAME}
|
||||
|
|
|
@ -107,7 +107,8 @@ function( godotcpp_options )
|
|||
set( GODOT_ARCH "" CACHE STRING "Target CPU Architecture")
|
||||
set_property( CACHE GODOT_ARCH PROPERTY STRINGS ${ARCH_LIST} )
|
||||
|
||||
#TODO threads
|
||||
set( GODOT_THREADS ON CACHE BOOL "Enable threading support" )
|
||||
|
||||
#TODO compiledb
|
||||
#TODO compiledb_file
|
||||
|
||||
|
@ -240,16 +241,15 @@ function( godotcpp_generate )
|
|||
|
||||
### Platform is derived from the toolchain target
|
||||
# See GeneratorExpressions PLATFORM_ID and CMAKE_SYSTEM_NAME
|
||||
set( SYSTEM_NAME
|
||||
$<$<PLATFORM_ID:Android>:android>
|
||||
$<$<PLATFORM_ID:iOS>:ios>
|
||||
$<$<PLATFORM_ID:Linux>:linux>
|
||||
$<$<PLATFORM_ID:Darwin>:macos>
|
||||
$<$<PLATFORM_ID:Emscripten>:web>
|
||||
$<$<PLATFORM_ID:Windows>:windows>
|
||||
$<$<PLATFORM_ID:Msys>:windows>
|
||||
string( CONCAT SYSTEM_NAME
|
||||
"$<$<PLATFORM_ID:Android>:android.${ANDROID_ABI}>"
|
||||
"$<$<PLATFORM_ID:iOS>:ios>"
|
||||
"$<$<PLATFORM_ID:Linux>:linux>"
|
||||
"$<$<PLATFORM_ID:Darwin>:macos>"
|
||||
"$<$<PLATFORM_ID:Emscripten>:web>"
|
||||
"$<$<PLATFORM_ID:Windows>:windows>"
|
||||
"$<$<PLATFORM_ID:Msys>:windows>"
|
||||
)
|
||||
string(REPLACE ";" "" SYSTEM_NAME "${SYSTEM_NAME}")
|
||||
|
||||
### Use the arch from the toolchain if it isn't set manually
|
||||
if( GODOT_ARCH )
|
||||
|
@ -263,6 +263,8 @@ function( godotcpp_generate )
|
|||
|
||||
set( DISABLE_EXCEPTIONS "$<BOOL:${GODOT_DISABLE_EXCEPTIONS}>")
|
||||
|
||||
set( THREADS_ENABLED "$<BOOL:${GODOT_THREADS}>" )
|
||||
|
||||
# GODOT_DEV_BUILD
|
||||
set( RELEASE_TYPES "Release;MinSizeRel")
|
||||
get_property( IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG )
|
||||
|
@ -272,8 +274,6 @@ function( godotcpp_generate )
|
|||
message( WARNING "=> GODOT_DEV_BUILD implies a Debug-like build but CMAKE_BUILD_TYPE is '${CMAKE_BUILD_TYPE}'")
|
||||
endif ()
|
||||
set( IS_DEV_BUILD "$<BOOL:${GODOT_DEV_BUILD}>")
|
||||
# The .dev portion of the name if GODOT_DEV_BUILD is true.
|
||||
set( DEV_TAG "$<${IS_DEV_BUILD}:.dev>" )
|
||||
|
||||
### Define our godot-cpp library targets
|
||||
foreach ( TARGET_ALIAS template_debug template_release editor )
|
||||
|
@ -283,6 +283,17 @@ function( godotcpp_generate )
|
|||
set( DEBUG_FEATURES "$<NOT:$<STREQUAL:${TARGET_ALIAS},template_release>>" )
|
||||
set( HOT_RELOAD "$<IF:${HOT_RELOAD-UNSET},${DEBUG_FEATURES},$<BOOL:${GODOT_USE_HOT_RELOAD}>>" )
|
||||
|
||||
# Suffix
|
||||
string( CONCAT GODOT_SUFFIX
|
||||
"$<1:.${SYSTEM_NAME}>"
|
||||
"$<1:.${TARGET_ALIAS}>"
|
||||
"$<${IS_DEV_BUILD}:.dev>"
|
||||
"$<$<STREQUAL:${GODOT_PRECISION},double>:.double>"
|
||||
"$<1:.${SYSTEM_ARCH}>"
|
||||
# TODO IOS_SIMULATOR
|
||||
"$<$<NOT:${THREADS_ENABLED}>:.nothreads>"
|
||||
)
|
||||
|
||||
# the godot-cpp.* library targets
|
||||
add_library( ${TARGET_NAME} STATIC EXCLUDE_FROM_ALL )
|
||||
add_library( godot-cpp::${TARGET_ALIAS} ALIAS ${TARGET_NAME} )
|
||||
|
@ -311,14 +322,17 @@ function( godotcpp_generate )
|
|||
POSITION_INDEPENDENT_CODE ON
|
||||
BUILD_RPATH_USE_ORIGIN ON
|
||||
|
||||
PREFIX lib
|
||||
OUTPUT_NAME "${PROJECT_NAME}.${SYSTEM_NAME}.${TARGET_ALIAS}${DEV_TAG}.${SYSTEM_ARCH}"
|
||||
PREFIX "lib"
|
||||
OUTPUT_NAME "${PROJECT_NAME}${GODOT_SUFFIX}"
|
||||
|
||||
ARCHIVE_OUTPUT_DIRECTORY "$<1:${CMAKE_BINARY_DIR}/bin>"
|
||||
|
||||
# Things that are handy to know for dependent targets
|
||||
GODOT_PLATFORM "${SYSTEM_NAME}"
|
||||
GODOT_TARGET "${TARGET_ALIAS}"
|
||||
GODOT_ARCH "${SYSTEM_ARCH}"
|
||||
GODOT_PLATFORM "${SYSTEM_NAME}"
|
||||
GODOT_TARGET "${TARGET_ALIAS}"
|
||||
GODOT_ARCH "${SYSTEM_ARCH}"
|
||||
GODOT_PRECISION "${GODOT_PRECISION}"
|
||||
GODOT_SUFFIX "${GODOT_SUFFIX}"
|
||||
|
||||
# Some IDE's respect this property to logically group targets
|
||||
FOLDER "godot-cpp"
|
||||
|
|
|
@ -27,6 +27,7 @@ function( web_generate )
|
|||
-sSIDE_MODULE
|
||||
-sSUPPORT_LONGJMP=wasm
|
||||
-fno-exceptions
|
||||
$<${THREADS_ENABLED}:-sUSE_PTHREADS=1>
|
||||
)
|
||||
|
||||
target_link_options( ${TARGET_NAME}
|
||||
|
|
|
@ -18,7 +18,6 @@ generate_doc_source( "${DOC_DATA_SOURCE}" "${DOC_XML}" )
|
|||
|
||||
foreach( TARGET_ALIAS template_debug template_release editor )
|
||||
set( TARGET_NAME "godot-cpp.test.${TARGET_ALIAS}" )
|
||||
set( LINK_TARGET "godot-cpp::${TARGET_ALIAS}" )
|
||||
|
||||
add_library( ${TARGET_NAME} SHARED EXCLUDE_FROM_ALL )
|
||||
|
||||
|
@ -31,20 +30,20 @@ foreach( TARGET_ALIAS template_debug template_release editor )
|
|||
src/tests.h
|
||||
)
|
||||
|
||||
set( OUTPUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/project/bin/" )
|
||||
|
||||
# conditionally add doc data to compile output
|
||||
if( TARGET_ALIAS MATCHES "editor|template_debug" )
|
||||
target_sources( ${TARGET_NAME} PRIVATE "${DOC_DATA_SOURCE}" )
|
||||
endif( )
|
||||
endif()
|
||||
|
||||
# Link to godot-cpp target
|
||||
set( LINK_TARGET "godot-cpp::${TARGET_ALIAS}" )
|
||||
target_link_libraries( ${TARGET_NAME} PRIVATE ${LINK_TARGET} )
|
||||
|
||||
### Get useful properties of the library
|
||||
get_target_property( GODOT_PLATFORM ${LINK_TARGET} GODOT_PLATFORM )
|
||||
get_target_property( GODOT_TARGET ${LINK_TARGET} GODOT_TARGET )
|
||||
get_target_property( GODOT_ARCH ${LINK_TARGET} GODOT_ARCH )
|
||||
|
||||
set( OUTPUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/project/bin/" )
|
||||
set( DEV_TAG "$<$<BOOL:${GODOT_DEV_BUILD}>:.dev>" )
|
||||
### Get useful properties from godot-cpp target
|
||||
get_target_property( GODOT_SUFFIX ${LINK_TARGET} GODOT_SUFFIX )
|
||||
get_target_property( OSX_ARCH ${LINK_TARGET} OSX_ARCHITECTURES )
|
||||
|
||||
set_target_properties( ${TARGET_NAME}
|
||||
PROPERTIES
|
||||
|
@ -66,7 +65,7 @@ foreach( TARGET_ALIAS template_debug template_release editor )
|
|||
PDB_OUTPUT_DIRECTORY "$<1:${OUTPUT_DIR}>" #MSVC Only, ignored on other platforms
|
||||
|
||||
PREFIX "lib"
|
||||
OUTPUT_NAME "gdexample.${GODOT_PLATFORM}.${GODOT_TARGET}${DEV_TAG}.${GODOT_ARCH}"
|
||||
OUTPUT_NAME "gdexample${GODOT_SUFFIX}"
|
||||
|
||||
# Some IDE's respect this property to logically group targets
|
||||
FOLDER "godot-cpp"
|
||||
|
@ -74,21 +73,12 @@ foreach( TARGET_ALIAS template_debug template_release editor )
|
|||
|
||||
# CMAKE_SYSTEM_NAME refers to the target system
|
||||
if( CMAKE_SYSTEM_NAME STREQUAL Darwin )
|
||||
get_target_property( OSX_ARCH ${LINK_TARGET} OSX_ARCHITECTURES )
|
||||
|
||||
set( OUTPUT_DIR "${OUTPUT_DIR}/libgdexample.macos.${TEST_TARGET}.framework")
|
||||
|
||||
set_target_properties( ${TARGET_NAME}
|
||||
PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY "$<1:${OUTPUT_DIR}>"
|
||||
RUNTIME_OUTPUT_DIRECTORY "$<1:${OUTPUT_DIR}>"
|
||||
|
||||
OUTPUT_NAME "gdexample.macos.${TARGET_ALIAS}${DEV_TAG}"
|
||||
SUFFIX ""
|
||||
|
||||
#macos options
|
||||
OUTPUT_DIR "${OUTPUT_DIR}/libgdexample.macos.${TARGET_ALIAS}.framework"
|
||||
OSX_ARCHITECTURES "${OSX_ARCH}"
|
||||
)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
|
Loading…
Reference in New Issue