comparison CMakeLists.txt @ 191:993dd140bd30

Resort to Orthanc framework
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 16 Apr 2018 21:29:30 +0200
parents 3f62dac67971
children 20636b255424
comparison
equal deleted inserted replaced
190:7151dbac8d5e 191:993dd140bd30
27 set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") 27 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)") 28 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") 29 set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
30 30
31 # Advanced parameters to fine-tune linking against system libraries 31 # Advanced parameters to fine-tune linking against system libraries
32 set(USE_SYSTEM_BOOST ON CACHE BOOL "Use the system version of Boost")
33 set(USE_SYSTEM_GDCM ON CACHE BOOL "Use the system version of Grassroot DICOM (GDCM)") 32 set(USE_SYSTEM_GDCM ON CACHE BOOL "Use the system version of Grassroot DICOM (GDCM)")
34 set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")
35 set(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp")
36 set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK") 33 set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK")
37 set(USE_SYSTEM_SQLITE ON CACHE BOOL "Use the system version of SQLite")
38 set(USE_SYSTEM_UUID ON CACHE BOOL "Use the system version of the uuid library from e2fsprogs")
39 34
40 # Distribution-specific settings 35 # Download the Orthanc framework
41 set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)") 36 if (ORTHANC_WEBVIEWER_VERSION STREQUAL "mainline")
42 mark_as_advanced(USE_GOOGLE_TEST_DEBIAN_PACKAGE) 37 set(ORTHANC_FRAMEWORK_SOURCE "hg")
43 38 set(ORTHANC_FRAMEWORK_VERSION "mainline")
44 set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR}/Orthanc) 39 else()
45 set(ENABLE_LOCALE OFF) # Disable support for locales (notably in Boost) 40 set(ORTHANC_FRAMEWORK_SOURCE "web")
46 41 set(ORTHANC_FRAMEWORK_VERSION "1.3.1")
47 if (NOT "${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
48 # The "patch" command-line tool is only needed for Boost and LSB
49 set(ORTHANC_DISABLE_PATCH ON)
50 endif() 42 endif()
51 43
52 include(CheckIncludeFile) 44 include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/DownloadOrthancFramework.cmake)
53 include(CheckIncludeFiles)
54 include(CheckIncludeFileCXX)
55 include(CheckLibraryExists)
56 include(FindPythonInterp)
57 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/Compiler.cmake)
58 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/AutoGeneratedCode.cmake)
59 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/DownloadPackage.cmake)
60 45
61 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/BoostConfiguration.cmake) 46
62 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/GoogleTestConfiguration.cmake) 47 # Initialize the Orthanc framework
63 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/JsonCppConfiguration.cmake) 48 include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
64 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/SQLiteConfiguration.cmake) 49
65 include(${CMAKE_SOURCE_DIR}/Orthanc/Resources/CMake/UuidConfiguration.cmake) 50 set(ENABLE_LOCALE OFF) # Disable support for locales (notably in Boost)
51 set(ENABLE_GOOGLE_TEST ON)
52 set(ENABLE_SQLITE ON)
53
54 include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
55 include_directories(${ORTHANC_ROOT})
56
66 57
67 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GdcmConfiguration.cmake) 58 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GdcmConfiguration.cmake)
68 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JavaScriptLibraries.cmake) 59 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JavaScriptLibraries.cmake)
69 60
70 61
71 # Check that the Orthanc SDK headers are available 62 # Check that the Orthanc SDK headers are available
72 if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK) 63 if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK)
73 include_directories(${ORTHANC_ROOT}/Sdk-0.9.5) 64 include_directories(${CMAKE_SOURCE_DIR}/Resources/Orthanc/Sdk-0.9.5)
74 else () 65 else ()
75 CHECK_INCLUDE_FILE_CXX(orthanc/OrthancCPlugin.h HAVE_ORTHANC_H) 66 CHECK_INCLUDE_FILE_CXX(orthanc/OrthancCPlugin.h HAVE_ORTHANC_H)
76 if (NOT HAVE_ORTHANC_H) 67 if (NOT HAVE_ORTHANC_H)
77 message(FATAL_ERROR "Please install the headers of the Orthanc plugins SDK") 68 message(FATAL_ERROR "Please install the headers of the Orthanc plugins SDK")
78 endif() 69 endif()
96 EmbedResources( 87 EmbedResources(
97 ORTHANC_EXPLORER ${CMAKE_SOURCE_DIR}/Resources/OrthancExplorer.js 88 ORTHANC_EXPLORER ${CMAKE_SOURCE_DIR}/Resources/OrthancExplorer.js
98 JAVASCRIPT_LIBS ${JAVASCRIPT_LIBS_DIR} 89 JAVASCRIPT_LIBS ${JAVASCRIPT_LIBS_DIR}
99 ${EMBEDDED_RESOURCES} 90 ${EMBEDDED_RESOURCES}
100 ) 91 )
101
102 add_definitions(
103 -DORTHANC_DEFAULT_DICOM_ENCODING=Encoding_Latin1
104 -DORTHANC_ENABLE_LOCALE=0
105 -DORTHANC_ENABLE_PUGIXML=0
106 -DORTHANC_ENABLE_SQLITE=1
107 -DORTHANC_SQLITE_STANDALONE=1
108 )
109
110 92
111 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR 93 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
112 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR 94 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
113 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") 95 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
114 link_libraries(rt) 96 link_libraries(rt)
134 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework CoreFoundation") 116 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework CoreFoundation")
135 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -framework CoreFoundation") 117 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -framework CoreFoundation")
136 endif() 118 endif()
137 119
138 add_definitions( 120 add_definitions(
139 -DORTHANC_ENABLE_MD5=0
140 -DORTHANC_ENABLE_BASE64=0
141 -DORTHANC_ENABLE_LOGGING=0
142 -DORTHANC_SANDBOXED=0 121 -DORTHANC_SANDBOXED=0
143 ) 122 )
144 123
145 set(CORE_SOURCES 124 set(CORE_SOURCES
146 ${BOOST_SOURCES}
147 ${JSONCPP_SOURCES}
148 ${SQLITE_SOURCES}
149 ${UUID_SOURCES}
150
151 # Sources inherited from Orthanc core
152 ${CMAKE_SOURCE_DIR}/Orthanc/Core/ChunkedBuffer.cpp
153 ${CMAKE_SOURCE_DIR}/Orthanc/Core/Enumerations.cpp
154 ${CMAKE_SOURCE_DIR}/Orthanc/Core/FileStorage/FilesystemStorage.cpp
155 ${CMAKE_SOURCE_DIR}/Orthanc/Core/Images/ImageAccessor.cpp
156 ${CMAKE_SOURCE_DIR}/Orthanc/Core/Images/ImageBuffer.cpp
157 ${CMAKE_SOURCE_DIR}/Orthanc/Core/Images/ImageProcessing.cpp
158 ${CMAKE_SOURCE_DIR}/Orthanc/Core/MultiThreading/SharedMessageQueue.cpp
159 ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/Connection.cpp
160 ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/FunctionContext.cpp
161 ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/Statement.cpp
162 ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/StatementId.cpp
163 ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/StatementReference.cpp
164 ${CMAKE_SOURCE_DIR}/Orthanc/Core/SQLite/Transaction.cpp
165 ${CMAKE_SOURCE_DIR}/Orthanc/Core/SystemToolbox.cpp
166 ${CMAKE_SOURCE_DIR}/Orthanc/Core/Toolbox.cpp
167 ${CMAKE_SOURCE_DIR}/Orthanc/Core/DicomFormat/DicomMap.cpp
168 ${CMAKE_SOURCE_DIR}/Orthanc/Core/DicomFormat/DicomTag.cpp
169 ${CMAKE_SOURCE_DIR}/Orthanc/Core/DicomFormat/DicomValue.cpp
170 ${CMAKE_SOURCE_DIR}/Orthanc/Resources/ThirdParty/base64/base64.cpp
171
172 ${CMAKE_SOURCE_DIR}/Plugin/Cache/CacheManager.cpp 125 ${CMAKE_SOURCE_DIR}/Plugin/Cache/CacheManager.cpp
173 ${CMAKE_SOURCE_DIR}/Plugin/Cache/CacheScheduler.cpp 126 ${CMAKE_SOURCE_DIR}/Plugin/Cache/CacheScheduler.cpp
174 ${CMAKE_SOURCE_DIR}/Plugin/ViewerToolbox.cpp 127 ${CMAKE_SOURCE_DIR}/Plugin/ViewerToolbox.cpp
175 ${CMAKE_SOURCE_DIR}/Plugin/ViewerPrefetchPolicy.cpp 128 ${CMAKE_SOURCE_DIR}/Plugin/ViewerPrefetchPolicy.cpp
176 ${CMAKE_SOURCE_DIR}/Plugin/SeriesInformationAdapter.cpp 129 ${CMAKE_SOURCE_DIR}/Plugin/SeriesInformationAdapter.cpp
130
131 ${ORTHANC_CORE_SOURCES}
177 ) 132 )
178 133
179 add_library(OrthancWebViewer 134 add_library(OrthancWebViewer
180 SHARED 135 SHARED
181 ${CORE_SOURCES} 136 ${CORE_SOURCES}
182 ${AUTOGENERATED_SOURCES} 137 ${AUTOGENERATED_SOURCES}
183 ${CMAKE_SOURCE_DIR}/Plugin/Plugin.cpp 138 ${CMAKE_SOURCE_DIR}/Plugin/Plugin.cpp
184 139
185 # The following files depend on GDCM 140 # The following files depend on GDCM
186 ${CMAKE_SOURCE_DIR}/Plugin/DecodedImageAdapter.cpp 141 ${CMAKE_SOURCE_DIR}/Plugin/DecodedImageAdapter.cpp
187 ${CMAKE_SOURCE_DIR}/Orthanc/Plugins/Samples/GdcmDecoder/GdcmImageDecoder.cpp 142 ${ORTHANC_ROOT}/Plugins/Samples/GdcmDecoder/GdcmImageDecoder.cpp
188 ${CMAKE_SOURCE_DIR}/Orthanc/Plugins/Samples/GdcmDecoder/GdcmDecoderCache.cpp 143 ${ORTHANC_ROOT}/Plugins/Samples/GdcmDecoder/GdcmDecoderCache.cpp
189 ${CMAKE_SOURCE_DIR}/Orthanc/Plugins/Samples/GdcmDecoder/OrthancImageWrapper.cpp 144 ${ORTHANC_ROOT}/Plugins/Samples/GdcmDecoder/OrthancImageWrapper.cpp
190 ) 145 )
191 146
192 147
193 if (STATIC_BUILD OR NOT USE_SYSTEM_GDCM) 148 if (STATIC_BUILD OR NOT USE_SYSTEM_GDCM)
194 add_dependencies(OrthancWebViewer GDCM) 149 add_dependencies(OrthancWebViewer GDCM)
211 ) 166 )
212 167
213 add_executable(UnitTests 168 add_executable(UnitTests
214 ${CORE_SOURCES} 169 ${CORE_SOURCES}
215 ${GOOGLE_TEST_SOURCES} 170 ${GOOGLE_TEST_SOURCES}
216 ${JSONCPP_SOURCES}
217 UnitTestsSources/UnitTestsMain.cpp 171 UnitTestsSources/UnitTestsMain.cpp
218 ) 172 )
219 173
220 target_link_libraries(UnitTests ${GOOGLE_TEST_LIBRARIES}) 174 target_link_libraries(UnitTests ${GOOGLE_TEST_LIBRARIES})