Xcode Embed Frameworks support

refer to: https://gitlab.kitware.com/cmake/cmake/-/issues/22412#note_997156
This commit is contained in:
halx99 2021-08-10 11:43:16 +08:00
parent 97e5896325
commit 6ee687302b
10 changed files with 47 additions and 0 deletions

View File

@ -31,6 +31,10 @@ cmake_minimum_required(VERSION 3.10)
project(adxe)
if(XCODE)
set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE)
endif()
# adxe root path
set(ADXE_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_MODULE_PATH ${ADXE_ROOT_PATH}/cmake/Modules/)

View File

@ -322,6 +322,18 @@ function(setup_cocos_app_config app_name)
target_compile_definitions(${app_name} PRIVATE SPINEPLUGIN_API=DLLIMPORT) # spine dll
endif()
target_link_libraries(${app_name} ${CC_EXTENSION_LIBS})
if(XCODE AND BUILD_DEP_ALSOFT AND ALSOFT_OSX_FRAMEWORK)
# Embedded soft_oal embedded framework
# XCODE_LINK_BUILD_PHASE_MODE BUILT_ONLY
message(STATUS "Embedding framework soft_oal...")
set_target_properties(${app_name} PROPERTIES
XCODE_LINK_BUILD_PHASE_MODE KNOWN_LOCATION
XCODE_EMBED_FRAMEWORKS OpenAL
XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY ON
XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY ON
)
endif()
endfunction()
# if cc_variable not set, then set it cc_value

View File

@ -14,6 +14,9 @@ set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED NO)
# set(CMAKE_BUILD_WITH_INSTALL_RPATH YES)
# set(CMAKE_INSTALL_RPATH "@executable_path/Frameworks")
set(CMAKE_XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/Frameworks" ${CMAKE_XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS})
# Default deployment target is 9.0
# a. armv7 maximum deployment 10.x

View File

@ -30,6 +30,10 @@ set(APP_NAME HelloCpp)
project(${APP_NAME})
if(NOT DEFINED BUILD_ENGINE_DONE) # to test HelloCpp into root project
if(XCODE)
set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE)
endif()
set(ADXE_ROOT "$ENV{ADXE_ROOT}")
if(NOT (ADXE_ROOT STREQUAL ""))

View File

@ -29,6 +29,10 @@ project(${APP_NAME})
set(ADXE_ROOT "$ENV{ADXE_ROOT}")
if(XCODE)
set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE)
endif()
if(NOT (ADXE_ROOT STREQUAL ""))
set(ADXE_ROOT_PATH "${ADXE_ROOT}")
file(TO_CMAKE_PATH ${ADXE_ROOT_PATH} ADXE_ROOT_PATH) # string(REPLACE "\\" "/" ADXE_ROOT_PATH ${ADXE_ROOT_PATH})

View File

@ -28,6 +28,10 @@ set(APP_NAME cpp-empty-test)
project(${APP_NAME})
if(NOT DEFINED BUILD_ENGINE_DONE)
if(XCODE)
set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE)
endif()
set(ADXE_ROOT "$ENV{ADXE_ROOT}")
if(NOT (ADXE_ROOT STREQUAL ""))
set(ADXE_ROOT_PATH "${ADXE_ROOT}")

View File

@ -5,6 +5,10 @@ set(APP_NAME cpp-tests)
project(${APP_NAME})
if(NOT DEFINED BUILD_ENGINE_DONE)
if(XCODE)
set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE)
endif()
set(ADXE_ROOT "$ENV{ADXE_ROOT}")
if(NOT (ADXE_ROOT STREQUAL ""))
set(ADXE_ROOT_PATH "${ADXE_ROOT}")

View File

@ -28,6 +28,10 @@ set(APP_NAME fairygui-tests)
project(${APP_NAME})
if(NOT DEFINED BUILD_ENGINE_DONE)
if(XCODE)
set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE)
endif()
set(ADXE_ROOT "$ENV{ADXE_ROOT}")
if(NOT (ADXE_ROOT STREQUAL ""))
set(ADXE_ROOT_PATH "${ADXE_ROOT}")

View File

@ -5,6 +5,10 @@ set(APP_NAME lua-empty-test)
project(${APP_NAME})
if(NOT DEFINED BUILD_ENGINE_DONE)
if(XCODE)
set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE)
endif()
set(ADXE_ROOT "$ENV{ADXE_ROOT}")
if(NOT (ADXE_ROOT STREQUAL ""))
set(ADXE_ROOT_PATH "${ADXE_ROOT}")

View File

@ -5,6 +5,10 @@ set(APP_NAME lua-tests)
project(${APP_NAME})
if(NOT DEFINED BUILD_ENGINE_DONE)
if(XCODE)
set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE)
endif()
set(ADXE_ROOT "$ENV{ADXE_ROOT}")
if(NOT (ADXE_ROOT STREQUAL ""))
set(ADXE_ROOT_PATH "${ADXE_ROOT}")