Mercurial > hg > orthanc-python
annotate CMakeLists.txt @ 17:3848f5b1d993
integration 1.0->mainline
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 01 Apr 2020 10:43:36 +0200 |
parents | c4c3590e2024 777b677cc9fc |
children | 67f48fc2fd69 |
rev | line source |
---|---|
0 | 1 cmake_minimum_required(VERSION 2.8) |
2 project(OrthancPython) | |
3 | |
15 | 4 set(PLUGIN_VERSION "mainline") |
0 | 5 |
6 | |
7 set(PYTHON_VERSION "3.6" CACHE STRING "Version of Python to be used") | |
8 set(PYTHON_WINDOWS_ROOT "" CACHE STRING "") | |
9 set(USE_SYSTEM_BOOST ON CACHE BOOL "Use the system version of Boost") | |
10 set(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp") | |
11 set(USE_LEGACY_JSONCPP OFF CACHE BOOL "Use the old branch 0.x.y of JsonCpp, that does not require a C++11 compiler (for LSB and old versions of Visual Studio)") | |
12 | |
13 include(CheckIncludeFile) | |
14 include(CheckIncludeFileCXX) | |
15 include(CheckIncludeFiles) | |
16 include(CheckLibraryExists) | |
16
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
17 include(FindPythonInterp) |
0 | 18 |
19 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
20 set(PYTHON_INCLUDE_DIRS ${PYTHON_WINDOWS_ROOT}/include) | |
21 set(PYTHON_LIBRARIES ${PYTHON_WINDOWS_ROOT}/libs/libpython27.a) | |
22 | |
23 else() | |
24 find_package(PkgConfig REQUIRED) | |
25 pkg_check_modules(PYTHON_1 python-${PYTHON_VERSION}-embed) | |
26 | |
27 if (PYTHON_1_FOUND) | |
28 set(PYTHON_INCLUDE_DIRS ${PYTHON_1_INCLUDE_DIRS}) | |
29 set(PYTHON_LIBRARIES ${PYTHON_1_LIBRARIES}) | |
30 else() | |
31 pkg_check_modules(PYTHON_2 REQUIRED python-${PYTHON_VERSION}) | |
32 set(PYTHON_INCLUDE_DIRS ${PYTHON_2_INCLUDE_DIRS}) | |
33 set(PYTHON_LIBRARIES ${PYTHON_2_LIBRARIES}) | |
34 endif() | |
35 endif() | |
36 | |
37 set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR}/Resources/Orthanc) | |
38 include(${ORTHANC_ROOT}/Resources/CMake/Compiler.cmake) | |
39 include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake) | |
40 include(${ORTHANC_ROOT}/Resources/CMake/BoostConfiguration.cmake) | |
41 include(${ORTHANC_ROOT}/Resources/CMake/JsonCppConfiguration.cmake) | |
42 | |
16
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
43 |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
44 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
45 execute_process( |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
46 COMMAND |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
47 ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
48 ${PLUGIN_VERSION} "Python plugin" OrthancPython.dll |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
49 "Plugin to create Orthanc plugins using Python" |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
50 ERROR_VARIABLE Failure |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
51 OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/Version.rc |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
52 ) |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
53 |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
54 if (Failure) |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
55 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
|
56 endif() |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
57 |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
58 set(WINDOWS_RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/Version.rc) |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
59 endif() |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
60 |
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
61 |
4
e3128420249d
fixing the SDK version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
62 include_directories( |
e3128420249d
fixing the SDK version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
63 ${ORTHANC_ROOT}/Sdk-1.5.7 |
e3128420249d
fixing the SDK version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
64 ) |
0 | 65 |
66 add_definitions( | |
67 -DHAS_ORTHANC_EXCEPTION=0 | |
68 ) | |
69 | |
70 include_directories( | |
71 ${ORTHANC_ROOT}/Plugins/Samples/Common | |
72 ${PYTHON_INCLUDE_DIRS} | |
73 ) | |
74 | |
75 add_library(OrthancPython SHARED | |
76 ${BOOST_SOURCES} | |
77 ${JSONCPP_SOURCES} | |
78 ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp | |
16
777b677cc9fc
generation of windows resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
79 ${WINDOWS_RESOURCES} |
0 | 80 Sources/Autogenerated/sdk.cpp |
81 Sources/OnChangeCallback.cpp | |
82 Sources/OnStoredInstanceCallback.cpp | |
83 Sources/Plugin.cpp | |
84 Sources/PythonFunction.cpp | |
85 Sources/PythonLock.cpp | |
86 Sources/PythonModule.cpp | |
87 Sources/PythonObject.cpp | |
88 Sources/PythonString.cpp | |
89 Sources/RestCallbacks.cpp | |
90 ) | |
91 | |
92 target_link_libraries(OrthancPython ${PYTHON_LIBRARIES}) | |
93 | |
94 add_definitions(-DPLUGIN_VERSION="${PLUGIN_VERSION}") | |
95 | |
96 set_target_properties(OrthancPython PROPERTIES | |
97 VERSION ${PLUGIN_VERSION} | |
98 SOVERSION ${PLUGIN_VERSION} | |
99 ) | |
100 | |
101 install( | |
102 TARGETS OrthancPython | |
103 RUNTIME DESTINATION lib # Destination for Windows | |
104 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux | |
105 ) |