iOS CMake project generation improvements (bitcode option)

when building for iOS, Xcode allows developers to specify to enable or disable the 'bitcode' compilation option. There's not a preferred way to go and the choice is really up to the developer but considering that:

1. Currently the generated project defaults the option to YES
2. There are almost 90 projects targets that should be modified if one wants to disable the bitcode option (which considerably reduces the footprint of the app)
3. Even though one can select all the 90+ targets and set the option to NO for all of them, the updates could take a few seconds and could be error prone because one could miss to select some targets

I propose to add a CMake setting that is displayed only when building for iOS. By setting this option "before" the project generation would speed up things for developers and would avoid errors at compiling time.
remotes/origin/Deprecated_master_20th_November_2022
Alessandro Terenzi 7 years ago committed by Robert Osfield
parent e17f1c4e31
commit 9010fd8035

@ -263,6 +263,8 @@ IF(APPLE)
SET (IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneSimulator${IPHONE_SDKVER}.sdk")
ENDIF()
SET (IPHONE_ENABLE_BITCODE "NO" CACHE STRING "IOS Enable Bitcode")
# Apple iOS: Find OpenGLES
FIND_LIBRARY(OPENGLES_LIBRARY OpenGLES)
ELSE ()

@ -225,6 +225,9 @@ MACRO(SETUP_LIBRARY LIB_NAME)
)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES FOLDER "OSG Core")
IF(APPLE)
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE ${IPHONE_ENABLE_BITCODE})
ENDIF()
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
ENDIF()
IF(TARGET_LABEL)
@ -333,6 +336,9 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Plugins")
IF(APPLE)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE ${IPHONE_ENABLE_BITCODE})
ENDIF()
ENDIF()
SETUP_LINK_LIBRARIES()
@ -423,6 +429,9 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
IF(APPLE)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE ${IPHONE_ENABLE_BITCODE})
ENDIF()
ENDIF()
SETUP_LINK_LIBRARIES()

@ -123,6 +123,11 @@ ELSE()
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${OPENTHREADS_VERSION} SOVERSION ${OPENTHREADS_SOVERSION})
ENDIF()
IF(APPLE)
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE ${IPHONE_ENABLE_BITCODE})
ENDIF()
ENDIF()
SET(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES_SAFE}")

Loading…
Cancel
Save