annotate OrthancFramework/Resources/Toolchains/CrossToolchain.cmake @ 5649:4a2bfda999c6

todo
author Alain Mazy <am@orthanc.team>
date Mon, 03 Jun 2024 14:30:30 +0200
parents f7adfb22e20e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
5 # Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
6 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
4120
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4048
diff changeset
7 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4048
diff changeset
8 # 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
9 # 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
10 # 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
11 # the License, or (at your option) any later version.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4048
diff changeset
12 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4048
diff changeset
13 # 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
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4048
diff changeset
15 # 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
16 # Lesser General Public License for more details.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4048
diff changeset
17 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4048
diff changeset
18 # 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
19 # License along with this program. If not, see
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4048
diff changeset
20 # <http://www.gnu.org/licenses/>.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4048
diff changeset
21
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4048
diff changeset
22
3833
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 # $ 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
25 #
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 INCLUDE(CMakeForceCompiler)
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 SET(CROSSTOOL_NG_ROOT $ENV{CROSSTOOL_NG_ROOT} CACHE STRING "")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 SET(CROSSTOOL_NG_ARCH $ENV{CROSSTOOL_NG_ARCH} CACHE STRING "")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 SET(CROSSTOOL_NG_BOARD $ENV{CROSSTOOL_NG_BOARD} CACHE STRING "")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 SET(CROSSTOOL_NG_SUFFIX $ENV{CROSSTOOL_NG_SUFFIX} CACHE STRING "")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 SET(CROSSTOOL_NG_IMAGE $ENV{CROSSTOOL_NG_IMAGE} CACHE STRING "")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 IF ("${CROSSTOOL_NG_ROOT}" STREQUAL "")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 SET(CROSSTOOL_NG_ROOT "/home/$ENV{USER}/x-tools")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 ENDIF()
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 IF ("${CROSSTOOL_NG_SUFFIX}" STREQUAL "")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 SET(CROSSTOOL_NG_SUFFIX "linux-gnu")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 ENDIF()
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 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
44 SET(CROSSTOOL_NG_BASE ${CROSSTOOL_NG_ROOT}/${CROSSTOOL_NG_NAME})
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 # the name of the target operating system
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 SET(CMAKE_SYSTEM_NAME Linux)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 SET(CMAKE_SYSTEM_VERSION CrossToolNg)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 SET(CMAKE_SYSTEM_PROCESSOR ${CROSSTOOL_NG_ARCH})
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 # which compilers to use for C and C++
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 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
53
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 if (${CMAKE_VERSION} VERSION_LESS "3.6.0")
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 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
56 else()
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 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
58 endif()
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 # here is the target environment located
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 SET(CMAKE_FIND_ROOT_PATH ${CROSSTOOL_NG_IMAGE})
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 #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
63
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 # adjust the default behaviour of the FIND_XXX() commands:
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 # search headers and libraries in the target environment, search
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 # programs in the host environment
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 SET(CMAKE_CROSSCOMPILING ON)
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 #SET(CROSS_COMPILER_PREFIX ${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX})
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 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
76 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
77 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
78 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)