annotate CMakeLists.txt @ 121:429475372db7 OrthancPython-3.4

closing branch OrthancPython-3.4
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 29 Aug 2023 16:19:35 +0200
parents 28f354fd36fa
children 8d9f935751fb
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
93
28f354fd36fa OrthancPython-3.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 92
diff changeset
4 set(PLUGIN_VERSION "3.4")
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()
92
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
10 set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.9.7")
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
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
4
e3128420249d fixing the SDK version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
154 include_directories(
49
9e466631660a ugrade to Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
155 ${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
156 )
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 add_definitions(
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 -DHAS_ORTHANC_EXCEPTION=0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 )
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 include_directories(
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 ${PYTHON_INCLUDE_DIRS}
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 )
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 add_library(OrthancPython SHARED
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 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
168 Sources/DicomScpCallbacks.cpp
79
068551520123 New Python function: "orthanc.RegisterStorageArea()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 78
diff changeset
169 Sources/ICallbackRegistration.cpp
50
70abe3ebbbfc New Python function: "orthanc.RegisterIncomingHttpRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 49
diff changeset
170 Sources/IncomingHttpRequestFilter.cpp
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 Sources/OnChangeCallback.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 Sources/OnStoredInstanceCallback.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 Sources/Plugin.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 Sources/PythonFunction.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 Sources/PythonLock.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 Sources/PythonModule.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 Sources/PythonObject.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 Sources/PythonString.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 Sources/RestCallbacks.cpp
79
068551520123 New Python function: "orthanc.RegisterStorageArea()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 78
diff changeset
180 Sources/StorageArea.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
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 # Third-party sources
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
183 ${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
184 ${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
185 ${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
186 ${WINDOWS_RESOURCES}
0
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
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 target_link_libraries(OrthancPython ${PYTHON_LIBRARIES})
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 add_definitions(-DPLUGIN_VERSION="${PLUGIN_VERSION}")
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 set_target_properties(OrthancPython PROPERTIES
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 VERSION ${PLUGIN_VERSION}
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 SOVERSION ${PLUGIN_VERSION}
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 )
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 install(
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 TARGETS OrthancPython
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 RUNTIME DESTINATION lib # Destination for Windows
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 )