annotate CMakeLists.txt @ 71:0fb9f2fb3157 OrthancPython-3.2

OrthancPython-3.2
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 11 Jun 2021 17:09:25 +0200
parents c10386bee2e3
children 38b0a6a1ca56
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
71
0fb9f2fb3157 OrthancPython-3.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 70
diff changeset
4 set(PLUGIN_VERSION "3.2")
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()
70
c10386bee2e3 fix link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
10 set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.9.3")
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\"")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
37 # 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
38 set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK")
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
46
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 44
diff changeset
46 include_directories(${ORTHANC_FRAMEWORK_ROOT})
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 44
diff changeset
47
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
48 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
70
c10386bee2e3 fix link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
49 if (NOT ORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES STREQUAL "")
c10386bee2e3 fix link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
50 # https://stackoverflow.com/a/5272993/881731
c10386bee2e3 fix link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
51 string(REPLACE " " ";" tmp ${ORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES})
c10386bee2e3 fix link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
52 link_libraries(${tmp})
c10386bee2e3 fix link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
53 endif()
c10386bee2e3 fix link against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
54
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
55 else()
46
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 44
diff changeset
56 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
57
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
58 #set(ENABLE_MODULE_IMAGES OFF CACHE INTERNAL "")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
59 #set(ENABLE_MODULE_JOBS OFF CACHE INTERNAL "")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
60 #set(ENABLE_MODULE_DICOM OFF CACHE INTERNAL "")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
61
46
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 44
diff changeset
62 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkConfiguration.cmake)
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
63 endif()
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
64
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
65
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
66 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
67
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 include(CheckIncludeFile)
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 include(CheckIncludeFileCXX)
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 include(CheckIncludeFiles)
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 include(CheckLibraryExists)
16
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
73 include(FindPythonInterp)
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
75
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
76 if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
77 find_package(PythonLibs)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
78 if (NOT PYTHONLIBS_FOUND)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
79 message(FATAL_ERROR "Cannot find the Python libraries")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
80 endif()
21
67f48fc2fd69 fix linking with Python on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 17
diff changeset
81
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
82 message("Python library - Found version: ${PYTHONLIBS_VERSION_STRING}")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
83 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
84 message("Python library - Shared library: ${PYTHON_LIBRARIES}")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
85
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
86 else()
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
87 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
88 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
89
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
90 if (NOT PYTHON_VERSION STREQUAL
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
91 "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
92 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
93 endif()
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
94
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
95 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
96 if ("${PYTHON_LIBRARY_NAME}" STREQUAL "")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
97 if (MSVC)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
98 set(Prefix "")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
99 set(Suffix ".lib")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
100 if(PYTHON_WINDOWS_USE_RELEASE_LIBS)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
101 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
102 endif()
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
103 else()
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
104 list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
105 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
106 endif()
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
107
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
108 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
109 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
110
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
111 if (CMAKE_COMPILER_IS_GNUCXX AND
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
112 "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8" AND
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
113 "${PYTHON_VERSION}" STREQUAL "2.7")
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
114 # 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
115 add_definitions(-DMS_WIN64)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
116 endif()
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
117
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
118 set(PYTHON_INCLUDE_DIRS ${PYTHON_WINDOWS_ROOT}/include)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
119 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
120
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
121 execute_process(
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
122 COMMAND
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
123 ${PYTHON_EXECUTABLE} ${ORTHANC_FRAMEWORK_ROOT}/../Resources/WindowsResources.py
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
124 ${PLUGIN_VERSION} "Python plugin" OrthancPython.dll
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
125 "Plugin to create Orthanc plugins using Python"
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
126 ERROR_VARIABLE Failure
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
127 OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/Version.rc
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
128 )
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
130 if (Failure)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
131 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
132 endif()
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
133
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
134 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
135
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 else()
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
137 find_package(PkgConfig REQUIRED)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
138 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
139
47
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
140 if (PYTHON_1_FOUND)
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
141 set(PYTHON_INCLUDE_DIRS ${PYTHON_1_INCLUDE_DIRS})
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
142 set(PYTHON_LIBRARIES ${PYTHON_1_LIBRARIES})
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
143 else()
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
144 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
145 set(PYTHON_INCLUDE_DIRS ${PYTHON_2_INCLUDE_DIRS})
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
146 set(PYTHON_LIBRARIES ${PYTHON_2_LIBRARIES})
42de8b600c0c Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 46
diff changeset
147 endif()
16
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
148 endif()
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
149 endif()
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
150
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
151
4
e3128420249d fixing the SDK version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
152 include_directories(
49
9e466631660a ugrade to Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
153 ${CMAKE_SOURCE_DIR}/Resources/Orthanc/Sdk-1.8.1
4
e3128420249d fixing the SDK version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
154 )
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 add_definitions(
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 -DHAS_ORTHANC_EXCEPTION=0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 )
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 include_directories(
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 ${PYTHON_INCLUDE_DIRS}
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 )
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_library(OrthancPython SHARED
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 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
166 Sources/DicomScpCallbacks.cpp
50
70abe3ebbbfc New Python function: "orthanc.RegisterIncomingHttpRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 49
diff changeset
167 Sources/IncomingHttpRequestFilter.cpp
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 Sources/OnChangeCallback.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 Sources/OnStoredInstanceCallback.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 Sources/Plugin.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 Sources/PythonFunction.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 Sources/PythonLock.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 Sources/PythonModule.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 Sources/PythonObject.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 Sources/PythonString.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 Sources/RestCallbacks.cpp
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 61
diff changeset
177 Sources/ICallbackRegistration.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
178
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
179 # Third-party sources
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
180 ${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
181 ${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
182 ${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
183 ${WINDOWS_RESOURCES}
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 )
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 target_link_libraries(OrthancPython ${PYTHON_LIBRARIES})
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 add_definitions(-DPLUGIN_VERSION="${PLUGIN_VERSION}")
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 set_target_properties(OrthancPython PROPERTIES
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 VERSION ${PLUGIN_VERSION}
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 SOVERSION ${PLUGIN_VERSION}
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 )
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 install(
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 TARGETS OrthancPython
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 RUNTIME DESTINATION lib # Destination for Windows
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 )