comparison CMakeLists.txt @ 26:a6492d20b2a8

modularization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 02 Jun 2015 11:40:05 +0200
parents 7a0af291cc90
children 4cfad290b808
comparison
equal deleted inserted replaced
25:15acbf5e7545 26:a6492d20b2a8
20 20
21 project(OrthancWebViewer) 21 project(OrthancWebViewer)
22 22
23 set(ORTHANC_WEBVIEWER_VERSION "1.0") 23 set(ORTHANC_WEBVIEWER_VERSION "1.0")
24 24
25
26 # Parameters of the build 25 # Parameters of the build
27 set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") 26 set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
28 SET(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)") 27 SET(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)")
29 set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages") 28 set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
30 29
40 39
41 # Distribution-specific settings 40 # Distribution-specific settings
42 set(USE_GTEST_DEBIAN_SOURCE_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)") 41 set(USE_GTEST_DEBIAN_SOURCE_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
43 mark_as_advanced(USE_GTEST_DEBIAN_SOURCE_PACKAGE) 42 mark_as_advanced(USE_GTEST_DEBIAN_SOURCE_PACKAGE)
44 43
44 set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR}/Orthanc)
45 include(CheckIncludeFiles) 45 include(CheckIncludeFiles)
46 include(CheckIncludeFileCXX) 46 include(CheckIncludeFileCXX)
47 include(CheckLibraryExists) 47 include(CheckLibraryExists)
48 include(FindPythonInterp) 48 include(FindPythonInterp)
49 include(${CMAKE_SOURCE_DIR}/Resources/CMake/Compiler.cmake) 49 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/Compiler.cmake)
50 include(${CMAKE_SOURCE_DIR}/Resources/CMake/AutoGeneratedCode.cmake) 50 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/AutoGeneratedCode.cmake)
51 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DownloadPackage.cmake) 51 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/DownloadPackage.cmake)
52 52
53 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake) 53 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/BoostConfiguration.cmake)
54 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/GoogleTestConfiguration.cmake)
55 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/JsonCppConfiguration.cmake)
56 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/LibPngConfiguration.cmake)
57 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/ZlibConfiguration.cmake)
58 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/SQLiteConfiguration.cmake)
59
54 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GdcmConfiguration.cmake) 60 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GdcmConfiguration.cmake)
55 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
56 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JsonCppConfiguration.cmake)
57 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibJpegConfiguration.cmake) 61 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibJpegConfiguration.cmake)
58 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibPngConfiguration.cmake)
59 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake)
60 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake)
61
62 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JavaScriptLibraries.cmake) 62 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JavaScriptLibraries.cmake)
63 63
64 64
65 # Check that the Orthanc SDK headers are available or download them 65 # Check that the Orthanc SDK headers are available or download them
66 if (STATIC_BUILD) 66 if (STATIC_BUILD)
103 103
104 add_definitions( 104 add_definitions(
105 -DORTHANC_SQLITE_STANDALONE=1 105 -DORTHANC_SQLITE_STANDALONE=1
106 ) 106 )
107 107
108
109 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
110 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
111 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
112 link_libraries(rt)
113 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
114 SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lws2_32")
115 endif()
116
117
108 set(CORE_SOURCES 118 set(CORE_SOURCES
109 ${BOOST_SOURCES} 119 ${BOOST_SOURCES}
110 ${JSONCPP_SOURCES} 120 ${THIRD_PARTY_SOURCES}
111 ${SQLITE_SOURCES} 121 ${SQLITE_SOURCES}
112 ${LIBJPEG_SOURCES} 122 ${LIBJPEG_SOURCES}
113 ${ZLIB_SOURCES} 123 ${ZLIB_SOURCES}
114 ${LIBPNG_SOURCES} 124 ${LIBPNG_SOURCES}
115 125
116 # Sources inherited from Orthanc core 126 # Sources inherited from Orthanc core
117 ${CMAKE_SOURCE_DIR}/Orthanc/ChunkedBuffer.cpp 127 ${CMAKE_SOURCE_DIR}/Orthanc/Core/ChunkedBuffer.cpp
118 ${CMAKE_SOURCE_DIR}/Orthanc/Enumerations.cpp 128 ${CMAKE_SOURCE_DIR}/Orthanc/Core/Enumerations.cpp
119 ${CMAKE_SOURCE_DIR}/Orthanc/FileStorage/FilesystemStorage.cpp 129 ${CMAKE_SOURCE_DIR}/Orthanc/Core/FileStorage/FilesystemStorage.cpp
120 ${CMAKE_SOURCE_DIR}/Orthanc/ImageFormats/ImageAccessor.cpp 130 ${CMAKE_SOURCE_DIR}/Orthanc/Core/ImageFormats/ImageAccessor.cpp
121 ${CMAKE_SOURCE_DIR}/Orthanc/ImageFormats/ImageBuffer.cpp 131 ${CMAKE_SOURCE_DIR}/Orthanc/Core/ImageFormats/ImageBuffer.cpp
122 ${CMAKE_SOURCE_DIR}/Orthanc/ImageFormats/ImageProcessing.cpp 132 ${CMAKE_SOURCE_DIR}/Orthanc/Core/ImageFormats/ImageProcessing.cpp
123 ${CMAKE_SOURCE_DIR}/Orthanc/ImageFormats/PngWriter.cpp 133 ${CMAKE_SOURCE_DIR}/Orthanc/Core/ImageFormats/PngWriter.cpp
124 ${CMAKE_SOURCE_DIR}/Orthanc/MultiThreading/SharedMessageQueue.cpp 134 ${CMAKE_SOURCE_DIR}/Orthanc/Core/MultiThreading/SharedMessageQueue.cpp
125 ${CMAKE_SOURCE_DIR}/Orthanc/OrthancException.cpp 135 ${CMAKE_SOURCE_DIR}/Orthanc/Core/OrthancException.cpp
126 ${CMAKE_SOURCE_DIR}/Orthanc/SQLite/Connection.cpp 136 ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/Connection.cpp
127 ${CMAKE_SOURCE_DIR}/Orthanc/SQLite/FunctionContext.cpp 137 ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/FunctionContext.cpp
128 ${CMAKE_SOURCE_DIR}/Orthanc/SQLite/Statement.cpp 138 ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/Statement.cpp
129 ${CMAKE_SOURCE_DIR}/Orthanc/SQLite/StatementId.cpp 139 ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/StatementId.cpp
130 ${CMAKE_SOURCE_DIR}/Orthanc/SQLite/StatementReference.cpp 140 ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/StatementReference.cpp
131 ${CMAKE_SOURCE_DIR}/Orthanc/SQLite/Transaction.cpp 141 ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/Transaction.cpp
132 ${CMAKE_SOURCE_DIR}/Orthanc/Toolbox.cpp 142 ${CMAKE_SOURCE_DIR}/Orthanc/Core/Toolbox.cpp
133 ${CMAKE_SOURCE_DIR}/Orthanc/Uuid.cpp 143 ${CMAKE_SOURCE_DIR}/Orthanc/Core/Uuid.cpp
134 ${CMAKE_SOURCE_DIR}/Resources/ThirdParty/base64/base64.cpp 144 ${CMAKE_SOURCE_DIR}/Orthanc/Resources/ThirdParty/base64/base64.cpp
135 ${CMAKE_SOURCE_DIR}/Resources/ThirdParty/md5/md5.c 145 ${CMAKE_SOURCE_DIR}/Orthanc/Resources/ThirdParty/md5/md5.c
136 146
137 ${CMAKE_SOURCE_DIR}/Plugin/Cache/CacheManager.cpp 147 ${CMAKE_SOURCE_DIR}/Plugin/Cache/CacheManager.cpp
138 ${CMAKE_SOURCE_DIR}/Plugin/Cache/CacheScheduler.cpp 148 ${CMAKE_SOURCE_DIR}/Plugin/Cache/CacheScheduler.cpp
139 ${CMAKE_SOURCE_DIR}/Plugin/JpegWriter.cpp 149 ${CMAKE_SOURCE_DIR}/Plugin/JpegWriter.cpp
140 ${CMAKE_SOURCE_DIR}/Plugin/ViewerToolbox.cpp 150 ${CMAKE_SOURCE_DIR}/Plugin/ViewerToolbox.cpp
154 # The following files depend on GDCM 164 # The following files depend on GDCM
155 ${CMAKE_SOURCE_DIR}/Plugin/ParsedDicomImage.cpp 165 ${CMAKE_SOURCE_DIR}/Plugin/ParsedDicomImage.cpp
156 ${CMAKE_SOURCE_DIR}/Plugin/DecodedImageAdapter.cpp 166 ${CMAKE_SOURCE_DIR}/Plugin/DecodedImageAdapter.cpp
157 ) 167 )
158 168
169
159 if (STATIC_BUILD OR NOT USE_SYSTEM_GDCM) 170 if (STATIC_BUILD OR NOT USE_SYSTEM_GDCM)
160 add_dependencies(OrthancWebViewer GDCM) 171 add_dependencies(OrthancWebViewer GDCM)
161 endif() 172 endif()
162 173
163 target_link_libraries(OrthancWebViewer ${GDCM_LIBRARIES} ${OS_LIBRARIES}) 174 target_link_libraries(OrthancWebViewer ${GDCM_LIBRARIES})
164 175
165 message("Setting the version of the library to ${ORTHANC_WEBVIEWER_VERSION}") 176 message("Setting the version of the library to ${ORTHANC_WEBVIEWER_VERSION}")
166 177
167 add_definitions(-DORTHANC_WEBVIEWER_VERSION="${ORTHANC_WEBVIEWER_VERSION}") 178 add_definitions(-DORTHANC_WEBVIEWER_VERSION="${ORTHANC_WEBVIEWER_VERSION}")
168 179
179 add_executable(UnitTests 190 add_executable(UnitTests
180 ${CORE_SOURCES} 191 ${CORE_SOURCES}
181 ${GTEST_SOURCES} 192 ${GTEST_SOURCES}
182 UnitTestsSources/UnitTestsMain.cpp 193 UnitTestsSources/UnitTestsMain.cpp
183 ) 194 )
184
185 target_link_libraries(UnitTests ${OS_LIBRARIES})