comparison CMakeLists.txt @ 0:3959d33612cc

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 19 Jul 2012 14:32:22 +0200
parents
children 3a584803783e
comparison
equal deleted inserted replaced
-1:000000000000 0:3959d33612cc
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})
38 add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
39 endif()
40
41
42 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
43 add_definitions(
44 -D_LARGEFILE64_SOURCE=1
45 -D_FILE_OFFSET_BITS=64
46 )
47 set(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
48 set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined")
49 set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
50
51 # http://www.mail-archive.com/cmake@cmake.org/msg08837.html
52 set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
53 link_libraries(uuid pthread rt)
54
55 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
56 add_definitions(
57 -DWINVER=0x0501
58 -D_CRT_SECURE_NO_WARNINGS=1
59 )
60 link_libraries(rpcrt4 ws2_32)
61 endif()
62
63
64 if (${STATIC_BUILD})
65 add_definitions(-DPALANTIR_STATIC=1)
66 else()
67 add_definitions(-DPALANTIR_STATIC=0)
68 endif()
69
70 if (${RELEASE_BUILD})
71 add_definitions(
72 -DPALANTIR_RELEASE=1
73 )
74
75 EmbedResources(
76 PREPARE_DATABASE PalantirServer/PrepareDatabase.sql
77 PALANTIR_EXPLORER PalantirExplorer
78 )
79
80 else()
81 add_definitions(
82 -DPALANTIR_RELEASE=0
83 -DPALANTIR_PATH=\"${CMAKE_SOURCE_DIR}\"
84 )
85
86 EmbedResources(
87 PREPARE_DATABASE PalantirServer/PrepareDatabase.sql
88 )
89 endif()
90
91
92 add_library(CoreLibrary
93 STATIC
94 ${AUTOGENERATED_SOURCES}
95 ${THIRD_PARTY_SOURCES}
96
97 Core/ChunkedBuffer.cpp
98 Core/Compression/BufferCompressor.cpp
99 Core/Compression/ZlibCompressor.cpp
100 Core/PalantirException.cpp
101 Core/DicomFormat/DicomArray.cpp
102 Core/DicomFormat/DicomMap.cpp
103 Core/DicomFormat/DicomTag.cpp
104 Core/FileStorage.cpp
105 Core/HttpServer/EmbeddedResourceHttpHandler.cpp
106 Core/HttpServer/FilesystemHttpHandler.cpp
107 Core/HttpServer/HttpHandler.cpp
108 Core/HttpServer/HttpOutput.cpp
109 Core/HttpServer/MongooseServer.cpp
110 Core/MultiThreading/BagOfRunnablesBySteps.cpp
111 Core/PngWriter.cpp
112 Core/SQLite/Connection.cpp
113 Core/SQLite/FunctionContext.cpp
114 Core/SQLite/Statement.cpp
115 Core/SQLite/StatementId.cpp
116 Core/SQLite/StatementReference.cpp
117 Core/SQLite/Transaction.cpp
118 Core/Toolbox.cpp
119 Core/Uuid.cpp
120
121 PalantirCppClient/HttpClient.cpp
122 PalantirCppClient/HttpException.cpp
123 )
124
125 add_library(ServerLibrary
126 PalantirServer/DicomIntegerPixelAccessor.cpp
127 PalantirServer/DicomProtocol/DicomFindAnswers.cpp
128 PalantirServer/DicomProtocol/DicomServer.cpp
129 PalantirServer/DicomProtocol/DicomUserConnection.cpp
130 PalantirServer/FromDcmtkBridge.cpp
131 PalantirServer/Internals/CommandDispatcher.cpp
132 PalantirServer/Internals/FindScp.cpp
133 PalantirServer/Internals/MoveScp.cpp
134 PalantirServer/Internals/StoreScp.cpp
135 PalantirServer/PalantirInitialization.cpp
136 PalantirServer/PalantirRestApi.cpp
137 PalantirServer/ServerIndex.cpp
138 PalantirServer/ToDcmtkBridge.cpp
139 PalantirServer/ToDcmtkBridge.cpp
140 PalantirServer/DicomIntegerPixelAccessor.cpp
141 )
142
143 add_executable(Palantir
144 PalantirServer/main.cpp
145 )
146
147 add_executable(UnitTests
148 ${GTEST_SOURCES}
149 UnitTests/main.cpp
150 UnitTests/SQLite.cpp
151 UnitTests/SQLiteChromium.cpp
152 UnitTests/Versions.cpp
153 )
154
155 TARGET_LINK_LIBRARIES(Palantir ServerLibrary CoreLibrary)
156 TARGET_LINK_LIBRARIES(UnitTests ServerLibrary CoreLibrary)
157
158
159 find_package(Doxygen)
160 if (DOXYGEN_FOUND)
161 configure_file(
162 ${CMAKE_SOURCE_DIR}/Resources/Palantir.doxygen
163 ${CMAKE_CURRENT_BINARY_DIR}/Palantir.doxygen
164 @ONLY)
165 add_custom_target(doc
166 ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Palantir.doxygen
167 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
168 COMMENT "Generating API documentation with Doxygen" VERBATIM
169 )
170 endif(DOXYGEN_FOUND)