diff 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
line wrap: on
line diff
--- a/CMakeLists.txt	Tue Jul 04 19:15:27 2023 +0200
+++ b/CMakeLists.txt	Mon Jul 17 18:54:31 2023 +0200
@@ -19,7 +19,20 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-cmake_minimum_required(VERSION 2.8)
+# Native static compilation:
+#   $ cmake .. -DCMAKE_BUILD_TYPE=Debug -DSTATIC_BUILD=ON && make -j4
+
+# LSB compilation:
+#   $ 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
+
+# MinGW compilation:
+#   $ 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
+
+
+# We request version 3.12 of CMake, as it is the first version to
+# support "--parallel" in "cmake --build":
+# https://cmake.org/cmake/help/latest/manual/cmake.1.html#build-a-project
+cmake_minimum_required(VERSION 3.12)
 project(OrthancSTL)
 
 set(ORTHANC_STL_VERSION "mainline")
@@ -48,6 +61,9 @@
 # Advanced parameters to fine-tune linking against system libraries
 SET(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK")
 
+# Parameters to fine-tune linking against system libraries
+set(USE_SYSTEM_VTK ON CACHE BOOL "Use the system version of VTK")
+
 
 #####################################################################
 ## Download and setup the Orthanc framework
@@ -72,11 +88,10 @@
 else()
   include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkParameters.cmake)
 
-  set(ENABLE_LOCALE OFF)         # Disable support for locales (notably in Boost)
+  set(ENABLE_LOCALE ON)
   set(ENABLE_ZLIB ON)
+  set(ENABLE_DCMTK ON)
 
-  set(ENABLE_MODULE_DICOM OFF CACHE INTERNAL "")
-  set(ENABLE_MODULE_IMAGES OFF CACHE INTERNAL "")
   set(ENABLE_MODULE_JOBS OFF CACHE INTERNAL "")
 
   include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkConfiguration.cmake)
@@ -104,6 +119,8 @@
 ## Platform-specific configuration
 #####################################################################
 
+include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibVtkConfiguration.cmake)
+
 add_definitions(
   -DHAS_ORTHANC_EXCEPTION=1
   -DORTHANC_ENABLE_LOGGING_PLUGIN=1
@@ -183,10 +200,14 @@
   ${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp
   ${ORTHANC_CORE_SOURCES_DEPENDENCIES}
   ${ORTHANC_CORE_SOURCES_INTERNAL}
+  ${ORTHANC_DICOM_SOURCES_DEPENDENCIES}
+  ${ORTHANC_DICOM_SOURCES_INTERNAL}
   ${ORTHANC_STL_SOURCES}
   )
 
-add_dependencies(OrthancSTL AutogeneratedTarget)
+DefineSourceBasenameForTarget(OrthancSTL)
+
+add_dependencies(OrthancSTL AutogeneratedTarget VTK)
 
 message("Setting the version of the library to ${ORTHANC_STL_VERSION}")
 
@@ -194,6 +215,8 @@
   VERSION ${ORTHANC_STL_VERSION} 
   SOVERSION ${ORTHANC_STL_VERSION})
 
+target_link_libraries(OrthancSTL ${DCMTK_LIBRARIES} ${VTK_LIBRARIES})
+
 install(
   TARGETS OrthancSTL
   RUNTIME DESTINATION lib    # Destination for Windows