annotate CMakeLists.txt @ 167:ae69e641e95f OrthancPython-4.1

closing OrthancPython-4.1
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 May 2024 22:28:35 +0200
parents 69c9e376b73e
children 286368f6f019
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 cmake_minimum_required(VERSION 2.8)
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 project(OrthancPython)
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3
135
69c9e376b73e OrthancPython-4.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
4 set(PLUGIN_VERSION "4.1")
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
6 if (PLUGIN_VERSION STREQUAL "mainline")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
7 set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "mainline")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
8 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
9 else()
135
69c9e376b73e OrthancPython-4.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
10 set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.12.1")
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
11 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
12 endif()
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
13
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
15 if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
16 # The Python version cannot be controlled on OS X (yet)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
17 set(PYTHON_VERSION "3.6" CACHE STRING "Version of Python to be used")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
18 endif()
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
19
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
20 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
21 # Windows-specific options
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
22 set(PYTHON_WINDOWS_ROOT "" CACHE STRING "")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
23 set(PYTHON_LIBRARY_NAME "" CACHE STRING "")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
24 set(PYTHON_WINDOWS_USE_RELEASE_LIBS ON CACHE BOOL "Use the release Python libraries when building with Microsoft Visual Studio, even when compiling in _DEBUG mode (set it to OFF if you require linking to a Python debug build)")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
25 endif()
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
26
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
27
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
28
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
29 # Parameters of the build
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
30 set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
31 set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
32 set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc framework (can be \"system\", \"hg\", \"archive\", \"web\" or \"path\")")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
33 set(ORTHANC_FRAMEWORK_VERSION "${ORTHANC_FRAMEWORK_DEFAULT_VERSION}" CACHE STRING "Version of the Orthanc framework")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
34 set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
35 set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"")
100
e2b2e1d4e1bb fixed compatibility with Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
36 set(USE_FRAMEWORK_ORTHANC_SDK OFF CACHE BOOL "Whether to use the SDK from the Orthanc sources (for developers only, to support new features of the SDK that are still pending in the mainline)")
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
37
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
38 # Advanced parameters to fine-tune linking against system libraries
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
39 set(ORTHANC_FRAMEWORK_STATIC OFF CACHE BOOL "If linking against the Orthanc framework system library, indicates whether this library was statically linked")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
40 mark_as_advanced(ORTHANC_FRAMEWORK_STATIC)
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
41
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
42
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
43 # Download and setup the Orthanc framework
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
44 include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake)
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
45
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
46 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
73
da73be4b361b no more need of "-DORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES" to link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 72
diff changeset
47 include(FindBoost)
da73be4b361b no more need of "-DORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES" to link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 72
diff changeset
48 find_package(Boost COMPONENTS filesystem regex thread)
da73be4b361b no more need of "-DORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES" to link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 72
diff changeset
49
da73be4b361b no more need of "-DORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES" to link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 72
diff changeset
50 if (NOT Boost_FOUND)
da73be4b361b no more need of "-DORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES" to link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 72
diff changeset
51 message(FATAL_ERROR "Unable to locate Boost on this system")
70
c10386bee2e3 fix link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
52 endif()
73
da73be4b361b no more need of "-DORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES" to link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 72
diff changeset
53
da73be4b361b no more need of "-DORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES" to link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 72
diff changeset
54 link_libraries(${Boost_LIBRARIES} jsoncpp)
da73be4b361b no more need of "-DORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES" to link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 72
diff changeset
55
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
56 else()
46
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 44
diff changeset
57 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkParameters.cmake)
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
58
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
59 #set(ENABLE_MODULE_IMAGES OFF CACHE INTERNAL "")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
60 #set(ENABLE_MODULE_JOBS OFF CACHE INTERNAL "")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
61 #set(ENABLE_MODULE_DICOM OFF CACHE INTERNAL "")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
62
46
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 44
diff changeset
63 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkConfiguration.cmake)
74
5217f6f8a8cf improved CMakeLists.txt
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 73
diff changeset
64 include_directories(${ORTHANC_FRAMEWORK_ROOT})
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
65 endif()
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
66
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
67
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
68 include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake)
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
69
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 include(CheckIncludeFile)
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 include(CheckIncludeFileCXX)
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 include(CheckIncludeFiles)
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 include(CheckLibraryExists)
16
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
75 include(FindPythonInterp)
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
77
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
78 if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
79 find_package(PythonLibs)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
80 if (NOT PYTHONLIBS_FOUND)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
81 message(FATAL_ERROR "Cannot find the Python libraries")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
82 endif()
21
67f48fc2fd69 fix linking with Python on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 17
diff changeset
83
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
84 message("Python library - Found version: ${PYTHONLIBS_VERSION_STRING}")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
85 message("Python library - Path to include directory: ${PYTHON_INCLUDE_DIRS}")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
86 message("Python library - Shared library: ${PYTHON_LIBRARIES}")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
87
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
88 else()
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
89 string(REGEX REPLACE "^([0-9]*)\\.([0-9]*)$" "\\1" PYTHON_VERSION_MAJOR ${PYTHON_VERSION})
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
90 string(REGEX REPLACE "^([0-9]*)\\.([0-9]*)$" "\\2" PYTHON_VERSION_MINOR ${PYTHON_VERSION})
21
67f48fc2fd69 fix linking with Python on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 17
diff changeset
91
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
92 if (NOT PYTHON_VERSION STREQUAL
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
93 "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
94 message(FATAL_ERROR "Error in the (x.y) format of the Python version: ${PYTHON_VERSION}")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
95 endif()
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
96
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
97 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
98 if ("${PYTHON_LIBRARY_NAME}" STREQUAL "")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
99 if (MSVC)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
100 set(Prefix "")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
101 set(Suffix ".lib")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
102 if(PYTHON_WINDOWS_USE_RELEASE_LIBS)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
103 add_definitions(-DORTHANC_PYTHON_WINDOWS_USE_RELEASE_LIBS=1)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
104 endif()
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
105 else()
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
106 list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
107 set(Suffix ".a")
33
ce5b6116e6cd New builders for Windows: Supporting 32 / 64bit with Python 2.7 / 3.7 / 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
108 endif()
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
109
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
110 set(PYTHON_LIBRARY_NAME ${Prefix}python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}${Suffix})
26
b0d1308280d8 Added the PYTHON_WINDOWS_USE_RELEASE_LIBS CMake option
Benjamin Golinvaux <bgo@osimis.io>
parents: 25
diff changeset
111 endif()
33
ce5b6116e6cd New builders for Windows: Supporting 32 / 64bit with Python 2.7 / 3.7 / 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
112
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
113 if (CMAKE_COMPILER_IS_GNUCXX AND
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
114 "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8" AND
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
115 "${PYTHON_VERSION}" STREQUAL "2.7")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
116 # Fix for MinGW 64bit: https://stackoverflow.com/a/19867426/881731
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
117 add_definitions(-DMS_WIN64)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
118 endif()
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
119
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
120 set(PYTHON_INCLUDE_DIRS ${PYTHON_WINDOWS_ROOT}/include)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
121 set(PYTHON_LIBRARIES ${PYTHON_WINDOWS_ROOT}/libs/${PYTHON_LIBRARY_NAME})
33
ce5b6116e6cd New builders for Windows: Supporting 32 / 64bit with Python 2.7 / 3.7 / 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
122
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
123 execute_process(
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
124 COMMAND
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
125 ${PYTHON_EXECUTABLE} ${ORTHANC_FRAMEWORK_ROOT}/../Resources/WindowsResources.py
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
126 ${PLUGIN_VERSION} "Python plugin" OrthancPython.dll
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
127 "Plugin to create Orthanc plugins using Python"
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
128 ERROR_VARIABLE Failure
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
129 OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/Version.rc
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
130 )
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
132 if (Failure)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
133 message(FATAL_ERROR "Error while computing the version information: ${Failure}")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
134 endif()
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
135
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
136 set(WINDOWS_RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/Version.rc)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
137
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 else()
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
139 find_package(PkgConfig REQUIRED)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
140 pkg_check_modules(PYTHON_1 python-${PYTHON_VERSION}-embed)
16
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
141
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
142 if (PYTHON_1_FOUND)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
143 set(PYTHON_INCLUDE_DIRS ${PYTHON_1_INCLUDE_DIRS})
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
144 set(PYTHON_LIBRARIES ${PYTHON_1_LIBRARIES})
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
145 else()
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
146 pkg_check_modules(PYTHON_2 REQUIRED python-${PYTHON_VERSION})
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
147 set(PYTHON_INCLUDE_DIRS ${PYTHON_2_INCLUDE_DIRS})
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
148 set(PYTHON_LIBRARIES ${PYTHON_2_LIBRARIES})
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
149 endif()
16
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
150 endif()
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
151 endif()
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
152
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
153
100
e2b2e1d4e1bb fixed compatibility with Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
154 if (USE_FRAMEWORK_ORTHANC_SDK)
e2b2e1d4e1bb fixed compatibility with Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
155 include_directories(
e2b2e1d4e1bb fixed compatibility with Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
156 ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Include
e2b2e1d4e1bb fixed compatibility with Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
157 )
e2b2e1d4e1bb fixed compatibility with Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
158 else()
e2b2e1d4e1bb fixed compatibility with Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
159 include_directories(
107
461dfb859ac7 upgrade to Orthanc SDK 1.10.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 100
diff changeset
160 ${CMAKE_SOURCE_DIR}/Resources/Orthanc/Sdk-1.10.0
100
e2b2e1d4e1bb fixed compatibility with Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
161 )
e2b2e1d4e1bb fixed compatibility with Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
162 endif()
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 add_definitions(
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 -DHAS_ORTHANC_EXCEPTION=0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 )
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 include_directories(
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 ${PYTHON_INCLUDE_DIRS}
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 )
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 add_library(OrthancPython SHARED
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 Sources/Autogenerated/sdk.cpp
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 61
diff changeset
174 Sources/DicomScpCallbacks.cpp
79
068551520123 New Python function: "orthanc.RegisterStorageArea()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 78
diff changeset
175 Sources/ICallbackRegistration.cpp
50
70abe3ebbbfc New Python function: "orthanc.RegisterIncomingHttpRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 49
diff changeset
176 Sources/IncomingHttpRequestFilter.cpp
96
627b8a19fb9f orthanc.RegisterIncomingCStoreInstanceFilter()
Alain Mazy <am@osimis.io>
parents: 94
diff changeset
177 Sources/IncomingInstanceFilter.cpp
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 Sources/OnChangeCallback.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 Sources/OnStoredInstanceCallback.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 Sources/Plugin.cpp
123
5f0b7795afaf fixing the first leak
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 109
diff changeset
181 Sources/PythonBytes.cpp
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 Sources/PythonFunction.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 Sources/PythonLock.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 Sources/PythonModule.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 Sources/PythonObject.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 Sources/PythonString.cpp
99
465bf098554b new callback: orthanc.RegisterReceivedInstanceCallback()
Alain Mazy <am@osimis.io>
parents: 96
diff changeset
187 Sources/ReceivedInstanceCallback.cpp
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 Sources/RestCallbacks.cpp
79
068551520123 New Python function: "orthanc.RegisterStorageArea()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 78
diff changeset
189 Sources/StorageArea.cpp
119
cf6decdf9e15 wrapped new SDK callback: orthanc.RegisterStorageCommitmentScpCallback()
Alain Mazy <am@osimis.io>
parents: 110
diff changeset
190 Sources/StorageCommitmentScpCallback.cpp
33
ce5b6116e6cd New builders for Windows: Supporting 32 / 64bit with Python 2.7 / 3.7 / 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
191
ce5b6116e6cd New builders for Windows: Supporting 32 / 64bit with Python 2.7 / 3.7 / 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
192 # Third-party sources
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
193 ${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp
33
ce5b6116e6cd New builders for Windows: Supporting 32 / 64bit with Python 2.7 / 3.7 / 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
194 ${BOOST_SOURCES}
ce5b6116e6cd New builders for Windows: Supporting 32 / 64bit with Python 2.7 / 3.7 / 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
195 ${JSONCPP_SOURCES}
ce5b6116e6cd New builders for Windows: Supporting 32 / 64bit with Python 2.7 / 3.7 / 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
196 ${WINDOWS_RESOURCES}
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 )
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 target_link_libraries(OrthancPython ${PYTHON_LIBRARIES})
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 add_definitions(-DPLUGIN_VERSION="${PLUGIN_VERSION}")
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 set_target_properties(OrthancPython PROPERTIES
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 VERSION ${PLUGIN_VERSION}
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 SOVERSION ${PLUGIN_VERSION}
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 )
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 install(
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 TARGETS OrthancPython
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 RUNTIME DESTINATION lib # Destination for Windows
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 )