diff CMakeLists.txt @ 62:b798387b085c

added 3DHOP viewer version 4.3
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 15 Jun 2024 16:08:52 +0200
parents 5dc3f3dcc092
children 5e11f5880e6d
line wrap: on
line diff
--- a/CMakeLists.txt	Wed May 22 15:35:07 2024 +0200
+++ b/CMakeLists.txt	Sat Jun 15 16:08:52 2024 +0200
@@ -61,6 +61,9 @@
 # New in release 1.1
 set(ENABLE_NEXUS ON CACHE BOOL "Include support for Nexus 3D models")
 
+# New in release 1.2
+set(ENABLE_3DHOP ON CACHE BOOL "Include support for 3DHOP viewer")
+
 # 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")
 
@@ -171,17 +174,28 @@
 ## Create the autogenerated files
 #####################################################################
 
+if (ENABLE_3DHOP AND NOT
+    ENABLE_NEXUS)
+  message(FATAL_ERROR "3DHOP necessitates Nexus support")
+endif()
+
 set(EMBEDDED_RESOURCES
+  ORTHANC_EXPLORER   ${CMAKE_SOURCE_DIR}/Sources/OrthancExplorer.js
+
+  # These resources correspond to the "Basic viewer built using Three.js"
   THREE_HTML         ${CMAKE_SOURCE_DIR}/WebApplications/three.html
   THREE_JS           ${CMAKE_SOURCE_DIR}/WebApplications/three.js
+
+  # These resources correspond to Online3DViewer
   O3DV_HTML          ${CMAKE_SOURCE_DIR}/WebApplications/o3dv.html
   O3DV_JS            ${CMAKE_SOURCE_DIR}/WebApplications/o3dv.js
-  ORTHANC_EXPLORER   ${CMAKE_SOURCE_DIR}/Sources/OrthancExplorer.js
   )
 
-set(STATIC_ASSETS
-  ${CMAKE_SOURCE_DIR}/JavaScriptLibraries/dist
-  )
+set(STATIC_ASSETS_PREFIXES "o3dv")
+set(STATIC_ASSETS_CONTENT  "${CMAKE_SOURCE_DIR}/JavaScriptLibraries/dist-o3dv")
+
+list(APPEND STATIC_ASSETS_PREFIXES "basic-viewer")
+list(APPEND STATIC_ASSETS_CONTENT  "${CMAKE_SOURCE_DIR}/JavaScriptLibraries/dist-three")
 
 if (ENABLE_NEXUS)
   set(NEXUS_ASSETS_DIR ${AUTOGENERATED_DIR}/nexus)
@@ -192,6 +206,11 @@
     "https://orthanc.uclouvain.be/downloads/third-party-downloads/STL/three-84.js.gz"
     "${NEXUS_ASSETS_DIR}/three-84.js")
 
+  list(APPEND STATIC_ASSETS_PREFIXES "nexus")
+  list(APPEND STATIC_ASSETS_CONTENT
+    ${NEXUS_ASSETS_DIR}   # This adds "three-84.js" that is needed by the Nexus viewer
+    )
+
   list(APPEND EMBEDDED_RESOURCES
     NEXUS_HTML           ${CMAKE_SOURCE_DIR}/Resources/Nexus/threejs.html
     NEXUS_JS             ${CMAKE_SOURCE_DIR}/Resources/Nexus/js/nexus.js
@@ -200,13 +219,19 @@
     NEXUS_TRACKBALL_JS   ${CMAKE_SOURCE_DIR}/Resources/Nexus/js/TrackballControls.js
     )
 
-  list(APPEND STATIC_ASSETS
-    ${NEXUS_ASSETS_DIR}
-    )
+  add_definitions(-DORTHANC_ENABLE_NEXUS=1)
 
-  add_definitions(-DORTHANC_ENABLE_NEXUS=1)
+  if (ENABLE_3DHOP)
+    include(${CMAKE_SOURCE_DIR}/Resources/CMake/3DHOP.cmake)
+    add_definitions(-DORTHANC_ENABLE_3DHOP=1)
+  else()
+    add_definitions(-DORTHANC_ENABLE_3DHOP=0)
+  endif()
 else()
-  add_definitions(-DORTHANC_ENABLE_NEXUS=0)
+  add_definitions(
+    -DORTHANC_ENABLE_NEXUS=0
+    -DORTHANC_ENABLE_3DHOP=0
+    )
 endif()
 
 EmbedResources(${EMBEDDED_RESOURCES})
@@ -218,10 +243,11 @@
   ${PYTHON_EXECUTABLE}
   ${CMAKE_SOURCE_DIR}/Resources/EmbedStaticAssets.py
   ${AUTOGENERATED_DIR}/StaticAssets.cpp
-  ${STATIC_ASSETS}
+  ${STATIC_ASSETS_PREFIXES}
+  ${STATIC_ASSETS_CONTENT}
   DEPENDS
   ${CMAKE_SOURCE_DIR}/Resources/EmbedStaticAssets.py
-  ${STATIC_ASSETS}
+  ${STATIC_ASSETS_CONTENT}
   )
 
 list(APPEND AUTOGENERATED_SOURCES