Mercurial > hg > orthanc
annotate CMakeLists.txt @ 48:0a04c70747d9
renaming
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 05 Sep 2012 15:36:45 +0200 |
parents | 042ac60f5bf9 |
children | e0cac5540668 |
rev | line source |
---|---|
12 | 1 cmake_minimum_required(VERSION 2.8) |
2 | |
48 | 3 project(Palanthir) |
12 | 4 include(${CMAKE_SOURCE_DIR}/Resources/CMake/AutoGeneratedCode.cmake) |
5 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DownloadPackage.cmake) | |
6 include(CheckIncludeFiles) | |
7 | |
8 SET(STATIC_BUILD ON CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") | |
19 | 9 SET(STANDALONE_BUILD OFF CACHE BOOL "Standalone build (necessary for cross-compilation or binary releases)") |
23 | 10 SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL") |
12 | 11 |
19 | 12 if (${CMAKE_CROSSCOMPILING}) |
13 SET(STANDALONE_BUILD ON) | |
14 endif() | |
15 | |
16 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
12 | 17 CHECK_INCLUDE_FILES(rpc.h HAVE_UUID_H) |
18 else() | |
19 CHECK_INCLUDE_FILES(uuid/uuid.h HAVE_UUID_H) | |
20 endif() | |
21 | |
22 if ("${HAVE_UUID_H}" STREQUAL "") | |
23 message(FATAL_ERROR "Please install the uuid-dev package") | |
24 endif() | |
25 | |
26 | |
22 | 27 SET(THIRD_PARTY_SOURCES |
28 ${CMAKE_SOURCE_DIR}/Resources/md5/md5.c | |
24 | 29 ${CMAKE_SOURCE_DIR}/Resources/base64/base64.cpp |
22 | 30 ) |
26 | 31 |
29
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
26
diff
changeset
|
32 if (${ENABLE_SSL}) |
48 | 33 add_definitions(-DPALANTHIR_SSL_ENABLED=1) |
29
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
26
diff
changeset
|
34 include(${CMAKE_SOURCE_DIR}/Resources/CMake/OpenSslConfiguration.cmake) |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
26
diff
changeset
|
35 else() |
48 | 36 add_definitions(-DPALANTHIR_SSL_ENABLED=0) |
29
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
26
diff
changeset
|
37 endif() |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
26
diff
changeset
|
38 |
12 | 39 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake) |
40 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake) | |
41 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake) | |
42 include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake) | |
43 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake) | |
44 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake) | |
45 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JsonCppConfiguration.cmake) | |
46 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibCurlConfiguration.cmake) | |
47 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibPngConfiguration.cmake) | |
48 | |
49 | |
50 if (${CMAKE_COMPILER_IS_GNUCXX}) | |
26 | 51 set(CMAKE_C_FLAGS "-Wall -Wno-long-long -Wno-implicit-function-declaration") |
52 # --std=c99 makes libcurl not to compile | |
53 # -pedantic gives a lot of warnings on OpenSSL | |
12 | 54 set(CMAKE_CXX_FLAGS "-Wall -pedantic -Wno-long-long -Wno-variadic-macros") |
55 elseif (${MSVC}) | |
56 # http://stackoverflow.com/a/6510446 | |
57 foreach(flag_var | |
58 CMAKE_C_FLAGS_DEBUG | |
59 CMAKE_CXX_FLAGS_DEBUG | |
60 CMAKE_C_FLAGS_RELEASE | |
61 CMAKE_CXX_FLAGS_RELEASE | |
62 CMAKE_C_FLAGS_MINSIZEREL | |
63 CMAKE_CXX_FLAGS_MINSIZEREL | |
64 CMAKE_C_FLAGS_RELWITHDEBINFO | |
65 CMAKE_CXX_FLAGS_RELWITHDEBINFO) | |
66 string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") | |
67 string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}") | |
68 endforeach(flag_var) | |
69 add_definitions( | |
70 -D_CRT_SECURE_NO_WARNINGS=1 | |
71 -D_CRT_SECURE_NO_DEPRECATE=1 | |
72 ) | |
73 include_directories(${CMAKE_SOURCE_DIR}/Resources/VisualStudio) | |
74 link_libraries(netapi32) | |
75 endif() | |
76 | |
77 | |
78 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") | |
79 add_definitions( | |
80 -D_LARGEFILE64_SOURCE=1 | |
81 -D_FILE_OFFSET_BITS=64 | |
82 ) | |
83 set(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") | |
84 set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined") | |
85 set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined") | |
86 | |
87 # http://www.mail-archive.com/cmake@cmake.org/msg08837.html | |
88 set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") | |
89 link_libraries(uuid pthread rt) | |
90 | |
91 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
92 add_definitions( | |
93 -DWINVER=0x0501 | |
94 -D_CRT_SECURE_NO_WARNINGS=1 | |
95 ) | |
96 link_libraries(rpcrt4 ws2_32) | |
97 endif() | |
98 | |
99 | |
100 if (${STATIC_BUILD}) | |
48 | 101 add_definitions(-DPALANTHIR_STATIC=1) |
12 | 102 else() |
48 | 103 add_definitions(-DPALANTHIR_STATIC=0) |
12 | 104 endif() |
105 | |
19 | 106 if (${STANDALONE_BUILD}) |
12 | 107 add_definitions( |
48 | 108 -DPALANTHIR_STANDALONE=1 |
12 | 109 ) |
110 | |
111 EmbedResources( | |
48 | 112 PREPARE_DATABASE PalanthirServer/PrepareDatabase.sql |
113 PALANTHIR_EXPLORER PalanthirExplorer | |
12 | 114 ) |
115 | |
116 else() | |
117 add_definitions( | |
48 | 118 -DPALANTHIR_STANDALONE=0 |
119 -DPALANTHIR_PATH=\"${CMAKE_SOURCE_DIR}\" | |
12 | 120 ) |
121 | |
122 EmbedResources( | |
48 | 123 PREPARE_DATABASE PalanthirServer/PrepareDatabase.sql |
12 | 124 ) |
125 endif() | |
126 | |
127 | |
128 add_library(CoreLibrary | |
129 STATIC | |
130 ${AUTOGENERATED_SOURCES} | |
131 ${THIRD_PARTY_SOURCES} | |
132 | |
133 Core/ChunkedBuffer.cpp | |
134 Core/Compression/BufferCompressor.cpp | |
135 Core/Compression/ZlibCompressor.cpp | |
48 | 136 Core/PalanthirException.cpp |
12 | 137 Core/DicomFormat/DicomArray.cpp |
138 Core/DicomFormat/DicomMap.cpp | |
139 Core/DicomFormat/DicomTag.cpp | |
140 Core/FileStorage.cpp | |
141 Core/HttpServer/EmbeddedResourceHttpHandler.cpp | |
142 Core/HttpServer/FilesystemHttpHandler.cpp | |
143 Core/HttpServer/HttpHandler.cpp | |
144 Core/HttpServer/HttpOutput.cpp | |
145 Core/HttpServer/MongooseServer.cpp | |
146 Core/MultiThreading/BagOfRunnablesBySteps.cpp | |
147 Core/PngWriter.cpp | |
148 Core/SQLite/Connection.cpp | |
149 Core/SQLite/FunctionContext.cpp | |
150 Core/SQLite/Statement.cpp | |
151 Core/SQLite/StatementId.cpp | |
152 Core/SQLite/StatementReference.cpp | |
153 Core/SQLite/Transaction.cpp | |
154 Core/Toolbox.cpp | |
155 Core/Uuid.cpp | |
156 | |
48 | 157 PalanthirCppClient/HttpClient.cpp |
158 PalanthirCppClient/HttpException.cpp | |
12 | 159 ) |
160 | |
161 add_library(ServerLibrary | |
48 | 162 PalanthirServer/DicomIntegerPixelAccessor.cpp |
163 PalanthirServer/DicomProtocol/DicomFindAnswers.cpp | |
164 PalanthirServer/DicomProtocol/DicomServer.cpp | |
165 PalanthirServer/DicomProtocol/DicomUserConnection.cpp | |
166 PalanthirServer/FromDcmtkBridge.cpp | |
167 PalanthirServer/Internals/CommandDispatcher.cpp | |
168 PalanthirServer/Internals/FindScp.cpp | |
169 PalanthirServer/Internals/MoveScp.cpp | |
170 PalanthirServer/Internals/StoreScp.cpp | |
171 PalanthirServer/PalanthirInitialization.cpp | |
172 PalanthirServer/PalanthirRestApi.cpp | |
173 PalanthirServer/ServerIndex.cpp | |
174 PalanthirServer/ToDcmtkBridge.cpp | |
175 PalanthirServer/ToDcmtkBridge.cpp | |
176 PalanthirServer/DicomIntegerPixelAccessor.cpp | |
12 | 177 ) |
178 | |
179 # Ensure autogenerated code is built before building ServerLibrary | |
180 add_dependencies(ServerLibrary CoreLibrary) | |
181 | |
48 | 182 add_executable(Palanthir |
183 PalanthirServer/main.cpp | |
12 | 184 ) |
185 | |
186 add_executable(UnitTests | |
187 ${GTEST_SOURCES} | |
188 UnitTests/main.cpp | |
189 UnitTests/SQLite.cpp | |
190 UnitTests/SQLiteChromium.cpp | |
191 UnitTests/Versions.cpp | |
192 ) | |
193 | |
48 | 194 TARGET_LINK_LIBRARIES(Palanthir ServerLibrary CoreLibrary) |
12 | 195 TARGET_LINK_LIBRARIES(UnitTests ServerLibrary CoreLibrary) |
196 | |
197 find_package(Doxygen) | |
198 if (DOXYGEN_FOUND) | |
199 configure_file( | |
48 | 200 ${CMAKE_SOURCE_DIR}/Resources/Palanthir.doxygen |
201 ${CMAKE_CURRENT_BINARY_DIR}/Palanthir.doxygen | |
12 | 202 @ONLY) |
203 add_custom_target(doc | |
48 | 204 ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Palanthir.doxygen |
12 | 205 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} |
206 COMMENT "Generating API documentation with Doxygen" VERBATIM | |
207 ) | |
208 endif(DOXYGEN_FOUND) |