comparison CMakeLists.txt @ 824:a811bdf8b8eb

precompiled headers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 02 Jun 2014 11:36:07 +0200
parents 7ce875531950
children f2509d3624f6
comparison
equal deleted inserted replaced
822:7ce875531950 824:a811bdf8b8eb
42 include(CheckIncludeFileCXX) 42 include(CheckIncludeFileCXX)
43 include(CheckLibraryExists) 43 include(CheckLibraryExists)
44 include(${CMAKE_SOURCE_DIR}/Resources/CMake/AutoGeneratedCode.cmake) 44 include(${CMAKE_SOURCE_DIR}/Resources/CMake/AutoGeneratedCode.cmake)
45 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DownloadPackage.cmake) 45 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DownloadPackage.cmake)
46 include(${CMAKE_SOURCE_DIR}/Resources/CMake/Compiler.cmake) 46 include(${CMAKE_SOURCE_DIR}/Resources/CMake/Compiler.cmake)
47 include(${CMAKE_SOURCE_DIR}/Resources/CMake/VisualStudioPrecompiledHeaders.cmake)
47 48
48 set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR}) 49 set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR})
49 50
50 51
51 52
52 53
53 ##################################################################### 54 #####################################################################
54 ## Inclusion of third-party dependencies 55 ## List of source files
55 ##################################################################### 56 #####################################################################
56 57
57 # Configuration of the standalone builds 58 set(ORTHANC_CORE_SOURCES
58 if (CMAKE_CROSSCOMPILING)
59 # Cross-compilation implies the standalone build
60 SET(STANDALONE_BUILD ON)
61 endif()
62
63 # Prepare the third-party dependencies
64 SET(THIRD_PARTY_SOURCES
65 ${CMAKE_SOURCE_DIR}/Resources/md5/md5.c
66 ${CMAKE_SOURCE_DIR}/Resources/base64/base64.cpp
67 )
68
69 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleLogConfiguration.cmake)
70 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake)
71 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake)
72 include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake)
73 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake)
74 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake)
75 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JsonCppConfiguration.cmake)
76 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibPngConfiguration.cmake)
77 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LuaConfiguration.cmake)
78 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibCurlConfiguration.cmake)
79
80
81 if (${ENABLE_SSL})
82 add_definitions(-DORTHANC_SSL_ENABLED=1)
83 include(${CMAKE_SOURCE_DIR}/Resources/CMake/OpenSslConfiguration.cmake)
84 else()
85 add_definitions(-DORTHANC_SSL_ENABLED=0)
86 endif()
87
88
89
90 #####################################################################
91 ## Autogeneration of files
92 #####################################################################
93
94 # Prepare the embedded files
95 set(EMBEDDED_FILES
96 PREPARE_DATABASE ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/PrepareDatabase.sql
97 UPGRADE_DATABASE_3_TO_4 ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Upgrade3To4.sql
98 CONFIGURATION_SAMPLE ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Configuration.json
99 LUA_TOOLBOX ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Toolbox.lua
100 )
101
102 if (${STANDALONE_BUILD})
103 # We embed all the resources in the binaries for standalone builds
104 add_definitions(-DORTHANC_STANDALONE=1)
105 EmbedResources(
106 ${EMBEDDED_FILES}
107 ORTHANC_EXPLORER ${CMAKE_CURRENT_SOURCE_DIR}/OrthancExplorer
108 ${DCMTK_DICTIONARIES}
109 )
110 else()
111 add_definitions(
112 -DORTHANC_STANDALONE=0
113 -DORTHANC_PATH=\"${CMAKE_SOURCE_DIR}\"
114 )
115 EmbedResources(
116 ${EMBEDDED_FILES}
117 )
118 endif()
119
120
121
122 #####################################################################
123 ## Build the core of Orthanc
124 #####################################################################
125
126 add_definitions(
127 -DORTHANC_VERSION="${ORTHANC_VERSION}"
128 )
129
130 list(LENGTH OPENSSL_SOURCES OPENSSL_SOURCES_LENGTH)
131 if (${OPENSSL_SOURCES_LENGTH} GREATER 0)
132 add_library(OpenSSL STATIC ${OPENSSL_SOURCES})
133 endif()
134
135 add_library(CoreLibrary
136 STATIC
137 ${AUTOGENERATED_SOURCES}
138 ${THIRD_PARTY_SOURCES}
139 ${CURL_SOURCES}
140
141 Core/Cache/MemoryCache.cpp 59 Core/Cache/MemoryCache.cpp
142 Core/ChunkedBuffer.cpp 60 Core/ChunkedBuffer.cpp
143 Core/Compression/BufferCompressor.cpp 61 Core/Compression/BufferCompressor.cpp
144 Core/Compression/ZlibCompressor.cpp 62 Core/Compression/ZlibCompressor.cpp
145 Core/Compression/ZipWriter.cpp 63 Core/Compression/ZipWriter.cpp
190 OrthancCppClient/OrthancConnection.cpp 108 OrthancCppClient/OrthancConnection.cpp
191 OrthancCppClient/Study.cpp 109 OrthancCppClient/Study.cpp
192 OrthancCppClient/Series.cpp 110 OrthancCppClient/Series.cpp
193 OrthancCppClient/Instance.cpp 111 OrthancCppClient/Instance.cpp
194 OrthancCppClient/Patient.cpp 112 OrthancCppClient/Patient.cpp
195 ) 113 )
196 114
197 115
198 ##################################################################### 116 set(ORTHANC_SERVER_SOURCES
199 ## Build the Orthanc server
200 #####################################################################
201
202 add_library(ServerLibrary
203 STATIC
204 ${DCMTK_SOURCES}
205 OrthancServer/DicomProtocol/DicomFindAnswers.cpp 117 OrthancServer/DicomProtocol/DicomFindAnswers.cpp
206 OrthancServer/DicomProtocol/DicomServer.cpp 118 OrthancServer/DicomProtocol/DicomServer.cpp
207 OrthancServer/DicomProtocol/DicomUserConnection.cpp 119 OrthancServer/DicomProtocol/DicomUserConnection.cpp
208 OrthancServer/DicomProtocol/RemoteModalityParameters.cpp 120 OrthancServer/DicomProtocol/RemoteModalityParameters.cpp
209 OrthancServer/DicomProtocol/ReusableDicomUserConnection.cpp 121 OrthancServer/DicomProtocol/ReusableDicomUserConnection.cpp
231 OrthancServer/ServerToolbox.cpp 143 OrthancServer/ServerToolbox.cpp
232 OrthancServer/OrthancFindRequestHandler.cpp 144 OrthancServer/OrthancFindRequestHandler.cpp
233 OrthancServer/OrthancMoveRequestHandler.cpp 145 OrthancServer/OrthancMoveRequestHandler.cpp
234 ) 146 )
235 147
148
149
150 #####################################################################
151 ## Inclusion of third-party dependencies
152 #####################################################################
153
154 # Configuration of the standalone builds
155 if (CMAKE_CROSSCOMPILING)
156 # Cross-compilation implies the standalone build
157 SET(STANDALONE_BUILD ON)
158 endif()
159
160 # Prepare the third-party dependencies
161 SET(THIRD_PARTY_SOURCES
162 ${CMAKE_SOURCE_DIR}/Resources/md5/md5.c
163 ${CMAKE_SOURCE_DIR}/Resources/base64/base64.cpp
164 )
165
166 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleLogConfiguration.cmake)
167 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake)
168 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake)
169 include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake)
170 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake)
171 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake)
172 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JsonCppConfiguration.cmake)
173 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibPngConfiguration.cmake)
174 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LuaConfiguration.cmake)
175 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibCurlConfiguration.cmake)
176
177
178 if (${ENABLE_SSL})
179 add_definitions(-DORTHANC_SSL_ENABLED=1)
180 include(${CMAKE_SOURCE_DIR}/Resources/CMake/OpenSslConfiguration.cmake)
181 else()
182 add_definitions(-DORTHANC_SSL_ENABLED=0)
183 endif()
184
185
186
187 #####################################################################
188 ## Autogeneration of files
189 #####################################################################
190
191 # Prepare the embedded files
192 set(EMBEDDED_FILES
193 PREPARE_DATABASE ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/PrepareDatabase.sql
194 UPGRADE_DATABASE_3_TO_4 ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Upgrade3To4.sql
195 CONFIGURATION_SAMPLE ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Configuration.json
196 LUA_TOOLBOX ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Toolbox.lua
197 )
198
199 if (${STANDALONE_BUILD})
200 # We embed all the resources in the binaries for standalone builds
201 add_definitions(-DORTHANC_STANDALONE=1)
202 EmbedResources(
203 ${EMBEDDED_FILES}
204 ORTHANC_EXPLORER ${CMAKE_CURRENT_SOURCE_DIR}/OrthancExplorer
205 ${DCMTK_DICTIONARIES}
206 )
207 else()
208 add_definitions(
209 -DORTHANC_STANDALONE=0
210 -DORTHANC_PATH=\"${CMAKE_SOURCE_DIR}\"
211 )
212 EmbedResources(
213 ${EMBEDDED_FILES}
214 )
215 endif()
216
217
218
219 #####################################################################
220 ## Build the core of Orthanc
221 #####################################################################
222
223 # Setup precompiled headers for Microsoft Visual Studio
224 if (${MSVC})
225 set(ORTHANC_SOURCES ${ORTHANC_CORE_SOURCES} ${ORTHANC_SERVER_SOURCES})
226 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS("PrecompiledHeaders.h" "Core/PrecompiledHeaders.cpp" ORTHANC_SOURCES)
227 list(APPEND ORTHANC_CORE_SOURCES "Core/PrecompiledHeaders.h")
228 endif()
229
230
231 add_definitions(
232 -DORTHANC_VERSION="${ORTHANC_VERSION}"
233 )
234
235 list(LENGTH OPENSSL_SOURCES OPENSSL_SOURCES_LENGTH)
236 if (${OPENSSL_SOURCES_LENGTH} GREATER 0)
237 add_library(OpenSSL STATIC ${OPENSSL_SOURCES})
238 endif()
239
240 add_library(CoreLibrary
241 STATIC
242 ${AUTOGENERATED_SOURCES}
243 ${THIRD_PARTY_SOURCES}
244 ${CURL_SOURCES}
245 ${ORTHANC_CORE_SOURCES}
246 )
247
248
249 #####################################################################
250 ## Build the Orthanc server
251 #####################################################################
252
253 add_library(ServerLibrary
254 STATIC
255 ${DCMTK_SOURCES}
256 ${ORTHANC_SERVER_SOURCES}
257 )
258
236 # Ensure autogenerated code is built before building ServerLibrary 259 # Ensure autogenerated code is built before building ServerLibrary
237 add_dependencies(ServerLibrary CoreLibrary) 260 add_dependencies(ServerLibrary CoreLibrary)
238 261
239 add_executable(Orthanc 262 add_executable(Orthanc
240 OrthancServer/main.cpp 263 OrthancServer/main.cpp