0
|
1 cmake_minimum_required(VERSION 2.8)
|
|
2
|
|
3 project(Palantir)
|
|
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)")
|
|
9 SET(RELEASE_BUILD OFF CACHE BOOL "Release build")
|
|
10
|
|
11 if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
12 CHECK_INCLUDE_FILES(rpc.h HAVE_UUID_H)
|
|
13 else()
|
|
14 CHECK_INCLUDE_FILES(uuid/uuid.h HAVE_UUID_H)
|
|
15 endif()
|
|
16
|
|
17 if ("${HAVE_UUID_H}" STREQUAL "")
|
|
18 message(FATAL_ERROR "Please install the uuid-dev package")
|
|
19 endif()
|
|
20
|
|
21
|
|
22 SET(THIRD_PARTY_SOURCES)
|
|
23 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake)
|
|
24 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake)
|
|
25 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
|
|
26 include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake)
|
|
27 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake)
|
|
28 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake)
|
|
29 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JsonCppConfiguration.cmake)
|
|
30 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibCurlConfiguration.cmake)
|
|
31 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibPngConfiguration.cmake)
|
|
32
|
|
33
|
|
34 if (${CMAKE_COMPILER_IS_GNUCXX})
|
|
35 set(CMAKE_C_FLAGS "-Wall -pedantic -Wno-implicit-function-declaration") # --std=c99 makes libcurl not to compile
|
|
36 set(CMAKE_CXX_FLAGS "-Wall -pedantic -Wno-long-long -Wno-variadic-macros")
|
|
37 elseif (${MSVC})
|
8
|
38 add_definitions(
|
|
39 -D_CRT_SECURE_NO_WARNINGS=1
|
|
40 -D_CRT_SECURE_NO_DEPRECATE=1
|
|
41 )
|
|
42 include_directories(${CMAKE_SOURCE_DIR}/Resources/VisualStudio)
|
|
43 link_libraries(netapi32)
|
0
|
44 endif()
|
|
45
|
|
46
|
|
47 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
48 add_definitions(
|
|
49 -D_LARGEFILE64_SOURCE=1
|
|
50 -D_FILE_OFFSET_BITS=64
|
|
51 )
|
|
52 set(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
|
|
53 set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined")
|
|
54 set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
|
|
55
|
|
56 # http://www.mail-archive.com/cmake@cmake.org/msg08837.html
|
|
57 set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
|
58 link_libraries(uuid pthread rt)
|
|
59
|
|
60 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
61 add_definitions(
|
|
62 -DWINVER=0x0501
|
|
63 -D_CRT_SECURE_NO_WARNINGS=1
|
|
64 )
|
|
65 link_libraries(rpcrt4 ws2_32)
|
|
66 endif()
|
|
67
|
|
68
|
|
69 if (${STATIC_BUILD})
|
|
70 add_definitions(-DPALANTIR_STATIC=1)
|
|
71 else()
|
|
72 add_definitions(-DPALANTIR_STATIC=0)
|
|
73 endif()
|
|
74
|
|
75 if (${RELEASE_BUILD})
|
|
76 add_definitions(
|
|
77 -DPALANTIR_RELEASE=1
|
|
78 )
|
|
79
|
|
80 EmbedResources(
|
|
81 PREPARE_DATABASE PalantirServer/PrepareDatabase.sql
|
|
82 PALANTIR_EXPLORER PalantirExplorer
|
|
83 )
|
|
84
|
|
85 else()
|
|
86 add_definitions(
|
|
87 -DPALANTIR_RELEASE=0
|
|
88 -DPALANTIR_PATH=\"${CMAKE_SOURCE_DIR}\"
|
|
89 )
|
|
90
|
|
91 EmbedResources(
|
|
92 PREPARE_DATABASE PalantirServer/PrepareDatabase.sql
|
|
93 )
|
|
94 endif()
|
|
95
|
|
96
|
|
97 add_library(CoreLibrary
|
|
98 STATIC
|
|
99 ${AUTOGENERATED_SOURCES}
|
|
100 ${THIRD_PARTY_SOURCES}
|
|
101
|
|
102 Core/ChunkedBuffer.cpp
|
|
103 Core/Compression/BufferCompressor.cpp
|
|
104 Core/Compression/ZlibCompressor.cpp
|
|
105 Core/PalantirException.cpp
|
|
106 Core/DicomFormat/DicomArray.cpp
|
|
107 Core/DicomFormat/DicomMap.cpp
|
|
108 Core/DicomFormat/DicomTag.cpp
|
|
109 Core/FileStorage.cpp
|
|
110 Core/HttpServer/EmbeddedResourceHttpHandler.cpp
|
|
111 Core/HttpServer/FilesystemHttpHandler.cpp
|
|
112 Core/HttpServer/HttpHandler.cpp
|
|
113 Core/HttpServer/HttpOutput.cpp
|
|
114 Core/HttpServer/MongooseServer.cpp
|
|
115 Core/MultiThreading/BagOfRunnablesBySteps.cpp
|
|
116 Core/PngWriter.cpp
|
|
117 Core/SQLite/Connection.cpp
|
|
118 Core/SQLite/FunctionContext.cpp
|
|
119 Core/SQLite/Statement.cpp
|
|
120 Core/SQLite/StatementId.cpp
|
|
121 Core/SQLite/StatementReference.cpp
|
|
122 Core/SQLite/Transaction.cpp
|
|
123 Core/Toolbox.cpp
|
|
124 Core/Uuid.cpp
|
|
125
|
|
126 PalantirCppClient/HttpClient.cpp
|
|
127 PalantirCppClient/HttpException.cpp
|
|
128 )
|
|
129
|
|
130 add_library(ServerLibrary
|
|
131 PalantirServer/DicomIntegerPixelAccessor.cpp
|
|
132 PalantirServer/DicomProtocol/DicomFindAnswers.cpp
|
|
133 PalantirServer/DicomProtocol/DicomServer.cpp
|
|
134 PalantirServer/DicomProtocol/DicomUserConnection.cpp
|
|
135 PalantirServer/FromDcmtkBridge.cpp
|
|
136 PalantirServer/Internals/CommandDispatcher.cpp
|
|
137 PalantirServer/Internals/FindScp.cpp
|
|
138 PalantirServer/Internals/MoveScp.cpp
|
|
139 PalantirServer/Internals/StoreScp.cpp
|
|
140 PalantirServer/PalantirInitialization.cpp
|
|
141 PalantirServer/PalantirRestApi.cpp
|
|
142 PalantirServer/ServerIndex.cpp
|
|
143 PalantirServer/ToDcmtkBridge.cpp
|
|
144 PalantirServer/ToDcmtkBridge.cpp
|
|
145 PalantirServer/DicomIntegerPixelAccessor.cpp
|
|
146 )
|
|
147
|
|
148 add_executable(Palantir
|
|
149 PalantirServer/main.cpp
|
|
150 )
|
|
151
|
|
152 add_executable(UnitTests
|
|
153 ${GTEST_SOURCES}
|
|
154 UnitTests/main.cpp
|
|
155 UnitTests/SQLite.cpp
|
|
156 UnitTests/SQLiteChromium.cpp
|
|
157 UnitTests/Versions.cpp
|
|
158 )
|
|
159
|
|
160 TARGET_LINK_LIBRARIES(Palantir ServerLibrary CoreLibrary)
|
|
161 TARGET_LINK_LIBRARIES(UnitTests ServerLibrary CoreLibrary)
|
|
162
|
|
163
|
|
164 find_package(Doxygen)
|
|
165 if (DOXYGEN_FOUND)
|
|
166 configure_file(
|
|
167 ${CMAKE_SOURCE_DIR}/Resources/Palantir.doxygen
|
|
168 ${CMAKE_CURRENT_BINARY_DIR}/Palantir.doxygen
|
|
169 @ONLY)
|
|
170 add_custom_target(doc
|
|
171 ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Palantir.doxygen
|
|
172 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
173 COMMENT "Generating API documentation with Doxygen" VERBATIM
|
|
174 )
|
|
175 endif(DOXYGEN_FOUND)
|