comparison Resources/CMake/BoostConfiguration.cmake @ 0:02f7a0400a91

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 25 Feb 2015 13:45:35 +0100
parents
children 7a0af291cc90
comparison
equal deleted inserted replaced
-1:000000000000 0:02f7a0400a91
1 # Orthanc - A Lightweight, RESTful DICOM Store
2 # Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
3 # Department, University Hospital of Liege, Belgium
4 #
5 # This program is free software: you can redistribute it and/or
6 # modify it under the terms of the GNU Affero General Public License
7 # as published by the Free Software Foundation, either version 3 of
8 # the License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Affero General Public License for more details.
14 #
15 # You should have received a copy of the GNU Affero General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18
19 if (STATIC_BUILD OR NOT USE_SYSTEM_BOOST)
20 set(BOOST_STATIC 1)
21 else()
22 include(FindBoost)
23 set(BOOST_STATIC 0)
24 find_package(Boost COMPONENTS system thread filesystem)
25
26 if (NOT Boost_FOUND)
27 message(FATAL_ERROR "Unable to locate Boost on this system")
28 endif()
29
30 include_directories(${Boost_INCLUDE_DIRS})
31 link_libraries(${Boost_LIBRARIES})
32 endif()
33
34
35 if (BOOST_STATIC)
36 # Parameters for Boost 1.55.0
37 set(BOOST_NAME boost_1_55_0)
38 set(BOOST_BCP_SUFFIX bcpdigest-0.7.4)
39 set(BOOST_MD5 "409f7a0e4fb1f5659d07114f3133b67b")
40 set(BOOST_FILESYSTEM_SOURCES_DIR "${BOOST_NAME}/libs/filesystem/src")
41
42 set(BOOST_SOURCES_DIR ${CMAKE_BINARY_DIR}/${BOOST_NAME})
43 DownloadPackage(
44 "${BOOST_MD5}"
45 "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/${BOOST_NAME}_${BOOST_BCP_SUFFIX}.tar.gz"
46 "${BOOST_SOURCES_DIR}"
47 )
48
49 add_definitions(
50 # Static build of Boost
51 -DBOOST_ALL_NO_LIB
52 -DBOOST_ALL_NOLIB
53 -DBOOST_DATE_TIME_NO_LIB
54 -DBOOST_THREAD_BUILD_LIB
55 -DBOOST_PROGRAM_OPTIONS_NO_LIB
56 -DBOOST_REGEX_NO_LIB
57 -DBOOST_SYSTEM_NO_LIB
58 -DBOOST_LOCALE_NO_LIB
59 )
60
61 if (${CMAKE_COMPILER_IS_GNUCXX})
62 add_definitions(-isystem ${BOOST_SOURCES_DIR})
63 endif()
64
65 include_directories(
66 ${BOOST_SOURCES_DIR}
67 )
68
69 list(APPEND BOOST_SOURCES
70 ${BOOST_SOURCES_DIR}/libs/system/src/error_code.cpp
71 )
72
73
74 ## Boost::thread
75
76 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
77 ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
78 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
79 list(APPEND BOOST_SOURCES
80 ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/once.cpp
81 ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/thread.cpp
82 )
83
84 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
85 add_definitions(-DBOOST_HAS_SCHED_YIELD=1)
86 endif()
87
88 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
89 list(APPEND BOOST_SOURCES
90 ${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_dll.cpp
91 ${BOOST_SOURCES_DIR}/libs/thread/src/win32/thread.cpp
92 ${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_pe.cpp
93 )
94 endif()
95
96
97 ## Boost::filesystem
98
99 list(APPEND BOOST_SOURCES
100 ${BOOST_FILESYSTEM_SOURCES_DIR}/codecvt_error_category.cpp
101 ${BOOST_FILESYSTEM_SOURCES_DIR}/operations.cpp
102 ${BOOST_FILESYSTEM_SOURCES_DIR}/path.cpp
103 ${BOOST_FILESYSTEM_SOURCES_DIR}/path_traits.cpp
104 )
105
106 if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
107 list(APPEND BOOST_SOURCES
108 ${BOOST_SOURCES_DIR}/libs/filesystem/src/utf8_codecvt_facet.cpp
109 )
110 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
111 list(APPEND BOOST_SOURCES
112 ${BOOST_FILESYSTEM_SOURCES_DIR}/windows_file_codecvt.cpp
113 )
114 endif()
115
116
117 source_group(ThirdParty\\Boost REGULAR_EXPRESSION ${BOOST_SOURCES_DIR}/.*)
118 endif()
119
120
121 add_definitions(
122 -DBOOST_HAS_FILESYSTEM_V3=1
123 -DBOOST_HAS_LOCALE=1
124 )