comparison CMakeLists.txt @ 1:0f03a8a0bd6f

encoding of RT-STRUCT as STL
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 17 Jul 2023 18:54:31 +0200
parents 4e889a8e8be2
children c02d12eb34d4
comparison
equal deleted inserted replaced
0:4e889a8e8be2 1:0f03a8a0bd6f
17 # 17 #
18 # You should have received a copy of the GNU General Public License 18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>. 19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 20
21 21
22 cmake_minimum_required(VERSION 2.8) 22 # Native static compilation:
23 # $ cmake .. -DCMAKE_BUILD_TYPE=Debug -DSTATIC_BUILD=ON && make -j4
24
25 # LSB compilation:
26 # $ LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Release -DSTATIC_BUILD=ON -DUSE_LEGACY_JSONCPP=ON -DUSE_LEGACY_BOOST=ON -DCMAKE_TOOLCHAIN_FILE=${HOME}/Subversion/orthanc/OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake && make -j4
27
28 # MinGW compilation:
29 # $ cmake .. -DCMAKE_BUILD_TYPE=Release -DSTATIC_BUILD=ON -DUSE_LEGACY_JSONCPP=ON -DUSE_LEGACY_BOOST=ON -DCMAKE_TOOLCHAIN_FILE=${HOME}/Subversion/orthanc/OrthancFramework/Resources/Toolchains/MinGW-W64-Toolchain32.cmake && make -j4
30
31
32 # We request version 3.12 of CMake, as it is the first version to
33 # support "--parallel" in "cmake --build":
34 # https://cmake.org/cmake/help/latest/manual/cmake.1.html#build-a-project
35 cmake_minimum_required(VERSION 3.12)
23 project(OrthancSTL) 36 project(OrthancSTL)
24 37
25 set(ORTHANC_STL_VERSION "mainline") 38 set(ORTHANC_STL_VERSION "mainline")
26 39
27 if (ORTHANC_STL_VERSION STREQUAL "mainline") 40 if (ORTHANC_STL_VERSION STREQUAL "mainline")
45 set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"") 58 set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"")
46 set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"") 59 set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"")
47 60
48 # Advanced parameters to fine-tune linking against system libraries 61 # Advanced parameters to fine-tune linking against system libraries
49 SET(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK") 62 SET(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK")
63
64 # Parameters to fine-tune linking against system libraries
65 set(USE_SYSTEM_VTK ON CACHE BOOL "Use the system version of VTK")
50 66
51 67
52 ##################################################################### 68 #####################################################################
53 ## Download and setup the Orthanc framework 69 ## Download and setup the Orthanc framework
54 ##################################################################### 70 #####################################################################
70 link_libraries(${ORTHANC_FRAMEWORK_LIBRARIES}) 86 link_libraries(${ORTHANC_FRAMEWORK_LIBRARIES})
71 87
72 else() 88 else()
73 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkParameters.cmake) 89 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkParameters.cmake)
74 90
75 set(ENABLE_LOCALE OFF) # Disable support for locales (notably in Boost) 91 set(ENABLE_LOCALE ON)
76 set(ENABLE_ZLIB ON) 92 set(ENABLE_ZLIB ON)
77 93 set(ENABLE_DCMTK ON)
78 set(ENABLE_MODULE_DICOM OFF CACHE INTERNAL "") 94
79 set(ENABLE_MODULE_IMAGES OFF CACHE INTERNAL "")
80 set(ENABLE_MODULE_JOBS OFF CACHE INTERNAL "") 95 set(ENABLE_MODULE_JOBS OFF CACHE INTERNAL "")
81 96
82 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkConfiguration.cmake) 97 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkConfiguration.cmake)
83 include_directories(${ORTHANC_FRAMEWORK_ROOT}) 98 include_directories(${ORTHANC_FRAMEWORK_ROOT})
84 endif() 99 endif()
101 116
102 117
103 ##################################################################### 118 #####################################################################
104 ## Platform-specific configuration 119 ## Platform-specific configuration
105 ##################################################################### 120 #####################################################################
121
122 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibVtkConfiguration.cmake)
106 123
107 add_definitions( 124 add_definitions(
108 -DHAS_ORTHANC_EXCEPTION=1 125 -DHAS_ORTHANC_EXCEPTION=1
109 -DORTHANC_ENABLE_LOGGING_PLUGIN=1 126 -DORTHANC_ENABLE_LOGGING_PLUGIN=1
110 -DORTHANC_FRAMEWORK_BUILDING_PLUGIN=1 127 -DORTHANC_FRAMEWORK_BUILDING_PLUGIN=1
181 Sources/Plugin.cpp 198 Sources/Plugin.cpp
182 ${AUTOGENERATED_SOURCES} 199 ${AUTOGENERATED_SOURCES}
183 ${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp 200 ${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp
184 ${ORTHANC_CORE_SOURCES_DEPENDENCIES} 201 ${ORTHANC_CORE_SOURCES_DEPENDENCIES}
185 ${ORTHANC_CORE_SOURCES_INTERNAL} 202 ${ORTHANC_CORE_SOURCES_INTERNAL}
203 ${ORTHANC_DICOM_SOURCES_DEPENDENCIES}
204 ${ORTHANC_DICOM_SOURCES_INTERNAL}
186 ${ORTHANC_STL_SOURCES} 205 ${ORTHANC_STL_SOURCES}
187 ) 206 )
188 207
189 add_dependencies(OrthancSTL AutogeneratedTarget) 208 DefineSourceBasenameForTarget(OrthancSTL)
209
210 add_dependencies(OrthancSTL AutogeneratedTarget VTK)
190 211
191 message("Setting the version of the library to ${ORTHANC_STL_VERSION}") 212 message("Setting the version of the library to ${ORTHANC_STL_VERSION}")
192 213
193 set_target_properties(OrthancSTL PROPERTIES 214 set_target_properties(OrthancSTL PROPERTIES
194 VERSION ${ORTHANC_STL_VERSION} 215 VERSION ${ORTHANC_STL_VERSION}
195 SOVERSION ${ORTHANC_STL_VERSION}) 216 SOVERSION ${ORTHANC_STL_VERSION})
217
218 target_link_libraries(OrthancSTL ${DCMTK_LIBRARIES} ${VTK_LIBRARIES})
196 219
197 install( 220 install(
198 TARGETS OrthancSTL 221 TARGETS OrthancSTL
199 RUNTIME DESTINATION lib # Destination for Windows 222 RUNTIME DESTINATION lib # Destination for Windows
200 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux 223 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux