comparison OrthancFramework/Resources/Toolchains/CrossToolchain.cmake @ 4048:64919a9958bb framework

rename
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Jun 2020 09:18:30 +0200
parents OrthancFramework/Resources/CMakeToolchains/CrossToolchain.cmake@d25f4c0fa160
children 304842a0d152
comparison
equal deleted inserted replaced
4047:0327421506ad 4048:64919a9958bb
1 #
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
3 #
4
5 INCLUDE(CMakeForceCompiler)
6
7 SET(CROSSTOOL_NG_ROOT $ENV{CROSSTOOL_NG_ROOT} CACHE STRING "")
8 SET(CROSSTOOL_NG_ARCH $ENV{CROSSTOOL_NG_ARCH} CACHE STRING "")
9 SET(CROSSTOOL_NG_BOARD $ENV{CROSSTOOL_NG_BOARD} CACHE STRING "")
10 SET(CROSSTOOL_NG_SUFFIX $ENV{CROSSTOOL_NG_SUFFIX} CACHE STRING "")
11 SET(CROSSTOOL_NG_IMAGE $ENV{CROSSTOOL_NG_IMAGE} CACHE STRING "")
12
13 IF ("${CROSSTOOL_NG_ROOT}" STREQUAL "")
14 SET(CROSSTOOL_NG_ROOT "/home/$ENV{USER}/x-tools")
15 ENDIF()
16
17 IF ("${CROSSTOOL_NG_SUFFIX}" STREQUAL "")
18 SET(CROSSTOOL_NG_SUFFIX "linux-gnu")
19 ENDIF()
20
21 SET(CROSSTOOL_NG_NAME ${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_BOARD}-${CROSSTOOL_NG_SUFFIX})
22 SET(CROSSTOOL_NG_BASE ${CROSSTOOL_NG_ROOT}/${CROSSTOOL_NG_NAME})
23
24 # the name of the target operating system
25 SET(CMAKE_SYSTEM_NAME Linux)
26 SET(CMAKE_SYSTEM_VERSION CrossToolNg)
27 SET(CMAKE_SYSTEM_PROCESSOR ${CROSSTOOL_NG_ARCH})
28
29 # which compilers to use for C and C++
30 SET(CMAKE_C_COMPILER ${CROSSTOOL_NG_BASE}/bin/${CROSSTOOL_NG_NAME}-gcc)
31
32 if (${CMAKE_VERSION} VERSION_LESS "3.6.0")
33 CMAKE_FORCE_CXX_COMPILER(${CROSSTOOL_NG_BASE}/bin/${CROSSTOOL_NG_NAME}-g++ GNU)
34 else()
35 SET(CMAKE_CXX_COMPILER ${CROSSTOOL_NG_BASE}/bin/${CROSSTOOL_NG_NAME}-g++)
36 endif()
37
38 # here is the target environment located
39 SET(CMAKE_FIND_ROOT_PATH ${CROSSTOOL_NG_IMAGE})
40 #SET(CMAKE_FIND_ROOT_PATH ${CROSSTOOL_NG_BASE}/${CROSSTOOL_NG_NAME}/sysroot)
41
42 # adjust the default behaviour of the FIND_XXX() commands:
43 # search headers and libraries in the target environment, search
44 # programs in the host environment
45 SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
46 SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
47 SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
48 SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
49
50 SET(CMAKE_CROSSCOMPILING ON)
51 #SET(CROSS_COMPILER_PREFIX ${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX})
52
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)
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)
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)
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)