Mercurial > hg > orthanc
annotate Resources/LinuxStandardBaseToolchain.cmake @ 4541:73ea4f52965c Orthanc-1.7.1
close branch
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 02 Mar 2021 16:52:17 +0100 |
parents | a3e38994d95a |
children |
rev | line source |
---|---|
3806 | 1 # |
2 # Full build, as used on the BuildBot CIS: | |
3 # | |
4 # $ LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Resources/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON -DUSE_LEGACY_LIBICU=ON -DBOOST_LOCALE_BACKEND=icu -DENABLE_PKCS11=ON -G Ninja | |
5 # | |
6 # Or, more lightweight version (without libp11 and ICU): | |
7 # | |
8 # $ LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Resources/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON -G Ninja | |
9 # | |
2448
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
10 |
193
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 INCLUDE(CMakeForceCompiler) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 |
3833
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3806
diff
changeset
|
13 SET(LSB_PATH $ENV{LSB_PATH} CACHE STRING "") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3806
diff
changeset
|
14 SET(LSB_CC $ENV{LSB_CC} CACHE STRING "") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3806
diff
changeset
|
15 SET(LSB_CXX $ENV{LSB_CXX} CACHE STRING "") |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3806
diff
changeset
|
16 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
|
17 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 IF ("${LSB_PATH}" STREQUAL "") |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 SET(LSB_PATH "/opt/lsb") |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 ENDIF() |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 IF (EXISTS ${LSB_PATH}/lib64) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 SET(LSB_TARGET_PROCESSOR "x86_64") |
561 | 24 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
|
25 ELSEIF (EXISTS ${LSB_PATH}/lib) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 SET(LSB_TARGET_PROCESSOR "x86") |
561 | 27 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
|
28 ELSE() |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 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
|
30 ENDIF() |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 SET(LSB_CPPPATH ${LSB_PATH}/include) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 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
|
34 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 # 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
|
36 SET(CMAKE_SYSTEM_NAME Linux) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 SET(CMAKE_SYSTEM_VERSION LinuxStandardBase) |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 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
|
39 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 # 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
|
41 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
|
42 |
92759b714ae4
fix compatibility between LSB and cmake >= 3.6
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3242
diff
changeset
|
43 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
|
44 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
|
45 else() |
92759b714ae4
fix compatibility between LSB and cmake >= 3.6
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3242
diff
changeset
|
46 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
|
47 endif() |
193
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 # here is the target environment located |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 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
|
51 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 # 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
|
53 # 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
|
54 # programs in the host environment |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 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
|
56 SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
57 SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
58 |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
59 SET(CMAKE_CROSSCOMPILING OFF) |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
60 |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
61 |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
62 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
|
63 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 | 64 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH} --lsb-besteffort" CACHE INTERNAL "" FORCE) |
65 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
|
66 |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
67 if (NOT "${LSB_CXX}" STREQUAL "") |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
68 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
|
69 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-cxx=${LSB_CXX}") |
2451 | 70 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
|
71 endif() |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
72 |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
73 if (NOT "${LSB_CC}" STREQUAL "") |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
74 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
|
75 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
|
76 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-cc=${LSB_CC}") |
2451 | 77 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
|
78 endif() |
862d943115f9
working on linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
561
diff
changeset
|
79 |