annotate Resources/Orthanc/Toolchains/LinuxStandardBaseToolchain.cmake @ 0:3f1cf4a8e31f

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 22 Mar 2023 10:16:47 +0100
parents
children 776e650a6386
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 # Orthanc - A Lightweight, RESTful DICOM Store
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 # Department, University Hospital of Liege, Belgium
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 # Copyright (C) 2017-2022 Osimis S.A., Belgium
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 # Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 #
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 # modify it under the terms of the GNU Lesser General Public License
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 # as published by the Free Software Foundation, either version 3 of
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 # the License, or (at your option) any later version.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 #
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful, but
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 # Lesser General Public License for more details.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 #
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 # You should have received a copy of the GNU Lesser General Public
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 # License along with this program. If not, see
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 # <http://www.gnu.org/licenses/>.
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 # Full build, as used on the BuildBot CIS:
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 # $ LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake ../OrthancServer/ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON -DUSE_LEGACY_LIBICU=ON -DUSE_LEGACY_BOOST=ON -DBOOST_LOCALE_BACKEND=icu -DENABLE_PKCS11=ON -G Ninja
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 # Or, more lightweight version (without libp11 and ICU):
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 # $ LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake ../OrthancServer/ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON -DUSE_LEGACY_BOOST=ON -G Ninja
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 #
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 INCLUDE(CMakeForceCompiler)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 SET(LSB_PATH $ENV{LSB_PATH} CACHE STRING "")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 SET(LSB_CC $ENV{LSB_CC} CACHE STRING "")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 SET(LSB_CXX $ENV{LSB_CXX} CACHE STRING "")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 SET(LSB_TARGET_VERSION "4.0" CACHE STRING "")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 IF ("${LSB_PATH}" STREQUAL "")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 SET(LSB_PATH "/opt/lsb")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 ENDIF()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 IF (EXISTS ${LSB_PATH}/lib64)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 SET(LSB_TARGET_PROCESSOR "x86_64")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 SET(LSB_LIBPATH ${LSB_PATH}/lib64-${LSB_TARGET_VERSION})
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 ELSEIF (EXISTS ${LSB_PATH}/lib)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 SET(LSB_TARGET_PROCESSOR "x86")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 SET(LSB_LIBPATH ${LSB_PATH}/lib-${LSB_TARGET_VERSION})
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 ELSE()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 MESSAGE(FATAL_ERROR "Unable to detect the target processor architecture. Check the LSB_PATH environment variable.")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 ENDIF()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 SET(LSB_CPPPATH ${LSB_PATH}/include)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 SET(PKG_CONFIG_PATH ${LSB_LIBPATH}/pkgconfig/)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 # the name of the target operating system
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 SET(CMAKE_SYSTEM_NAME Linux)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 SET(CMAKE_SYSTEM_VERSION LinuxStandardBase)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 SET(CMAKE_SYSTEM_PROCESSOR ${LSB_TARGET_PROCESSOR})
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 # which compilers to use for C and C++
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 SET(CMAKE_C_COMPILER ${LSB_PATH}/bin/lsbcc)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 if (${CMAKE_VERSION} VERSION_LESS "3.6.0")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 CMAKE_FORCE_CXX_COMPILER(${LSB_PATH}/bin/lsbc++ GNU)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 else()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 SET(CMAKE_CXX_COMPILER ${LSB_PATH}/bin/lsbc++)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 endif()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 # here is the target environment located
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 SET(CMAKE_FIND_ROOT_PATH ${LSB_PATH})
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 # adjust the default behaviour of the FIND_XXX() commands:
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 # search headers and libraries in the target environment, search
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 # programs in the host environment
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 SET(CMAKE_CROSSCOMPILING OFF)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -I${LSB_PATH}/include" CACHE INTERNAL "" FORCE)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -nostdinc++ -I${LSB_PATH}/include -I${LSB_PATH}/include/c++ -I${LSB_PATH}/include/c++/backward" CACHE INTERNAL "" FORCE)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH} --lsb-besteffort" CACHE INTERNAL "" FORCE)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH} --lsb-besteffort" CACHE INTERNAL "" FORCE)
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 if (NOT "${LSB_CXX}" STREQUAL "")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-cxx=${LSB_CXX}")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-cxx=${LSB_CXX}")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-cxx=${LSB_CXX}")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 endif()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 if (NOT "${LSB_CC}" STREQUAL "")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 SET(CMAKE_C_FLAGS "${CMAKE_CC_FLAGS} --lsb-cc=${LSB_CC}")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-cc=${LSB_CC}")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-cc=${LSB_CC}")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-cc=${LSB_CC}")
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 endif()
3f1cf4a8e31f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100