annotate CMakeLists.txt @ 43:eec99a934b6a OrthancPython-2.0

OrthancPython-2.0
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 08 Jul 2020 15:17:58 +0200
parents 393d2da0722a
children 2468e2f2456c
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
43
eec99a934b6a OrthancPython-2.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 41
diff changeset
4 set(PLUGIN_VERSION "2.0")
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()
43
eec99a934b6a OrthancPython-2.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 41
diff changeset
10 set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.7.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
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 set(PYTHON_VERSION "3.6" CACHE STRING "Version of Python to be used")
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 set(PYTHON_WINDOWS_ROOT "" CACHE STRING "")
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
17 set(PYTHON_LIBRARY_NAME "" CACHE STRING "")
26
b0d1308280d8 Added the PYTHON_WINDOWS_USE_RELEASE_LIBS CMake option
Benjamin Golinvaux <bgo@osimis.io>
parents: 25
diff changeset
18 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)")
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
19
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
20
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
21 # Parameters of the build
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
22 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
23 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
24 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
25 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
26 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
27 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
28
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
29 # 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
30 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
31 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
32 mark_as_advanced(ORTHANC_FRAMEWORK_STATIC)
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
33
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
34
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
35 # Download and setup the Orthanc framework
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
36 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
37
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
38 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
39 #link_libraries(${ORTHANC_FRAMEWORK_LIBRARIES})
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
40
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
41 else()
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
42 include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
43
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
44 #set(ENABLE_MODULE_IMAGES OFF CACHE INTERNAL "")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
45 #set(ENABLE_MODULE_JOBS OFF CACHE INTERNAL "")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
46 #set(ENABLE_MODULE_DICOM OFF CACHE INTERNAL "")
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
47
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
48 include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
49 include_directories(${ORTHANC_FRAMEWORK_ROOT}/Sources)
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
50 endif()
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 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
54
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 include(CheckIncludeFile)
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 include(CheckIncludeFileCXX)
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 include(CheckIncludeFiles)
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 include(CheckLibraryExists)
16
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
60 include(FindPythonInterp)
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
21
67f48fc2fd69 fix linking with Python on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 17
diff changeset
62 string(REGEX REPLACE "^([0-9]*)\\.([0-9]*)$" "\\1" PYTHON_VERSION_MAJOR ${PYTHON_VERSION})
67f48fc2fd69 fix linking with Python on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 17
diff changeset
63 string(REGEX REPLACE "^([0-9]*)\\.([0-9]*)$" "\\2" PYTHON_VERSION_MINOR ${PYTHON_VERSION})
67f48fc2fd69 fix linking with Python on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 17
diff changeset
64
67f48fc2fd69 fix linking with Python on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 17
diff changeset
65 if (NOT PYTHON_VERSION STREQUAL
67f48fc2fd69 fix linking with Python on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 17
diff changeset
66 "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
67f48fc2fd69 fix linking with Python on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 17
diff changeset
67 message(FATAL_ERROR "Error in the (x.y) format of the Python version: ${PYTHON_VERSION}")
67f48fc2fd69 fix linking with Python on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 17
diff changeset
68 endif()
67f48fc2fd69 fix linking with Python on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 17
diff changeset
69
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
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
71 if ("${PYTHON_LIBRARY_NAME}" STREQUAL "")
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
72 if (MSVC)
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
73 set(Prefix "")
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
74 set(Suffix ".lib")
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
75 if(PYTHON_WINDOWS_USE_RELEASE_LIBS)
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
76 add_definitions(-DORTHANC_PYTHON_WINDOWS_USE_RELEASE_LIBS=1)
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
77 endif()
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
78 else()
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
79 list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix)
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
80 set(Suffix ".a")
26
b0d1308280d8 Added the PYTHON_WINDOWS_USE_RELEASE_LIBS CMake option
Benjamin Golinvaux <bgo@osimis.io>
parents: 25
diff changeset
81 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
82
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
83 set(PYTHON_LIBRARY_NAME ${Prefix}python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}${Suffix})
23
874a3fef26ff fix suffix of Windows library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 21
diff changeset
84 endif()
874a3fef26ff fix suffix of Windows library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 21
diff changeset
85
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
86 if (CMAKE_COMPILER_IS_GNUCXX AND
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
87 "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8" AND
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
88 "${PYTHON_VERSION}" STREQUAL "2.7")
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
89 # Fix for MinGW 64bit: https://stackoverflow.com/a/19867426/881731
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
90 add_definitions(-DMS_WIN64)
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
91 endif()
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
92
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 set(PYTHON_INCLUDE_DIRS ${PYTHON_WINDOWS_ROOT}/include)
21
67f48fc2fd69 fix linking with Python on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 17
diff changeset
94 set(PYTHON_LIBRARIES ${PYTHON_WINDOWS_ROOT}/libs/${PYTHON_LIBRARY_NAME})
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 else()
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 find_package(PkgConfig REQUIRED)
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 pkg_check_modules(PYTHON_1 python-${PYTHON_VERSION}-embed)
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 if (PYTHON_1_FOUND)
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 set(PYTHON_INCLUDE_DIRS ${PYTHON_1_INCLUDE_DIRS})
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 set(PYTHON_LIBRARIES ${PYTHON_1_LIBRARIES})
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 else()
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 pkg_check_modules(PYTHON_2 REQUIRED python-${PYTHON_VERSION})
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 set(PYTHON_INCLUDE_DIRS ${PYTHON_2_INCLUDE_DIRS})
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 set(PYTHON_LIBRARIES ${PYTHON_2_LIBRARIES})
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 endif()
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 endif()
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109
16
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
110
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
111 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
112 execute_process(
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
113 COMMAND
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
114 ${PYTHON_EXECUTABLE} ${ORTHANC_FRAMEWORK_ROOT}/Resources/WindowsResources.py
16
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
115 ${PLUGIN_VERSION} "Python plugin" OrthancPython.dll
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
116 "Plugin to create Orthanc plugins using Python"
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
117 ERROR_VARIABLE Failure
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
118 OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/Version.rc
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
119 )
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
120
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
121 if (Failure)
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
122 message(FATAL_ERROR "Error while computing the version information: ${Failure}")
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
123 endif()
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
124
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
125 set(WINDOWS_RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/Version.rc)
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
126 endif()
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
127
777b677cc9fc generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 14
diff changeset
128
4
e3128420249d fixing the SDK version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
129 include_directories(
41
393d2da0722a upgrade to Orthanc SDK 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 36
diff changeset
130 ${CMAKE_SOURCE_DIR}/Resources/Orthanc/Sdk-1.7.2
4
e3128420249d fixing the SDK version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
131 )
0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 add_definitions(
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 -DHAS_ORTHANC_EXCEPTION=0
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 )
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 include_directories(
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 ${PYTHON_INCLUDE_DIRS}
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 )
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 add_library(OrthancPython SHARED
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 Sources/Autogenerated/sdk.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 Sources/OnChangeCallback.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 Sources/OnStoredInstanceCallback.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 Sources/Plugin.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 Sources/PythonFunction.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 Sources/PythonLock.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 Sources/PythonModule.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 Sources/PythonObject.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 Sources/PythonString.cpp
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 Sources/RestCallbacks.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
152
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
153 # Third-party sources
36
fd58eb5749ed CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 33
diff changeset
154 ${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
155 ${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
156 ${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
157 ${WINDOWS_RESOURCES}
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 target_link_libraries(OrthancPython ${PYTHON_LIBRARIES})
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 add_definitions(-DPLUGIN_VERSION="${PLUGIN_VERSION}")
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 set_target_properties(OrthancPython PROPERTIES
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 VERSION ${PLUGIN_VERSION}
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 SOVERSION ${PLUGIN_VERSION}
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 )
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 install(
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 TARGETS OrthancPython
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 RUNTIME DESTINATION lib # Destination for Windows
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux
7ed502b17b8f initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 )