Mercurial > hg > orthanc
annotate OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake @ 4197:b1d528687e25
merge
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 16 Sep 2020 13:30:01 +0200 |
parents | ecc11c232326 |
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 |
3806 | 21 # |
22 # Full build, as used on the BuildBot CIS: | |
23 # | |
4147
ecc11c232326
updated notes in LinuxStandardBaseToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4120
diff
changeset
|
24 # $ 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 -DBOOST_LOCALE_BACKEND=icu -DENABLE_PKCS11=ON -G Ninja |
3806 | 25 # |
26 # Or, more lightweight version (without libp11 and ICU): | |
27 # | |
4147
ecc11c232326
updated notes in LinuxStandardBaseToolchain.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4120
diff
changeset
|
28 # $ 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 -G Ninja |
3806 | 29 # |
2448
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
30 |
193
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 INCLUDE(CMakeForceCompiler) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
3833
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3806
diff
changeset
|
33 SET(LSB_PATH $ENV{LSB_PATH} CACHE STRING "") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3806
diff
changeset
|
34 SET(LSB_CC $ENV{LSB_CC} CACHE STRING "") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3806
diff
changeset
|
35 SET(LSB_CXX $ENV{LSB_CXX} CACHE STRING "") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3806
diff
changeset
|
36 SET(LSB_TARGET_VERSION "4.0" CACHE STRING "") |
193
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 IF ("${LSB_PATH}" STREQUAL "") |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 SET(LSB_PATH "/opt/lsb") |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 ENDIF() |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 IF (EXISTS ${LSB_PATH}/lib64) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 SET(LSB_TARGET_PROCESSOR "x86_64") |
561 | 44 SET(LSB_LIBPATH ${LSB_PATH}/lib64-${LSB_TARGET_VERSION}) |
193
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 ELSEIF (EXISTS ${LSB_PATH}/lib) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 SET(LSB_TARGET_PROCESSOR "x86") |
561 | 47 SET(LSB_LIBPATH ${LSB_PATH}/lib-${LSB_TARGET_VERSION}) |
193
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 ELSE() |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 MESSAGE(FATAL_ERROR "Unable to detect the target processor architecture. Check the LSB_PATH environment variable.") |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 ENDIF() |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 SET(LSB_CPPPATH ${LSB_PATH}/include) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 SET(PKG_CONFIG_PATH ${LSB_LIBPATH}/pkgconfig/) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 # the name of the target operating system |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 SET(CMAKE_SYSTEM_NAME Linux) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 SET(CMAKE_SYSTEM_VERSION LinuxStandardBase) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 SET(CMAKE_SYSTEM_PROCESSOR ${LSB_TARGET_PROCESSOR}) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 # which compilers to use for C and C++ |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 SET(CMAKE_C_COMPILER ${LSB_PATH}/bin/lsbcc) |
3619
92759b714ae4
fix compatibility between LSB and cmake >= 3.6
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3242
diff
changeset
|
62 |
92759b714ae4
fix compatibility between LSB and cmake >= 3.6
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3242
diff
changeset
|
63 if (${CMAKE_VERSION} VERSION_LESS "3.6.0") |
92759b714ae4
fix compatibility between LSB and cmake >= 3.6
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3242
diff
changeset
|
64 CMAKE_FORCE_CXX_COMPILER(${LSB_PATH}/bin/lsbc++ GNU) |
92759b714ae4
fix compatibility between LSB and cmake >= 3.6
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3242
diff
changeset
|
65 else() |
92759b714ae4
fix compatibility between LSB and cmake >= 3.6
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3242
diff
changeset
|
66 SET(CMAKE_CXX_COMPILER ${LSB_PATH}/bin/lsbc++) |
92759b714ae4
fix compatibility between LSB and cmake >= 3.6
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3242
diff
changeset
|
67 endif() |
193
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 # here is the target environment located |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 SET(CMAKE_FIND_ROOT_PATH ${LSB_PATH}) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 # adjust the default behaviour of the FIND_XXX() commands: |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 # search headers and libraries in the target environment, search |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 # programs in the host environment |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) |
2448
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
76 SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
77 SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
78 |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
79 SET(CMAKE_CROSSCOMPILING OFF) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
80 |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
81 |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
82 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -I${LSB_PATH}/include" CACHE INTERNAL "" FORCE) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
83 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) |
2451 | 84 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH} --lsb-besteffort" CACHE INTERNAL "" FORCE) |
85 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH} --lsb-besteffort" CACHE INTERNAL "" FORCE) | |
2448
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
86 |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
87 if (NOT "${LSB_CXX}" STREQUAL "") |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
88 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-cxx=${LSB_CXX}") |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
89 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-cxx=${LSB_CXX}") |
2451 | 90 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-cxx=${LSB_CXX}") |
2448
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
91 endif() |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
92 |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
93 if (NOT "${LSB_CC}" STREQUAL "") |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
94 SET(CMAKE_C_FLAGS "${CMAKE_CC_FLAGS} --lsb-cc=${LSB_CC}") |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
95 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-cc=${LSB_CC}") |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
96 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-cc=${LSB_CC}") |
2451 | 97 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-cc=${LSB_CC}") |
2448
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
98 endif() |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
99 |