Mercurial > hg > orthanc
annotate OrthancFramework/Resources/Toolchains/CrossToolchain.cmake @ 4303:44b53a2c0a13
improving detection of ABI compatibility
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 06 Nov 2020 15:37:30 +0100 |
parents | 304842a0d152 |
children | d9473bd5ed43 |
rev | line source |
---|---|
4120
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
1 # Orthanc - A Lightweight, RESTful DICOM Store |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
3 # Department, University Hospital of Liege, Belgium |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
4 # Copyright (C) 2017-2020 Osimis S.A., Belgium |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
5 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
6 # This program is free software: you can redistribute it and/or |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
7 # modify it under the terms of the GNU Lesser General Public License |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
8 # as published by the Free Software Foundation, either version 3 of |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
9 # the License, or (at your option) any later version. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
10 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, but |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
12 # WITHOUT ANY WARRANTY; without even the implied warranty of |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
14 # Lesser General Public License for more details. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
15 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
16 # You should have received a copy of the GNU Lesser General Public |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
17 # License along with this program. If not, see |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
18 # <http://www.gnu.org/licenses/>. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
19 |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4048
diff
changeset
|
20 |
3833
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 # |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 # $ 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
|
23 # |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 INCLUDE(CMakeForceCompiler) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 SET(CROSSTOOL_NG_ROOT $ENV{CROSSTOOL_NG_ROOT} CACHE STRING "") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 SET(CROSSTOOL_NG_ARCH $ENV{CROSSTOOL_NG_ARCH} CACHE STRING "") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 SET(CROSSTOOL_NG_BOARD $ENV{CROSSTOOL_NG_BOARD} CACHE STRING "") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 SET(CROSSTOOL_NG_SUFFIX $ENV{CROSSTOOL_NG_SUFFIX} CACHE STRING "") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 SET(CROSSTOOL_NG_IMAGE $ENV{CROSSTOOL_NG_IMAGE} CACHE STRING "") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 IF ("${CROSSTOOL_NG_ROOT}" STREQUAL "") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 SET(CROSSTOOL_NG_ROOT "/home/$ENV{USER}/x-tools") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 ENDIF() |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 IF ("${CROSSTOOL_NG_SUFFIX}" STREQUAL "") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 SET(CROSSTOOL_NG_SUFFIX "linux-gnu") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 ENDIF() |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 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
|
42 SET(CROSSTOOL_NG_BASE ${CROSSTOOL_NG_ROOT}/${CROSSTOOL_NG_NAME}) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 # the name of the target operating system |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 SET(CMAKE_SYSTEM_NAME Linux) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 SET(CMAKE_SYSTEM_VERSION CrossToolNg) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 SET(CMAKE_SYSTEM_PROCESSOR ${CROSSTOOL_NG_ARCH}) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 # which compilers to use for C and C++ |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 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
|
51 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 if (${CMAKE_VERSION} VERSION_LESS "3.6.0") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 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
|
54 else() |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 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
|
56 endif() |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 # here is the target environment located |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 SET(CMAKE_FIND_ROOT_PATH ${CROSSTOOL_NG_IMAGE}) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 #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
|
61 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 # adjust the default behaviour of the FIND_XXX() commands: |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 # search headers and libraries in the target environment, search |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 # programs in the host environment |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 SET(CMAKE_CROSSCOMPILING ON) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 #SET(CROSS_COMPILER_PREFIX ${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX}) |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 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
|
74 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
|
75 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
|
76 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) |