11# Configuration can be used as a template for custom project, read comments
2- cmake_minimum_required (VERSION 3.6 )
2+ cmake_minimum_required (VERSION 3.13 )
33project (gdexample LANGUAGES CXX)
44
55set (CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRel" )
@@ -14,7 +14,7 @@ add_subdirectory(
1414file (GLOB_RECURSE SOURCES src/*.c**)
1515file (GLOB_RECURSE HEADERS src/*.h**)
1616
17- get_directory_property (LIBRARY_SUFFIX DIRECTORY ${GODOT_CPP_PATH} DEFINITION LIBRARY_SUFFIX)
17+ get_target_property (LIBRARY_SUFFIX godot-cpp LIBRARY_SUFFIX)
1818
1919# Define our godot-cpp library
2020if (${GODOT_PLATFORM} STREQUAL "WEB" )
@@ -26,17 +26,27 @@ if(${GODOT_PLATFORM} STREQUAL "WEB")
2626 OUTPUT_NAME "${PROJECT_NAME}${LIBRARY_SUFFIX} "
2727 )
2828elseif (${GODOT_PLATFORM} STREQUAL "MACOS" )
29- # TODO: create framework with cmake FRAMEWORK property
30- # or with template file
31- message (WARNING "Mac/IOS framework configuration is not tested and may not work." )
32-
3329 add_library (${PROJECT_NAME} SHARED ${SOURCES} ${HEADERS} )
30+ set (OUTPUT_NAME "lib${PROJECT_NAME}${LIBRARY_SUFFIX} " )
3431 set_target_properties (${PROJECT_NAME} PROPERTIES
3532 FRAMEWORK TRUE
36- MACOSX_FRAMEWORK_IDENTIFIER com.godotengine.${PROJECT_NAME}
37- MACOSX_FRAMEWORK_INFO_PLIST ${GODOT_CPP_PATH} /cmake/Info.plist.in
38- OUTPUT_NAME "lib${PROJECT_NAME}${LIBRARY_SUFFIX} "
33+ MACOSX_FRAMEWORK_IDENTIFIER "org.godotengine.lib${PROJECT_NAME} "
34+ MACOSX_BUNDLE_BUNDLE_NAME "lib${PROJECT_NAME}${LIBRARY_SUFFIX} "
35+ MACOSX_BUNDLE_SHORT_VERSION_STRING "1.0.0"
36+ MACOS_BUNDLE_BUNDLE_VERSION "1.0.0"
37+
38+ OUTPUT_NAME "${OUTPUT_NAME} "
3939 )
40+
41+ # Workaround of 'bin/***.framework/Resources' existing in godot-cpp repo by default'
42+ set (RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR} /project/bin/${OUTPUT_NAME} .framework/Resources" )
43+ if (IS_DIRECTORY ${RESOURCES_DIR} AND NOT IS_SYMLINK ${RESOURCES_DIR} )
44+ message (STATUS "Removing '${RESOURCES_DIR} ' to create symlink ..." )
45+ file (REMOVE_RECURSE ${RESOURCES_DIR} )
46+ endif ()
47+
48+ # TODO: IOS configuration
49+ #elseif(${GODOT_PLATFORM} STREQUAL "IOS")
4050else ()
4151 add_library (${PROJECT_NAME} SHARED ${SOURCES} ${HEADERS} )
4252 set_target_properties (${PROJECT_NAME} PROPERTIES
@@ -46,18 +56,18 @@ endif()
4656
4757target_link_libraries (${PROJECT_NAME} PUBLIC godot-cpp)
4858
49- get_directory_property (GODOT_CC_FLAGS DIRECTORY ${GODOT_CPP_PATH} DEFINITION GODOT_CC_FLAGS )
50- get_directory_property (GODOT_CXX_FLAGS DIRECTORY ${GODOT_CPP_PATH} DEFINITION GODOT_CXX_FLAGS)
59+ get_target_property (GODOT_C_FLAGS godot-cpp GODOT_C_FLAGS )
60+ get_target_property (GODOT_CXX_FLAGS godot-cpp GODOT_CXX_FLAGS)
5161target_compile_options (${PROJECT_NAME} PRIVATE
52- ${GODOT_CC_FLAGS }
62+ ${GODOT_C_FLAGS }
5363 ${GODOT_CXX_FLAGS}
5464)
5565
56- get_directory_property (GODOT_LINK_FLAGS DIRECTORY ${GODOT_CPP_PATH} DEFINITION GODOT_LINK_FLAGS)
66+ get_target_property (GODOT_LINK_FLAGS godot-cpp GODOT_LINK_FLAGS)
5767target_link_options (${PROJECT_NAME} PRIVATE ${GODOT_LINK_FLAGS} )
5868
5969
60- get_directory_property (LIBRARY_SUFFIX DIRECTORY ${GODOT_CPP_PATH} DEFINITION LIBRARY_SUFFIX)
70+ get_target_property (LIBRARY_SUFFIX godot-cpp LIBRARY_SUFFIX)
6171set_target_properties (${PROJECT_NAME}
6272 PROPERTIES
6373 PREFIX "lib"
0 commit comments