Mercurial > hg > orthanc-python
annotate CMakeLists.txt @ 227:9574f06d8588 default tip
todo
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 24 Sep 2024 08:54:11 +0200 |
parents | 850b56948b9c |
children |
rev | line source |
---|---|
219
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
1 # SPDX-FileCopyrightText: 2020-2023 Osimis S.A., 2024-2024 Orthanc Team SRL, 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
2 # SPDX-License-Identifier: AGPL-3.0-or-later |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
3 |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
4 ## |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
5 ## Python plugin for Orthanc |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
6 ## Copyright (C) 2020-2023 Osimis S.A., Belgium |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
7 ## Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
8 ## Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
9 ## |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
10 ## This program is free software: you can redistribute it and/or |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
11 ## modify it under the terms of the GNU Affero General Public License |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
12 ## as published by the Free Software Foundation, either version 3 of |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
13 ## the License, or (at your option) any later version. |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
14 ## |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
15 ## This program is distributed in the hope that it will be useful, but |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
18 ## Affero General Public License for more details. |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
19 ## |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
20 ## You should have received a copy of the GNU Affero General Public License |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
21 ## along with this program. If not, see <http://www.gnu.org/licenses/>. |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
22 ## |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
23 |
3678a028f1f6
making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
184
diff
changeset
|
24 |
0 | 25 cmake_minimum_required(VERSION 2.8) |
26 project(OrthancPython) | |
27 | |
222 | 28 set(PLUGIN_VERSION "mainline") |
0 | 29 |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
30 if (PLUGIN_VERSION STREQUAL "mainline") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
31 set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "mainline") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
32 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
33 else() |
169 | 34 set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.12.4") |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
35 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
36 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
37 |
0 | 38 |
47
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
39 if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
40 # 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
|
41 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
|
42 endif() |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
43 |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
44 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
45 # Windows-specific options |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
46 set(PYTHON_WINDOWS_ROOT "" CACHE STRING "") |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
47 set(PYTHON_LIBRARY_NAME "" CACHE STRING "") |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
48 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
|
49 endif() |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
50 |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
51 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
52 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
53 # Parameters of the build |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
54 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
|
55 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
|
56 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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
62 # 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
|
63 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
|
64 mark_as_advanced(ORTHANC_FRAMEWORK_STATIC) |
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 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
67 # Download and setup the Orthanc framework |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
68 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
|
69 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
70 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
|
71 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
|
72 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
|
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
|
74 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
|
75 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
|
76 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
|
77 |
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
|
78 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
|
79 |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
80 else() |
46 | 81 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
|
82 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
83 #set(ENABLE_MODULE_IMAGES OFF CACHE INTERNAL "") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
84 #set(ENABLE_MODULE_JOBS OFF CACHE INTERNAL "") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
85 #set(ENABLE_MODULE_DICOM OFF CACHE INTERNAL "") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
86 |
46 | 87 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkConfiguration.cmake) |
74
5217f6f8a8cf
improved CMakeLists.txt
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
73
diff
changeset
|
88 include_directories(${ORTHANC_FRAMEWORK_ROOT}) |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
89 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
90 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
91 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
92 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
|
93 |
0 | 94 |
95 include(CheckIncludeFile) | |
96 include(CheckIncludeFileCXX) | |
97 include(CheckIncludeFiles) | |
98 include(CheckLibraryExists) | |
16
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
99 include(FindPythonInterp) |
0 | 100 |
47
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
101 |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
102 if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
103 find_package(PythonLibs) |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
104 if (NOT PYTHONLIBS_FOUND) |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
105 message(FATAL_ERROR "Cannot find the Python libraries") |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
106 endif() |
21
67f48fc2fd69
fix linking with Python on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
17
diff
changeset
|
107 |
47
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
108 message("Python library - Found version: ${PYTHONLIBS_VERSION_STRING}") |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
109 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
|
110 message("Python library - Shared library: ${PYTHON_LIBRARIES}") |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
111 |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
112 else() |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
113 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
|
114 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
|
115 |
47
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
116 if (NOT PYTHON_VERSION STREQUAL |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
117 "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
118 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
|
119 endif() |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
120 |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
121 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
122 if ("${PYTHON_LIBRARY_NAME}" STREQUAL "") |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
123 if (MSVC) |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
124 set(Prefix "") |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
125 set(Suffix ".lib") |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
126 if(PYTHON_WINDOWS_USE_RELEASE_LIBS) |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
127 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
|
128 endif() |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
129 else() |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
130 list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix) |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
131 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
|
132 endif() |
47
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(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
|
135 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
|
136 |
47
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
137 if (CMAKE_COMPILER_IS_GNUCXX AND |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
138 "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8" AND |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
139 "${PYTHON_VERSION}" STREQUAL "2.7") |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
140 # 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
|
141 add_definitions(-DMS_WIN64) |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
142 endif() |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
143 |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
144 set(PYTHON_INCLUDE_DIRS ${PYTHON_WINDOWS_ROOT}/include) |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
145 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
|
146 |
47
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
147 execute_process( |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
148 COMMAND |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
149 ${PYTHON_EXECUTABLE} ${ORTHANC_FRAMEWORK_ROOT}/../Resources/WindowsResources.py |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
150 ${PLUGIN_VERSION} "Python plugin" OrthancPython.dll |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
151 "Plugin to create Orthanc plugins using Python" |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
152 ERROR_VARIABLE Failure |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
153 OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/Version.rc |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
154 ) |
0 | 155 |
47
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
156 if (Failure) |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
157 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
|
158 endif() |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
159 |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
160 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
|
161 |
0 | 162 else() |
47
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
163 find_package(PkgConfig REQUIRED) |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
164 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
|
165 |
47
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
166 if (PYTHON_1_FOUND) |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
167 set(PYTHON_INCLUDE_DIRS ${PYTHON_1_INCLUDE_DIRS}) |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
168 set(PYTHON_LIBRARIES ${PYTHON_1_LIBRARIES}) |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
169 else() |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
170 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
|
171 set(PYTHON_INCLUDE_DIRS ${PYTHON_2_INCLUDE_DIRS}) |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
172 set(PYTHON_LIBRARIES ${PYTHON_2_LIBRARIES}) |
42de8b600c0c
Support of Apple OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
46
diff
changeset
|
173 endif() |
16
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
174 endif() |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
175 endif() |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
176 |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
177 |
100
e2b2e1d4e1bb
fixed compatibility with Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
99
diff
changeset
|
178 if (USE_FRAMEWORK_ORTHANC_SDK) |
e2b2e1d4e1bb
fixed compatibility with Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
99
diff
changeset
|
179 include_directories( |
e2b2e1d4e1bb
fixed compatibility with Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
99
diff
changeset
|
180 ${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
|
181 ) |
e2b2e1d4e1bb
fixed compatibility with Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
99
diff
changeset
|
182 else() |
e2b2e1d4e1bb
fixed compatibility with Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
99
diff
changeset
|
183 include_directories( |
107
461dfb859ac7
upgrade to Orthanc SDK 1.10.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
100
diff
changeset
|
184 ${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
|
185 ) |
e2b2e1d4e1bb
fixed compatibility with Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
99
diff
changeset
|
186 endif() |
0 | 187 |
188 add_definitions( | |
189 -DHAS_ORTHANC_EXCEPTION=0 | |
190 ) | |
191 | |
192 include_directories( | |
193 ${PYTHON_INCLUDE_DIRS} | |
194 ) | |
195 | |
196 add_library(OrthancPython SHARED | |
197 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
|
198 Sources/DicomScpCallbacks.cpp |
79
068551520123
New Python function: "orthanc.RegisterStorageArea()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
78
diff
changeset
|
199 Sources/ICallbackRegistration.cpp |
50
70abe3ebbbfc
New Python function: "orthanc.RegisterIncomingHttpRequestFilter()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
49
diff
changeset
|
200 Sources/IncomingHttpRequestFilter.cpp |
96
627b8a19fb9f
orthanc.RegisterIncomingCStoreInstanceFilter()
Alain Mazy <am@osimis.io>
parents:
94
diff
changeset
|
201 Sources/IncomingInstanceFilter.cpp |
0 | 202 Sources/OnChangeCallback.cpp |
203 Sources/OnStoredInstanceCallback.cpp | |
204 Sources/Plugin.cpp | |
123
5f0b7795afaf
fixing the first leak
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
109
diff
changeset
|
205 Sources/PythonBytes.cpp |
0 | 206 Sources/PythonFunction.cpp |
207 Sources/PythonLock.cpp | |
208 Sources/PythonModule.cpp | |
209 Sources/PythonObject.cpp | |
210 Sources/PythonString.cpp | |
184
f34f3a149c22
added class PythonThreadsAllower
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
180
diff
changeset
|
211 Sources/PythonThreadsAllower.cpp |
99
465bf098554b
new callback: orthanc.RegisterReceivedInstanceCallback()
Alain Mazy <am@osimis.io>
parents:
96
diff
changeset
|
212 Sources/ReceivedInstanceCallback.cpp |
0 | 213 Sources/RestCallbacks.cpp |
79
068551520123
New Python function: "orthanc.RegisterStorageArea()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
78
diff
changeset
|
214 Sources/StorageArea.cpp |
119
cf6decdf9e15
wrapped new SDK callback: orthanc.RegisterStorageCommitmentScpCallback()
Alain Mazy <am@osimis.io>
parents:
110
diff
changeset
|
215 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
|
216 |
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
|
217 # Third-party sources |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
218 ${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
|
219 ${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
|
220 ${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
|
221 ${WINDOWS_RESOURCES} |
0 | 222 ) |
223 | |
171
c8de83fe7faa
removed deprecation warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
169
diff
changeset
|
224 if (CMAKE_COMPILER_IS_GNUCXX) |
c8de83fe7faa
removed deprecation warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
169
diff
changeset
|
225 # Don't report warnings about deprecated functions in the Orthanc SDK |
c8de83fe7faa
removed deprecation warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
169
diff
changeset
|
226 set_source_files_properties( |
c8de83fe7faa
removed deprecation warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
169
diff
changeset
|
227 Sources/Autogenerated/sdk.cpp |
c8de83fe7faa
removed deprecation warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
169
diff
changeset
|
228 PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations) |
c8de83fe7faa
removed deprecation warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
169
diff
changeset
|
229 endif() |
c8de83fe7faa
removed deprecation warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
169
diff
changeset
|
230 |
0 | 231 target_link_libraries(OrthancPython ${PYTHON_LIBRARIES}) |
232 | |
154
802d744d54d3
fix deprecated calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
233 add_definitions( |
802d744d54d3
fix deprecated calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
234 -DPLUGIN_NAME="python" |
802d744d54d3
fix deprecated calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
235 -DPLUGIN_VERSION="${PLUGIN_VERSION}" |
802d744d54d3
fix deprecated calls
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
236 ) |
0 | 237 |
238 set_target_properties(OrthancPython PROPERTIES | |
239 VERSION ${PLUGIN_VERSION} | |
240 SOVERSION ${PLUGIN_VERSION} | |
241 ) | |
242 | |
180
ddf3e987827f
created Python documentation for the Orthanc interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
171
diff
changeset
|
243 configure_file( |
ddf3e987827f
created Python documentation for the Orthanc interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
171
diff
changeset
|
244 Sources/Autogenerated/orthanc.pyi |
ddf3e987827f
created Python documentation for the Orthanc interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
171
diff
changeset
|
245 ${CMAKE_CURRENT_BINARY_DIR}/orthanc.pyi |
ddf3e987827f
created Python documentation for the Orthanc interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
171
diff
changeset
|
246 COPYONLY) |
ddf3e987827f
created Python documentation for the Orthanc interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
171
diff
changeset
|
247 |
0 | 248 install( |
249 TARGETS OrthancPython | |
250 RUNTIME DESTINATION lib # Destination for Windows | |
251 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux | |
252 ) | |
171
c8de83fe7faa
removed deprecation warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
169
diff
changeset
|
253 |
c8de83fe7faa
removed deprecation warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
169
diff
changeset
|
254 if (COMMAND DefineSourceBasenameForTarget) |
c8de83fe7faa
removed deprecation warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
169
diff
changeset
|
255 DefineSourceBasenameForTarget(OrthancPython) |
c8de83fe7faa
removed deprecation warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
169
diff
changeset
|
256 endif() |