annotate Resources/CrossToolchain.cmake @ 3838:95083d2f6819

fix build on os x
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 15 Apr 2020 17:58:30 +0200
parents a3e38994d95a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3833
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 #
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 # $ CROSSTOOL_NG_ARCH=mips CROSSTOOL_NG_BOARD=malta CROSSTOOL_NG_IMAGE=/tmp/mips cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Resources/CrossToolchain.cmake -DBUILD_CONNECTIVITY_CHECKS=OFF -DUSE_SYSTEM_CIVETWEB=OFF -DUSE_GOOGLE_TEST_DEBIAN_PACKAGE=ON -DUSE_SYSTEM_JSONCPP=OFF -DUSE_SYSTEM_UUID=OFF -DENABLE_DCMTK_JPEG_LOSSLESS=OFF -G Ninja && ninja
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 #
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 INCLUDE(CMakeForceCompiler)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 SET(CROSSTOOL_NG_ROOT $ENV{CROSSTOOL_NG_ROOT} CACHE STRING "")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 SET(CROSSTOOL_NG_ARCH $ENV{CROSSTOOL_NG_ARCH} CACHE STRING "")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 SET(CROSSTOOL_NG_BOARD $ENV{CROSSTOOL_NG_BOARD} CACHE STRING "")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 SET(CROSSTOOL_NG_SUFFIX $ENV{CROSSTOOL_NG_SUFFIX} CACHE STRING "")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 SET(CROSSTOOL_NG_IMAGE $ENV{CROSSTOOL_NG_IMAGE} CACHE STRING "")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 IF ("${CROSSTOOL_NG_ROOT}" STREQUAL "")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 SET(CROSSTOOL_NG_ROOT "/home/$ENV{USER}/x-tools")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 ENDIF()
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 IF ("${CROSSTOOL_NG_SUFFIX}" STREQUAL "")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 SET(CROSSTOOL_NG_SUFFIX "linux-gnu")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 ENDIF()
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 SET(CROSSTOOL_NG_NAME ${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_BOARD}-${CROSSTOOL_NG_SUFFIX})
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 SET(CROSSTOOL_NG_BASE ${CROSSTOOL_NG_ROOT}/${CROSSTOOL_NG_NAME})
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 # the name of the target operating system
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 SET(CMAKE_SYSTEM_NAME Linux)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 SET(CMAKE_SYSTEM_VERSION CrossToolNg)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 SET(CMAKE_SYSTEM_PROCESSOR ${CROSSTOOL_NG_ARCH})
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 # which compilers to use for C and C++
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 SET(CMAKE_C_COMPILER ${CROSSTOOL_NG_BASE}/bin/${CROSSTOOL_NG_NAME}-gcc)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 if (${CMAKE_VERSION} VERSION_LESS "3.6.0")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 CMAKE_FORCE_CXX_COMPILER(${CROSSTOOL_NG_BASE}/bin/${CROSSTOOL_NG_NAME}-g++ GNU)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 else()
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 SET(CMAKE_CXX_COMPILER ${CROSSTOOL_NG_BASE}/bin/${CROSSTOOL_NG_NAME}-g++)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 endif()
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 # here is the target environment located
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 SET(CMAKE_FIND_ROOT_PATH ${CROSSTOOL_NG_IMAGE})
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 #SET(CMAKE_FIND_ROOT_PATH ${CROSSTOOL_NG_BASE}/${CROSSTOOL_NG_NAME}/sysroot)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 # adjust the default behaviour of the FIND_XXX() commands:
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 # search headers and libraries in the target environment, search
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 # programs in the host environment
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 SET(CMAKE_CROSSCOMPILING ON)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 #SET(CROSS_COMPILER_PREFIX ${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX})
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CROSSTOOL_NG_IMAGE}/usr/include -I${CROSSTOOL_NG_IMAGE}/usr/include/${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX}" CACHE INTERNAL "" FORCE)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CROSSTOOL_NG_IMAGE}/usr/include -I${CROSSTOOL_NG_IMAGE}/usr/include/${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX}" CACHE INTERNAL "" FORCE)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--unresolved-symbols=ignore-in-shared-libs -L${CROSSTOOL_NG_BASE}/${CROSSTOOL_NG_NAME}/sysroot/usr/lib -L${CROSSTOOL_NG_IMAGE}/usr/lib -L${CROSSTOOL_NG_IMAGE}/usr/lib/${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX} -L${CROSSTOOL_NG_IMAGE}/lib -L${CROSSTOOL_NG_IMAGE}/lib/${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX}" CACHE INTERNAL "" FORCE)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--unresolved-symbols=ignore-in-shared-libs -L${CROSSTOOL_NG_BASE}/${CROSSTOOL_NG_NAME}/sysroot/usr/lib -L${CROSSTOOL_NG_IMAGE}/usr/lib -L${CROSSTOOL_NG_IMAGE}/usr/lib/${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX} -L${CROSSTOOL_NG_IMAGE}/lib -L${CROSSTOOL_NG_IMAGE}/lib/${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX}" CACHE INTERNAL "" FORCE)