Mercurial > hg > orthanc
annotate Resources/CMake/BoostConfiguration.cmake @ 1444:b2b09a3dbd8e
refactoring: OrthancHttpHandler inside OrthancServer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 01 Jul 2015 12:09:58 +0200 |
parents | 728c22ade2e2 |
children | 0631b56c35eb |
rev | line source |
---|---|
735 | 1 if (STATIC_BUILD OR NOT USE_SYSTEM_BOOST) |
2 set(BOOST_STATIC 1) | |
3 else() | |
4 include(FindBoost) | |
5 | |
6 set(BOOST_STATIC 0) | |
7 #set(Boost_DEBUG 1) | |
8 #set(Boost_USE_STATIC_LIBS ON) | |
9 | |
10 find_package(Boost | |
915
703bef350e89
Orthanc now relies entirely on boost::locale
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
11 COMPONENTS filesystem thread system date_time regex locale) |
735 | 12 |
13 if (NOT Boost_FOUND) | |
14 message(FATAL_ERROR "Unable to locate Boost on this system") | |
15 endif() | |
16 | |
17 # Boost releases 1.44 through 1.47 supply both V2 and V3 filesystem | |
18 # http://www.boost.org/doc/libs/1_46_1/libs/filesystem/v3/doc/index.htm | |
19 if (${Boost_VERSION} LESS 104400) | |
20 add_definitions( | |
21 -DBOOST_HAS_FILESYSTEM_V3=0 | |
22 ) | |
23 else() | |
24 add_definitions( | |
25 -DBOOST_HAS_FILESYSTEM_V3=1 | |
26 -DBOOST_FILESYSTEM_VERSION=3 | |
27 ) | |
28 endif() | |
29 | |
30 #if (${Boost_VERSION} LESS 104800) | |
31 # boost::locale is only available from 1.48.00 | |
32 #message("Too old version of Boost (${Boost_LIB_VERSION}): Building the static version") | |
33 # set(BOOST_STATIC 1) | |
34 #endif() | |
35 | |
36 include_directories(${Boost_INCLUDE_DIRS}) | |
37 link_libraries(${Boost_LIBRARIES}) | |
38 endif() | |
39 | |
40 | |
41 if (BOOST_STATIC) | |
753
a6576b478553
upgrade to boost 1.55.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
735
diff
changeset
|
42 # Parameters for Boost 1.55.0 |
a6576b478553
upgrade to boost 1.55.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
735
diff
changeset
|
43 set(BOOST_NAME boost_1_55_0) |
a6576b478553
upgrade to boost 1.55.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
735
diff
changeset
|
44 set(BOOST_BCP_SUFFIX bcpdigest-0.7.4) |
a6576b478553
upgrade to boost 1.55.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
735
diff
changeset
|
45 set(BOOST_MD5 "409f7a0e4fb1f5659d07114f3133b67b") |
735 | 46 set(BOOST_FILESYSTEM_SOURCES_DIR "${BOOST_NAME}/libs/filesystem/src") |
47 | |
48 set(BOOST_SOURCES_DIR ${CMAKE_BINARY_DIR}/${BOOST_NAME}) | |
49 DownloadPackage( | |
50 "${BOOST_MD5}" | |
51 "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/${BOOST_NAME}_${BOOST_BCP_SUFFIX}.tar.gz" | |
52 "${BOOST_SOURCES_DIR}" | |
53 ) | |
54 | |
55 set(BOOST_SOURCES) | |
927 | 56 |
890 | 57 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR |
930 | 58 ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR |
1337 | 59 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR |
890 | 60 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD") |
735 | 61 list(APPEND BOOST_SOURCES |
62 ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/once.cpp | |
63 ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/thread.cpp | |
64 ) | |
65 add_definitions( | |
66 -DBOOST_LOCALE_WITH_ICONV=1 | |
67 ) | |
68 | |
69 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") | |
70 add_definitions(-DBOOST_HAS_SCHED_YIELD=1) | |
71 endif() | |
72 | |
73 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
74 list(APPEND BOOST_SOURCES | |
75 ${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_dll.cpp | |
76 ${BOOST_SOURCES_DIR}/libs/thread/src/win32/thread.cpp | |
77 ${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_pe.cpp | |
78 ${BOOST_FILESYSTEM_SOURCES_DIR}/windows_file_codecvt.cpp | |
79 ) | |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
930
diff
changeset
|
80 |
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
930
diff
changeset
|
81 # Starting with release 0.8.2, Orthanc statically links against |
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
930
diff
changeset
|
82 # libiconv, even on Windows. Indeed, the "WCONV" library of |
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
930
diff
changeset
|
83 # Windows XP seems not to support properly several codepages |
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
930
diff
changeset
|
84 # (notably "Latin3", "Hebrew", and "Arabic"). |
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
930
diff
changeset
|
85 |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1097
diff
changeset
|
86 if (USE_BOOST_ICONV) |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1097
diff
changeset
|
87 include(${ORTHANC_ROOT}/Resources/CMake/LibIconvConfiguration.cmake) |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1097
diff
changeset
|
88 else() |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1097
diff
changeset
|
89 add_definitions(-DBOOST_LOCALE_WITH_WCONV=1) |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1097
diff
changeset
|
90 endif() |
927 | 91 |
735 | 92 else() |
93 message(FATAL_ERROR "Support your platform here") | |
94 endif() | |
95 | |
927 | 96 if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") |
97 list(APPEND BOOST_SOURCES | |
98 ${BOOST_SOURCES_DIR}/libs/filesystem/src/utf8_codecvt_facet.cpp | |
99 ) | |
100 endif() | |
101 | |
1096
44f139b62108
patch for XCode 5.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1094
diff
changeset
|
102 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |
44f139b62108
patch for XCode 5.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1094
diff
changeset
|
103 # This is a patch to compile Boost 1.55.0 with Clang 3.4 and later |
44f139b62108
patch for XCode 5.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1094
diff
changeset
|
104 # (including XCode 5.1). Fixes issue 14 of Orthanc. |
44f139b62108
patch for XCode 5.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1094
diff
changeset
|
105 # https://trac.macports.org/ticket/42282#comment:10 |
44f139b62108
patch for XCode 5.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1094
diff
changeset
|
106 execute_process( |
1362
bf6db7d2f8b1
fix slow DCMTK problem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1337
diff
changeset
|
107 COMMAND patch -p0 -N -i ${ORTHANC_ROOT}/Resources/Patches/boost-1.55.0-clang-atomic.patch |
1097 | 108 WORKING_DIRECTORY ${BOOST_SOURCES_DIR} |
1096
44f139b62108
patch for XCode 5.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1094
diff
changeset
|
109 ) |
44f139b62108
patch for XCode 5.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1094
diff
changeset
|
110 endif() |
44f139b62108
patch for XCode 5.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1094
diff
changeset
|
111 |
735 | 112 aux_source_directory(${BOOST_SOURCES_DIR}/libs/regex/src BOOST_REGEX_SOURCES) |
113 | |
114 list(APPEND BOOST_SOURCES | |
115 ${BOOST_REGEX_SOURCES} | |
116 ${BOOST_SOURCES_DIR}/libs/date_time/src/gregorian/greg_month.cpp | |
117 ${BOOST_FILESYSTEM_SOURCES_DIR}/codecvt_error_category.cpp | |
118 ${BOOST_FILESYSTEM_SOURCES_DIR}/operations.cpp | |
119 ${BOOST_FILESYSTEM_SOURCES_DIR}/path.cpp | |
120 ${BOOST_FILESYSTEM_SOURCES_DIR}/path_traits.cpp | |
121 ${BOOST_SOURCES_DIR}/libs/locale/src/encoding/codepage.cpp | |
122 ${BOOST_SOURCES_DIR}/libs/system/src/error_code.cpp | |
123 ) | |
124 | |
125 add_definitions( | |
126 # Static build of Boost | |
127 -DBOOST_ALL_NO_LIB | |
128 -DBOOST_ALL_NOLIB | |
129 -DBOOST_DATE_TIME_NO_LIB | |
130 -DBOOST_THREAD_BUILD_LIB | |
131 -DBOOST_PROGRAM_OPTIONS_NO_LIB | |
132 -DBOOST_REGEX_NO_LIB | |
133 -DBOOST_SYSTEM_NO_LIB | |
134 -DBOOST_LOCALE_NO_LIB | |
135 -DBOOST_HAS_LOCALE=1 | |
136 -DBOOST_HAS_FILESYSTEM_V3=1 | |
137 ) | |
138 | |
1415 | 139 if (CMAKE_COMPILER_IS_GNUCXX) |
735 | 140 add_definitions(-isystem ${BOOST_SOURCES_DIR}) |
141 endif() | |
142 | |
143 include_directories( | |
144 ${BOOST_SOURCES_DIR} | |
145 ) | |
146 | |
147 source_group(ThirdParty\\Boost REGULAR_EXPRESSION ${BOOST_SOURCES_DIR}/.*) | |
148 else() | |
149 add_definitions( | |
915
703bef350e89
Orthanc now relies entirely on boost::locale
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
890
diff
changeset
|
150 -DBOOST_HAS_LOCALE=1 |
735 | 151 ) |
152 endif() | |
1397 | 153 |
154 | |
155 add_definitions( | |
156 -DBOOST_HAS_DATE_TIME=1 | |
157 -DBOOST_HAS_REGEX=1 | |
158 ) |