Commit aff53730 authored by Ghislain MARY's avatar Ghislain MARY

Fix iOS build on some machines where a MacOSX sysroot was added to the compile command by CMake.

parent 499c7a73
......@@ -33,23 +33,32 @@ set(AUTOTOOLS_RANLIB "@CMAKE_RANLIB@" CACHE PATH "Initial cache" FORCE)
set(AUTOTOOLS_STRIP "@CMAKE_STRIP@" CACHE PATH "Initial cache" FORCE)
set(AUTOTOOLS_NM "@CMAKE_NM@" CACHE PATH "Initial cache" FORCE)
set(AUTOTOOLS_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_C_FLAGS_MINSIZEREL "@CMAKE_C_FLAGS_MINSIZEREL@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_C_FLAGS_RELEASE "@CMAKE_C_FLAGS_RELEASE@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_C_FLAGS_RELWITHDEBINFO "@CMAKE_C_FLAGS_RELWITHDEBINFO@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_C_FLAGS "@CMAKE_C_FLAGS@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_CXX_FLAGS_MINSIZEREL "@CMAKE_CXX_FLAGS_MINSIZEREL@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_CXX_FLAGS_RELWITHDEBINFO "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_CXX_FLAGS "@CMAKE_CXX_FLAGS@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_OBJC_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_OBJC_FLAGS_MINSIZEREL "@CMAKE_C_FLAGS_MINSIZEREL@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_OBJC_FLAGS_RELEASE "@CMAKE_C_FLAGS_RELEASE@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_OBJC_FLAGS_RELWITHDEBINFO "@CMAKE_C_FLAGS_RELWITHDEBINFO@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_OBJC_FLAGS "@CMAKE_C_FLAGS@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_LINKER_FLAGS_DEBUG "@CMAKE_EXE_LINKER_FLAGS_DEBUG@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_LINKER_FLAGS_MINSIZEREL "@CMAKE_EXE_LINKER_FLAGS_MINSIZEREL@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_LINKER_FLAGS_RELEASE "@CMAKE_EXE_LINKER_FLAGS_RELEASE@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_LINKER_FLAGS_RELWITHDEBINFO "@CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO@" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_LINKER_FLAGS "@CMAKE_EXE_LINKER_FLAGS@" CACHE STRING "Initial cache" FORCE)
set(OSX_FLAGS "")
if(NOT "@LINPHONE_BUILDER_OSX_ARCHITECTURES@" STREQUAL "")
set(OSX_FLAGS "${OSX_FLAGS} -arch @LINPHONE_BUILDER_OSX_ARCHITECTURES@")
endif()
if(NOT "@CMAKE_OSX_SYSROOT@" STREQUAL "")
set(OSX_FLAGS "${OSX_FLAGS} -isysroot @CMAKE_OSX_SYSROOT@")
endif()
set(AUTOTOOLS_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_C_FLAGS_MINSIZEREL "@CMAKE_C_FLAGS_MINSIZEREL@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_C_FLAGS_RELEASE "@CMAKE_C_FLAGS_RELEASE@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_C_FLAGS_RELWITHDEBINFO "@CMAKE_C_FLAGS_RELWITHDEBINFO@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_C_FLAGS "@CMAKE_C_FLAGS@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_CXX_FLAGS_MINSIZEREL "@CMAKE_CXX_FLAGS_MINSIZEREL@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_CXX_FLAGS_RELWITHDEBINFO "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_CXX_FLAGS "@CMAKE_CXX_FLAGS@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_OBJC_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_OBJC_FLAGS_MINSIZEREL "@CMAKE_C_FLAGS_MINSIZEREL@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_OBJC_FLAGS_RELEASE "@CMAKE_C_FLAGS_RELEASE@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_OBJC_FLAGS_RELWITHDEBINFO "@CMAKE_C_FLAGS_RELWITHDEBINFO@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_OBJC_FLAGS "@CMAKE_C_FLAGS@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_LINKER_FLAGS_DEBUG "@CMAKE_EXE_LINKER_FLAGS_DEBUG@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_LINKER_FLAGS_MINSIZEREL "@CMAKE_EXE_LINKER_FLAGS_MINSIZEREL@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_LINKER_FLAGS_RELEASE "@CMAKE_EXE_LINKER_FLAGS_RELEASE@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_LINKER_FLAGS_RELWITHDEBINFO "@CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
set(AUTOTOOLS_LINKER_FLAGS "@CMAKE_EXE_LINKER_FLAGS@ ${OSX_FLAGS}" CACHE STRING "Initial cache" FORCE)
......@@ -311,6 +311,9 @@ function(linphone_builder_get_autotools_configuration)
if(CMAKE_TOOLCHAIN_FILE)
list(APPEND _autotools_command "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
endif()
if(LINPHONE_BUILDER_OSX_ARCHITECTURES)
list(APPEND _autotools_command "-DLINPHONE_BUILDER_OSX_ARCHITECTURES=${LINPHONE_BUILDER_OSX_ARCHITECTURES}")
endif()
list(APPEND _autotools_command "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Autotools/")
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/Autotools)
execute_process(COMMAND ${_autotools_command} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/Autotools)
......
......@@ -57,18 +57,15 @@ string(REGEX REPLACE "-clang$" "" LINPHONE_BUILDER_HOST ${COMPILER_NAME})
unset(COMPILER_NAME)
if("${PLATFORM}" MATCHES "Simulator")
set(CLANG_TARGET_SPECIFIER "ios-simulator-version-min")
else("${PLATFORM}" MATCHES "Simulator")
else()
set(CLANG_TARGET_SPECIFIER "iphoneos-version-min")
endif("${PLATFORM}" MATCHES "Simulator")
list(GET CMAKE_FIND_ROOT_PATH 0 SYSROOT_PATH)
set(COMMON_FLAGS "-arch ${SYSTEM_ARCH} -isysroot ${SYSROOT_PATH} -m${CLANG_TARGET_SPECIFIER}=${SDK_VERSION} -DTARGET_OS_IPHONE=1 -D__IOS -fms-extensions")
endif()
set(COMMON_FLAGS "-arch ${LINPHONE_BUILDER_OSX_ARCHITECTURES} -m${CLANG_TARGET_SPECIFIER}=${SDK_VERSION} -DTARGET_OS_IPHONE=1 -D__IOS -fms-extensions")
set(LINPHONE_BUILDER_CPPFLAGS "${COMMON_FLAGS} -Dasm=__asm")
#set(LINPHONE_BUILDER_CFLAGS "-std=c99")
set(LINPHONE_BUILDER_LDFLAGS "${COMMON_FLAGS}")
set(LINPHONE_BUILDER_PKG_CONFIG_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig) # Restrict pkg-config to search in the install directory
unset(COMMON_FLAGS)
unset(CLANG_TARGET_SPECIFIER)
unset(SYSROOT_PATH)
unset(SDK_VERSION)
......
......@@ -40,8 +40,8 @@ else()
endif()
list(SORT SDK_PATH_LIST)
list(REVERSE SDK_PATH_LIST)
list(GET SDK_PATH_LIST 0 SYSROOT_PATH)
message(STATUS "Using sysroot path: ${SYSROOT_PATH}")
list(GET SDK_PATH_LIST 0 CMAKE_OSX_SYSROOT)
message(STATUS "Using sysroot path: ${CMAKE_OSX_SYSROOT}")
set(IOS_TOOLCHAIN_HOST ${COMPILER_PREFIX})
......@@ -71,7 +71,7 @@ set(IOS True)
CMAKE_FORCE_C_COMPILER(${IOS_TOOLCHAIN_CC} Clang)
CMAKE_FORCE_CXX_COMPILER(${IOS_TOOLCHAIN_CXX} Clang)
set(CMAKE_FIND_ROOT_PATH ${SYSROOT_PATH} ${CMAKE_INSTALL_PREFIX})
set(CMAKE_FIND_ROOT_PATH ${CMAKE_OSX_SYSROOT} ${CMAKE_INSTALL_PREFIX})
# search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
......
......@@ -20,8 +20,8 @@
#
############################################################################
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(SYSTEM_ARCH arm64)
set(CMAKE_SYSTEM_PROCESSOR "aarch64")
set(LINPHONE_BUILDER_OSX_ARCHITECTURES "arm64")
set(COMPILER_PREFIX "arm64-apple-darwin")
set(PLATFORM "OS")
include("${CMAKE_CURRENT_LIST_DIR}/ios/toolchain-ios.cmake")
......
......@@ -20,8 +20,8 @@
#
############################################################################
set(CMAKE_SYSTEM_PROCESSOR armv7)
set(SYSTEM_ARCH armv7)
set(CMAKE_SYSTEM_PROCESSOR "armv7")
set(LINPHONE_BUILDER_OSX_ARCHITECTURES "armv7")
set(COMPILER_PREFIX "armv7-apple-darwin")
set(PLATFORM "OS")
include("${CMAKE_CURRENT_LIST_DIR}/ios/toolchain-ios.cmake")
......@@ -20,8 +20,8 @@
#
############################################################################
set(CMAKE_SYSTEM_PROCESSOR i386)
set(SYSTEM_ARCH i386)
set(CMAKE_SYSTEM_PROCESSOR "i386")
set(LINPHONE_BUILDER_OSX_ARCHITECTURES "i386")
set(COMPILER_PREFIX "i386-apple-darwin")
set(PLATFORM "Simulator")
include("${CMAKE_CURRENT_LIST_DIR}/ios/toolchain-ios.cmake")
......
......@@ -20,8 +20,8 @@
#
############################################################################
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(SYSTEM_ARCH x86_64)
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(LINPHONE_BUILDER_OSX_ARCHITECTURES "x86_64")
set(COMPILER_PREFIX "x86_64-apple-darwin")
set(PLATFORM "Simulator")
include("${CMAKE_CURRENT_LIST_DIR}/ios/toolchain-ios.cmake")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment