Mercurial > hg > orthanc-python
view CMakeLists.txt @ 2:df7b4f8a0437
coverage statistics
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 27 Mar 2020 07:59:20 +0100 |
parents | 7ed502b17b8f |
children | e3128420249d |
line wrap: on
line source
cmake_minimum_required(VERSION 2.8) project(OrthancPython) set(PLUGIN_VERSION "mainline") set(PYTHON_VERSION "3.6" CACHE STRING "Version of Python to be used") set(PYTHON_WINDOWS_ROOT "" CACHE STRING "") set(USE_SYSTEM_BOOST ON CACHE BOOL "Use the system version of Boost") set(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp") 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)") set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK") include(CheckIncludeFile) include(CheckIncludeFileCXX) include(CheckIncludeFiles) include(CheckLibraryExists) if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") set(PYTHON_INCLUDE_DIRS ${PYTHON_WINDOWS_ROOT}/include) set(PYTHON_LIBRARIES ${PYTHON_WINDOWS_ROOT}/libs/libpython27.a) else() find_package(PkgConfig REQUIRED) pkg_check_modules(PYTHON_1 python-${PYTHON_VERSION}-embed) if (PYTHON_1_FOUND) set(PYTHON_INCLUDE_DIRS ${PYTHON_1_INCLUDE_DIRS}) set(PYTHON_LIBRARIES ${PYTHON_1_LIBRARIES}) else() pkg_check_modules(PYTHON_2 REQUIRED python-${PYTHON_VERSION}) set(PYTHON_INCLUDE_DIRS ${PYTHON_2_INCLUDE_DIRS}) set(PYTHON_LIBRARIES ${PYTHON_2_LIBRARIES}) endif() endif() set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR}/Resources/Orthanc) include(${ORTHANC_ROOT}/Resources/CMake/Compiler.cmake) include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake) include(${ORTHANC_ROOT}/Resources/CMake/BoostConfiguration.cmake) include(${ORTHANC_ROOT}/Resources/CMake/JsonCppConfiguration.cmake) if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK) include_directories( ${ORTHANC_ROOT}/Sdk-1.5.7 ) else() CHECK_INCLUDE_FILE_CXX(orthanc/OrthancCPlugin.h HAVE_ORTHANC_H) if (NOT HAVE_ORTHANC_H) message(FATAL_ERROR "Please install the headers of the Orthanc plugins SDK") endif() endif() add_definitions( -DHAS_ORTHANC_EXCEPTION=0 ) include_directories( ${ORTHANC_ROOT}/Plugins/Include ${ORTHANC_ROOT}/Plugins/Samples/Common ${PYTHON_INCLUDE_DIRS} ) add_library(OrthancPython SHARED ${BOOST_SOURCES} ${JSONCPP_SOURCES} ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Sources/Autogenerated/sdk.cpp Sources/OnChangeCallback.cpp Sources/OnStoredInstanceCallback.cpp Sources/Plugin.cpp Sources/PythonFunction.cpp Sources/PythonLock.cpp Sources/PythonModule.cpp Sources/PythonObject.cpp Sources/PythonString.cpp Sources/RestCallbacks.cpp ) target_link_libraries(OrthancPython ${PYTHON_LIBRARIES}) add_definitions(-DPLUGIN_VERSION="${PLUGIN_VERSION}") set_target_properties(OrthancPython PROPERTIES VERSION ${PLUGIN_VERSION} SOVERSION ${PLUGIN_VERSION} ) install( TARGETS OrthancPython RUNTIME DESTINATION lib # Destination for Windows LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux )