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