comparison CMakeLists.txt @ 516:49a1228d6fe7 laaw

building the dll from the main CMakeLists
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 19 Jul 2013 16:12:29 +0200
parents 6e4bd06c17c5
children cd7d4842851c
comparison
equal deleted inserted replaced
514:a3d9acf37161 516:49a1228d6fe7
4 4
5 # Version of the build, should always be "mainline" except in release branches 5 # Version of the build, should always be "mainline" except in release branches
6 add_definitions( 6 add_definitions(
7 -DORTHANC_VERSION="mainline" 7 -DORTHANC_VERSION="mainline"
8 ) 8 )
9
10
11 #####################################################################
12 ## CMake parameters tunable at the command line
13 #####################################################################
9 14
10 # Parameters of the build 15 # Parameters of the build
11 SET(STATIC_BUILD ON CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") 16 SET(STATIC_BUILD ON CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
12 SET(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)") 17 SET(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)")
13 SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL") 18 SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL")
41 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DownloadPackage.cmake) 46 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DownloadPackage.cmake)
42 include(${CMAKE_SOURCE_DIR}/Resources/CMake/Compiler.cmake) 47 include(${CMAKE_SOURCE_DIR}/Resources/CMake/Compiler.cmake)
43 48
44 set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR}) 49 set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR})
45 50
51
52
53
54 #####################################################################
55 ## Inclusion of third-party dependencies
56 #####################################################################
57
46 # Configuration of the standalone builds 58 # Configuration of the standalone builds
47 if (${CMAKE_CROSSCOMPILING}) 59 if (${CMAKE_CROSSCOMPILING})
48 # Cross-compilation implies the standalone build 60 # Cross-compilation implies the standalone build
49 SET(STANDALONE_BUILD ON) 61 SET(STANDALONE_BUILD ON)
50 endif() 62 endif()
78 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibCurlConfiguration.cmake) 90 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibCurlConfiguration.cmake)
79 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibPngConfiguration.cmake) 91 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibPngConfiguration.cmake)
80 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LuaConfiguration.cmake) 92 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LuaConfiguration.cmake)
81 93
82 94
95
96 #####################################################################
97 ## Autogeneration of files
98 #####################################################################
99
83 # Prepare the embedded files 100 # Prepare the embedded files
84 set(EMBEDDED_FILES 101 set(EMBEDDED_FILES
85 PREPARE_DATABASE ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/PrepareDatabase.sql 102 PREPARE_DATABASE ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/PrepareDatabase.sql
86 CONFIGURATION_SAMPLE ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Configuration.json 103 CONFIGURATION_SAMPLE ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Configuration.json
87 LUA_TOOLBOX ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Toolbox.lua 104 LUA_TOOLBOX ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Toolbox.lua
104 ${EMBEDDED_FILES} 121 ${EMBEDDED_FILES}
105 ) 122 )
106 endif() 123 endif()
107 124
108 125
109 # The main instructions to build the Orthanc binaries 126
127 #####################################################################
128 ## Build the core of Orthanc
129 #####################################################################
130
131 add_library(OpenSSL STATIC ${OPENSSL_SOURCES})
132
110 add_library(CoreLibrary 133 add_library(CoreLibrary
111 STATIC 134 STATIC
112 ${AUTOGENERATED_SOURCES} 135 ${AUTOGENERATED_SOURCES}
113 ${THIRD_PARTY_SOURCES} 136 ${THIRD_PARTY_SOURCES}
137 ${CURL_SOURCES}
114 138
115 Core/Cache/MemoryCache.cpp 139 Core/Cache/MemoryCache.cpp
116 Core/ChunkedBuffer.cpp 140 Core/ChunkedBuffer.cpp
117 Core/Compression/BufferCompressor.cpp 141 Core/Compression/BufferCompressor.cpp
118 Core/Compression/ZlibCompressor.cpp 142 Core/Compression/ZlibCompressor.cpp
165 ) 189 )
166 190
167 191
168 192
169 if(NOT ONLY_CORE_LIBRARY) 193 if(NOT ONLY_CORE_LIBRARY)
194 #####################################################################
195 ## Build the Orthanc server
196 #####################################################################
197
170 add_library(ServerLibrary 198 add_library(ServerLibrary
171 STATIC 199 STATIC
172 ${DCMTK_SOURCES} 200 ${DCMTK_SOURCES}
173 OrthancServer/DicomProtocol/DicomFindAnswers.cpp 201 OrthancServer/DicomProtocol/DicomFindAnswers.cpp
174 OrthancServer/DicomProtocol/DicomServer.cpp 202 OrthancServer/DicomProtocol/DicomServer.cpp
193 221
194 add_executable(Orthanc 222 add_executable(Orthanc
195 OrthancServer/main.cpp 223 OrthancServer/main.cpp
196 ) 224 )
197 225
198 target_link_libraries(Orthanc ServerLibrary CoreLibrary) 226 target_link_libraries(Orthanc ServerLibrary CoreLibrary OpenSSL)
199 227
200 install( 228 install(
201 TARGETS Orthanc 229 TARGETS Orthanc
202 RUNTIME DESTINATION bin 230 RUNTIME DESTINATION bin
203 ) 231 )
204 232
205 # Build the unit tests if required 233
234 #####################################################################
235 ## Build the unit tests if required
236 #####################################################################
237
206 if (BUILD_UNIT_TESTS) 238 if (BUILD_UNIT_TESTS)
207 add_definitions(-DORTHANC_BUILD_UNIT_TESTS=1) 239 add_definitions(-DORTHANC_BUILD_UNIT_TESTS=1)
208 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake) 240 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
209 add_executable(UnitTests 241 add_executable(UnitTests
210 ${GTEST_SOURCES} 242 ${GTEST_SOURCES}
218 UnitTests/Versions.cpp 250 UnitTests/Versions.cpp
219 UnitTests/Zip.cpp 251 UnitTests/Zip.cpp
220 UnitTests/Lua.cpp 252 UnitTests/Lua.cpp
221 UnitTests/main.cpp 253 UnitTests/main.cpp
222 ) 254 )
223 target_link_libraries(UnitTests ServerLibrary CoreLibrary) 255 target_link_libraries(UnitTests ServerLibrary CoreLibrary OpenSSL)
224 endif() 256 endif()
225 endif() 257 endif()
226 258
227 259
228 # Generate the Doxygen documentation if Doxygen is present 260 #####################################################################
261 ## Create the standalone DLL containing the Orthanc Client API
262 #####################################################################
263
264 # include_directories(${ORTHANC_ROOT}/OrthancCppClient/Package/Laaw)
265
266 # if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
267 # if (${CMAKE_SIZEOF_VOID_P} EQUAL 4)
268 # set(ORTHANC_CPP_CLIENT_DEF ${ORTHANC_ROOT}/OrthancCppClient/Package/Build/Windows32.def)
269 # elseif (${CMAKE_SIZEOF_VOID_P} EQUAL 8)
270 # set(ORTHANC_CPP_CLIENT_DEF ${ORTHANC_ROOT}/OrthancCppClient/Package/Build/Windows64.def)
271 # else()
272 # message(FATAL_ERROR "Support your platform here")
273 # endif()
274 # endif()
275
276 # add_library(OrthancCppClient SHARED
277 # ${ORTHANC_ROOT}/Core/OrthancException.cpp
278 # ${ORTHANC_ROOT}/Core/Enumerations.cpp
279 # ${ORTHANC_ROOT}/Core/Toolbox.cpp
280 # ${ORTHANC_ROOT}/Core/HttpClient.cpp
281 # ${ORTHANC_ROOT}/Core/MultiThreading/ArrayFilledByThreads.cpp
282 # ${ORTHANC_ROOT}/Core/MultiThreading/ThreadedCommandProcessor.cpp
283 # ${ORTHANC_ROOT}/Core/MultiThreading/SharedMessageQueue.cpp
284 # ${ORTHANC_ROOT}/Core/FileFormats/PngReader.cpp
285 # ${ORTHANC_ROOT}/OrthancCppClient/OrthancConnection.cpp
286 # ${ORTHANC_ROOT}/OrthancCppClient/Series.cpp
287 # ${ORTHANC_ROOT}/OrthancCppClient/Study.cpp
288 # ${ORTHANC_ROOT}/OrthancCppClient/Instance.cpp
289 # ${ORTHANC_ROOT}/OrthancCppClient/Patient.cpp
290 # ${ORTHANC_ROOT}/OrthancCppClient/Package/SharedLibrary.cpp
291 # ${ORTHANC_ROOT}/Resources/sha1/sha1.cpp
292 # ${ORTHANC_ROOT}/Resources/md5/md5.c
293 # ${ORTHANC_ROOT}/Resources/base64/base64.cpp
294 # ${ORTHANC_CPP_CLIENT_DEF}
295 # ${THIRD_PARTY_SOURCES}
296 # ${OPENSSL_SOURCES}
297 # ${CURL_SOURCES}
298 # )
299
300 # if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
301 # set_target_properties(OrthancCppClient
302 # PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--version-script=${ORTHANC_ROOT}/OrthancCppClient/Package/Laaw/VersionScript.map"
303 # )
304 # target_link_libraries(OrthancCppClient pthread)
305 # elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
306 # if (${CMAKE_COMPILER_IS_GNUCXX})
307 # set_target_properties(OrthancCppClient
308 # PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++"
309 # )
310 # target_link_libraries(OrthancCppClient ws2_32)
311 # else()
312 # message(FATAL_ERROR "Support Visual Studio here")
313 # endif()
314 # else()
315 # message(FATAL_ERROR "Support your platform here")
316 # endif()
317
318
319
320 #####################################################################
321 ## Generate the documentation if Doxygen is present
322 #####################################################################
323
229 find_package(Doxygen) 324 find_package(Doxygen)
230 if (DOXYGEN_FOUND) 325 if (DOXYGEN_FOUND)
231 configure_file( 326 configure_file(
232 ${CMAKE_SOURCE_DIR}/Resources/Orthanc.doxygen 327 ${CMAKE_SOURCE_DIR}/Resources/Orthanc.doxygen
233 ${CMAKE_CURRENT_BINARY_DIR}/Orthanc.doxygen 328 ${CMAKE_CURRENT_BINARY_DIR}/Orthanc.doxygen