Mercurial > hg > orthanc
annotate CMakeLists.txt @ 186:f68c039b0571
preparing refactoring of ServerIndex
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 12 Nov 2012 15:29:07 +0100 |
parents | baada606da3c |
children | dfa2899d9960 |
rev | line source |
---|---|
12 | 1 cmake_minimum_required(VERSION 2.8) |
2 | |
57 | 3 project(Orthanc) |
134 | 4 |
135 | 5 # Version of the build, should always be "mainline" except in release branches |
6 add_definitions( | |
170 | 7 -DORTHANC_VERSION="mainline" |
135 | 8 ) |
9 | |
134 | 10 # Parameters of the build |
11 SET(STATIC_BUILD ON CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") | |
12 SET(STANDALONE_BUILD OFF CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)") | |
13 SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL") | |
14 SET(BUILD_UNIT_TESTS ON CACHE BOOL "Build the unit tests") | |
135 | 15 |
16 # Advanced parameters (for Debian packaging) | |
134 | 17 SET(USE_DYNAMIC_JSONCPP OFF CACHE BOOL "Use the dynamic version of JsonCpp (only for Debian sid)") |
18 SET(USE_DYNAMIC_GOOGLE_LOG ON CACHE BOOL "Use the dynamic version of Google Log") | |
19 SET(USE_DYNAMIC_GOOGLE_TEST ON CACHE BOOL "Use the dynamic version of Google Test (not for Debian sid)") | |
147 | 20 SET(USE_DYNAMIC_SQLITE ON CACHE BOOL "Use the dynamic version of SQLite") |
135 | 21 SET(DEBIAN_FORCE_HARDENING OFF CACHE BOOL "Force the injection of Debian hardening flags (unrecommended)") |
157
a63fb54819d7
gtest on debian sid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
149
diff
changeset
|
22 SET(DEBIAN_USE_GTEST_SOURCE_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (only for Debian sid)") |
134 | 23 |
135 | 24 mark_as_advanced(USE_DYNAMIC_JSONCPP) |
25 mark_as_advanced(USE_DYNAMIC_GOOGLE_LOG) | |
26 mark_as_advanced(USE_DYNAMIC_GOOGLE_TEST) | |
147 | 27 mark_as_advanced(USE_DYNAMIC_SQLITE) |
135 | 28 mark_as_advanced(DEBIAN_FORCE_HARDENING) |
29 mark_as_advanced(DEBIAN_USE_STATIC_GOOGLE_TEST) | |
134 | 30 |
31 # Some basic inclusions | |
12 | 32 include(CheckIncludeFiles) |
101 | 33 include(CheckIncludeFileCXX) |
134 | 34 include(${CMAKE_SOURCE_DIR}/Resources/CMake/AutoGeneratedCode.cmake) |
35 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DownloadPackage.cmake) | |
36 include(${CMAKE_SOURCE_DIR}/Resources/CMake/Compiler.cmake) | |
133 | 37 |
134 | 38 # Configuration of the standalone builds |
19 | 39 if (${CMAKE_CROSSCOMPILING}) |
134 | 40 # Cross-compilation implies the standalone build |
19 | 41 SET(STANDALONE_BUILD ON) |
42 endif() | |
43 | |
134 | 44 if (${STANDALONE_BUILD}) |
45 # We embed all the resources in the binaries for standalone builds | |
46 add_definitions(-DORTHANC_STANDALONE=1) | |
47 EmbedResources( | |
48 PREPARE_DATABASE OrthancServer/PrepareDatabase.sql | |
181
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
178
diff
changeset
|
49 PREPARE_DATABASE_2 OrthancServer/PrepareDatabase2.sql |
134 | 50 ORTHANC_EXPLORER OrthancExplorer |
175
662af781a227
sample config file from command line
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
170
diff
changeset
|
51 CONFIGURATION_SAMPLE Resources/Configuration.json |
134 | 52 ) |
12 | 53 else() |
134 | 54 add_definitions( |
55 -DORTHANC_STANDALONE=0 | |
56 -DORTHANC_PATH=\"${CMAKE_SOURCE_DIR}\" | |
57 ) | |
58 EmbedResources( | |
59 PREPARE_DATABASE OrthancServer/PrepareDatabase.sql | |
181
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
178
diff
changeset
|
60 PREPARE_DATABASE_2 OrthancServer/PrepareDatabase2.sql |
175
662af781a227
sample config file from command line
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
170
diff
changeset
|
61 CONFIGURATION_SAMPLE Resources/Configuration.json |
134 | 62 ) |
12 | 63 endif() |
64 | |
65 | |
134 | 66 # Prepare the third-party dependencies |
22 | 67 SET(THIRD_PARTY_SOURCES |
68 ${CMAKE_SOURCE_DIR}/Resources/md5/md5.c | |
24 | 69 ${CMAKE_SOURCE_DIR}/Resources/base64/base64.cpp |
177 | 70 ${CMAKE_SOURCE_DIR}/Resources/sha1/sha1.cpp |
22 | 71 ) |
26 | 72 |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
73 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleLogConfiguration.cmake) |
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
74 |
29
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
26
diff
changeset
|
75 if (${ENABLE_SSL}) |
57 | 76 add_definitions(-DORTHANC_SSL_ENABLED=1) |
29
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
26
diff
changeset
|
77 include(${CMAKE_SOURCE_DIR}/Resources/CMake/OpenSslConfiguration.cmake) |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
26
diff
changeset
|
78 else() |
57 | 79 add_definitions(-DORTHANC_SSL_ENABLED=0) |
29
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
26
diff
changeset
|
80 endif() |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
26
diff
changeset
|
81 |
12 | 82 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake) |
83 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake) | |
84 include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake) | |
85 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake) | |
86 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake) | |
87 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JsonCppConfiguration.cmake) | |
88 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibCurlConfiguration.cmake) | |
89 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibPngConfiguration.cmake) | |
90 | |
91 | |
134 | 92 # The main instructions to build the Orthanc binaries |
12 | 93 add_library(CoreLibrary |
94 STATIC | |
95 ${AUTOGENERATED_SOURCES} | |
96 ${THIRD_PARTY_SOURCES} | |
97 | |
98 Core/ChunkedBuffer.cpp | |
99 Core/Compression/BufferCompressor.cpp | |
100 Core/Compression/ZlibCompressor.cpp | |
81 | 101 Core/Compression/ZipWriter.cpp |
57 | 102 Core/OrthancException.cpp |
12 | 103 Core/DicomFormat/DicomArray.cpp |
104 Core/DicomFormat/DicomMap.cpp | |
105 Core/DicomFormat/DicomTag.cpp | |
79 | 106 Core/DicomFormat/DicomIntegerPixelAccessor.cpp |
178 | 107 Core/DicomFormat/DicomInstanceHasher.cpp |
12 | 108 Core/FileStorage.cpp |
109 Core/HttpServer/EmbeddedResourceHttpHandler.cpp | |
110 Core/HttpServer/FilesystemHttpHandler.cpp | |
111 Core/HttpServer/HttpHandler.cpp | |
112 Core/HttpServer/HttpOutput.cpp | |
113 Core/HttpServer/MongooseServer.cpp | |
114 Core/MultiThreading/BagOfRunnablesBySteps.cpp | |
115 Core/PngWriter.cpp | |
116 Core/SQLite/Connection.cpp | |
117 Core/SQLite/FunctionContext.cpp | |
118 Core/SQLite/Statement.cpp | |
119 Core/SQLite/StatementId.cpp | |
120 Core/SQLite/StatementReference.cpp | |
121 Core/SQLite/Transaction.cpp | |
122 Core/Toolbox.cpp | |
123 Core/Uuid.cpp | |
124 | |
57 | 125 OrthancCppClient/HttpClient.cpp |
126 OrthancCppClient/HttpException.cpp | |
12 | 127 ) |
128 | |
129 add_library(ServerLibrary | |
57 | 130 OrthancServer/DicomProtocol/DicomFindAnswers.cpp |
131 OrthancServer/DicomProtocol/DicomServer.cpp | |
132 OrthancServer/DicomProtocol/DicomUserConnection.cpp | |
133 OrthancServer/FromDcmtkBridge.cpp | |
134 OrthancServer/Internals/CommandDispatcher.cpp | |
135 OrthancServer/Internals/FindScp.cpp | |
136 OrthancServer/Internals/MoveScp.cpp | |
137 OrthancServer/Internals/StoreScp.cpp | |
138 OrthancServer/OrthancInitialization.cpp | |
139 OrthancServer/OrthancRestApi.cpp | |
140 OrthancServer/ServerIndex.cpp | |
141 OrthancServer/ToDcmtkBridge.cpp | |
183 | 142 OrthancServer/DatabaseWrapper.cpp |
12 | 143 ) |
144 | |
145 # Ensure autogenerated code is built before building ServerLibrary | |
146 add_dependencies(ServerLibrary CoreLibrary) | |
147 | |
57 | 148 add_executable(Orthanc |
149 OrthancServer/main.cpp | |
12 | 150 ) |
151 | |
134 | 152 target_link_libraries(Orthanc ServerLibrary CoreLibrary) |
120
5af0a4345d06
disabling of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
153 |
135 | 154 install( |
155 TARGETS Orthanc | |
156 RUNTIME DESTINATION bin | |
157 ) | |
158 | |
12 | 159 |
134 | 160 # Build the unit tests if required |
120
5af0a4345d06
disabling of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
161 if (BUILD_UNIT_TESTS) |
5af0a4345d06
disabling of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
162 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake) |
5af0a4345d06
disabling of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
163 add_executable(UnitTests |
5af0a4345d06
disabling of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
164 ${GTEST_SOURCES} |
5af0a4345d06
disabling of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
165 UnitTests/main.cpp |
139
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
135
diff
changeset
|
166 UnitTests/MessageWithDestination.cpp |
120
5af0a4345d06
disabling of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
167 UnitTests/SQLite.cpp |
5af0a4345d06
disabling of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
168 UnitTests/SQLiteChromium.cpp |
5af0a4345d06
disabling of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
169 UnitTests/Versions.cpp |
5af0a4345d06
disabling of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
170 UnitTests/Zip.cpp |
181
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
178
diff
changeset
|
171 UnitTests/ServerIndex.cpp |
120
5af0a4345d06
disabling of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
172 ) |
134 | 173 target_link_libraries(UnitTests ServerLibrary CoreLibrary) |
120
5af0a4345d06
disabling of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
174 endif() |
5af0a4345d06
disabling of unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
175 |
12 | 176 |
134 | 177 # Generate the Doxygen documentation if Doxygen is present |
12 | 178 find_package(Doxygen) |
179 if (DOXYGEN_FOUND) | |
180 configure_file( | |
57 | 181 ${CMAKE_SOURCE_DIR}/Resources/Orthanc.doxygen |
182 ${CMAKE_CURRENT_BINARY_DIR}/Orthanc.doxygen | |
12 | 183 @ONLY) |
184 add_custom_target(doc | |
57 | 185 ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Orthanc.doxygen |
12 | 186 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} |
187 COMMENT "Generating API documentation with Doxygen" VERBATIM | |
188 ) | |
149 | 189 else() |
190 message("Doxygen not found. The documentation will not be built.") | |
134 | 191 endif() |
149 | 192 |