Git Product home page Git Product logo

Comments (2)

sradomski avatar sradomski commented on July 22, 2024

Do you have the MACOSX_DEPLOYMENT_TARGET environment variable set? It will cause llvm to assume that we are building for MacOSX it seems.

from umundo.

hoysoft avatar hoysoft commented on July 22, 2024

thank sradomski

I revised, have been able to compile successfully

ADD:
ADD_DEFINITIONS("--sysroot=${SDKROOT}")
ADD_DEFINITIONS("-pipe")
ADD_DEFINITIONS("-no-cpp-precomp")

code:

To cross compile for iPhone:

build$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../contrib/cmake/CrossCompile-iOS.cmake

SET(CMAKE_SYSTEM_NAME Generic)
if ("$ENV{IOS_SDK_VERSION}" STREQUAL "")
SET(CMAKE_SYSTEM_VERSION 6.0)
else()
SET(CMAKE_SYSTEM_VERSION $ENV{IOS_SDK_VERSION})
endif()
SET(CMAKE_SYSTEM_PROCESSOR arm)

SET(CMAKE_CROSSCOMPILING_TARGET IOS)
SET(IOS ON)
SET(UNIX ON)
SET(APPLE ON)

execute_process(COMMAND xcode-select -print-path
OUTPUT_VARIABLE XCODE_SELECT OUTPUT_STRIP_TRAILING_WHITESPACE)

if(EXISTS ${XCODE_SELECT})
SET(DEVROOT "${XCODE_SELECT}/Platforms/iPhoneOS.platform/Developer")
if (NOT EXISTS "${DEVROOT}/SDKs/iPhoneOS${CMAKE_SYSTEM_VERSION}.sdk")
# specified SDK version does not exist, use last one
file(GLOB INSTALLED_SDKS ${DEVROOT}/SDKs/*)
list(SORT INSTALLED_SDKS)
list(REVERSE INSTALLED_SDKS)
list(GET INSTALLED_SDKS 0 LATEST_SDK)
string(REGEX MATCH "[0-9].[0-9]" CMAKE_SYSTEM_VERSION ${LATEST_SDK})
endif()
else()
SET(DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer")
endif()

if (${CMAKE_SYSTEM_VERSION} VERSION_EQUAL "6.0" OR ${CMAKE_SYSTEM_VERSION} VERSION_GREATER "6.0")
set(IOS6_OR_LATER ON)
else()
set(IOS6_OR_LATER OFF)
endif()

if (IOS6_OR_LATER)

no armv6 support in ios6 - armv7s was added, but did no compile our dependencies for it

SET(CMAKE_OSX_ARCHITECTURES "armv7")
SET(ARCHS "-arch armv7")

we have to use clang - llvm will choke on those __has_feature macros?

SET (CMAKE_C_COMPILER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang")
SET (CMAKE_CXX_COMPILER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++")
SET (MACOSX_DEPLOYMENT_TARGET 10.6)
else()
SET(CMAKE_OSX_ARCHITECTURES "armv6" "armv7")
SET(ARCHS "-arch armv6 -arch armv7")

SET (CMAKE_C_COMPILER "${DEVROOT}/usr/bin/gcc")
SET (CMAKE_CXX_COMPILER "${DEVROOT}/usr/bin/g++")

endif()

SET(SDKROOT "${DEVROOT}/SDKs/iPhoneOS${CMAKE_SYSTEM_VERSION}.sdk")
SET(CMAKE_OSX_SYSROOT "${SDKROOT}")

SET(CMAKE_C_LINK_FLAGS ${ARCHS})
SET(CMAKE_CXX_LINK_FLAGS ${ARCHS})

ADD_DEFINITIONS(${ARCHS})
ADD_DEFINITIONS("--sysroot=${SDKROOT}")
ADD_DEFINITIONS("-pipe")
ADD_DEFINITIONS("-no-cpp-precomp")

ADD_DEFINITIONS("-miphoneos-version-min=${SDKVER}")

ios headers

INCLUDE_DIRECTORIES(SYSTEM "${SDKROOT}/usr/include")

ios libraries

LINK_DIRECTORIES("${SDKROOT}/usr/lib/system")
LINK_DIRECTORIES("${SDKROOT}/usr/lib")

SET(CMAKE_FIND_ROOT_PATH "${SDKROOT}")
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

from umundo.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.