changeset 269:ca5400c24f93

fix docker builds
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 12 Aug 2025 11:16:54 +0200
parents dacb3c74e606
children bec4573379b0
files CMakeLists.txt CodeAnalysis/GenerateOrthancSDK.py Resources/Builders/Debian/docker-internal.sh
diffstat 3 files changed, 27 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Tue Aug 12 10:49:50 2025 +0200
+++ b/CMakeLists.txt	Tue Aug 12 11:16:54 2025 +0200
@@ -221,15 +221,22 @@
 
 add_custom_command(
   OUTPUT
-  ${AUTOGENERATED_DIR}/sdk/orthanc.pyi
+  ${CMAKE_CURRENT_BINARY_DIR}/orthanc.pyi
   ${AUTOGENERATED_DIR}/sdk/sdk.cpp
   ${AUTOGENERATED_DIR}/sdk/sdk.h
+
   COMMAND
   ${PYTHON_EXECUTABLE}
   ${CMAKE_SOURCE_DIR}/CodeAnalysis/GenerateOrthancSDK.py
   --sdk ${ORTHANC_SDK}
   --model ${ORTHANC_CODE_MODEL}
   --target ${AUTOGENERATED_DIR}/sdk/
+
+  COMMAND
+  ${CMAKE_COMMAND} -E copy
+  ${AUTOGENERATED_DIR}/sdk/orthanc.pyi
+  ${CMAKE_CURRENT_BINARY_DIR}/orthanc.pyi
+
   DEPENDS
   ${CMAKE_SOURCE_DIR}/CodeAnalysis/
   ${ORTHANC_SDK}
@@ -257,8 +264,10 @@
   )
 
 include_directories(
+  ${AUTOGENERATED_DIR}/sdk/
+  ${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/
+  ${CMAKE_SOURCE_DIR}/Sources/
   ${PYTHON_INCLUDE_DIRS}
-  ${AUTOGENERATED_DIR}/sdk/
   )
 
 add_library(OrthancPython SHARED
@@ -289,13 +298,14 @@
   )
 
 if (CMAKE_COMPILER_IS_GNUCXX)
+  # Don't report warnings about deprecated functions in the Orthanc SDK
   set_source_files_properties(
     ${AUTOGENERATED_DIR}/sdk/sdk.cpp
-    PROPERTIES
-    INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/Sources/;${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/"
+    COMPILE_FLAGS -Wno-deprecated-declarations)
+endif()
 
-    # Don't report warnings about deprecated functions in the Orthanc SDK
-    COMPILE_FLAGS -Wno-deprecated-declarations)
+if (COMMAND DefineSourceBasenameForTarget)
+  DefineSourceBasenameForTarget(OrthancPython)
 endif()
 
 add_dependencies(OrthancPython AutogeneratedTarget)
@@ -312,21 +322,13 @@
   SOVERSION ${PLUGIN_VERSION}
   )
 
-add_custom_command(TARGET OrthancPython
-  POST_BUILD
-  COMMAND
-  ${CMAKE_COMMAND} -E copy
-  ${AUTOGENERATED_DIR}/sdk/orthanc.pyi
-  ${CMAKE_CURRENT_BINARY_DIR}/orthanc.pyi
-  COMMENT "Copying the Python stub interface" VERBATIM
-  )
-
 install(
   TARGETS OrthancPython
   RUNTIME DESTINATION lib    # Destination for Windows
   LIBRARY DESTINATION share/orthanc/plugins    # Destination for Linux
   )
 
-if (COMMAND DefineSourceBasenameForTarget)
-  DefineSourceBasenameForTarget(OrthancPython)
-endif()
+install(
+  FILES ${CMAKE_CURRENT_BINARY_DIR}/orthanc.pyi
+  DESTINATION .
+  )
--- a/CodeAnalysis/GenerateOrthancSDK.py	Tue Aug 12 10:49:50 2025 +0200
+++ b/CodeAnalysis/GenerateOrthancSDK.py	Tue Aug 12 11:16:54 2025 +0200
@@ -62,7 +62,12 @@
 args = parser.parse_args()
 
 TARGET = os.path.realpath(args.target)
-os.makedirs(TARGET, exist_ok = True)
+
+try:
+    # "exist_ok = True" is not available on Python 2.7, which is still in use on our CIS for Ubuntu 16.04
+    os.makedirs(TARGET)
+except:
+    pass
 
 
 ##
--- a/Resources/Builders/Debian/docker-internal.sh	Tue Aug 12 10:49:50 2025 +0200
+++ b/Resources/Builders/Debian/docker-internal.sh	Tue Aug 12 11:16:54 2025 +0200
@@ -49,7 +49,7 @@
 fi
 
 apt-get update
-DEBIAN_FRONTEND=noninteractive apt-get -y install nano build-essential unzip cmake pkg-config libpython3-dev curl ${MERCURIAL_PACKAGES}
+DEBIAN_FRONTEND=noninteractive apt-get -y install nano build-essential unzip cmake pkg-config libpython3-dev curl python3-pystache ${MERCURIAL_PACKAGES}
 apt-get -y clean
 rm -rf /var/lib/apt/lists/*