Commit 387264a4 authored by Guillaume Pasero's avatar Guillaume Pasero

ENH: prepare a standalone project to compile bindings

parent b0247c74
Pipeline #2348 failed with stages
in 55 minutes and 38 seconds
......@@ -87,3 +87,20 @@ if(PYTHON_VERSION_STRING VERSION_LESS "3.2.0")
else()
# TODO : pyc file is in a subfolder.
endif()
configure_file(StandaloneWrapper.in CMakeLists.txt @ONLY)
install( FILES ${CMAKE_SWIG_OUTDIR}/otbApplicationPYTHON_wrap.cxx
${CMAKE_SWIG_OUTDIR}/otbApplicationPYTHON_wrap.h
itkPyCommand.cxx
itkPyCommand.h
otbPythonLogOutput.cxx
otbPythonLogOutput.h
otbSwigPrintCallback.h
otbProgressReporterManager.cxx
otbProgressReporterManager.h
../itkBase.includes
../otbWrapperSWIGIncludes.h
${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt
DESTINATION ${OTB_INSTALL_DATA_DIR}/swig
COMPONENT Resources )
cmake_minimum_required(VERSION 3.10.1)
project(OTBPythonWrappers)
get_filename_component(PKG_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
get_filename_component(PKG_PREFIX "${PKG_PREFIX}" PATH)
get_filename_component(PKG_PREFIX "${PKG_PREFIX}" PATH)
find_package(OTB REQUIRED HINTS ${PKG_PREFIX}/@OTB_INSTALL_PACKAGE_DIR@)
list(APPEND CMAKE_MODULE_PATH ${OTB_CMAKE_DIR})
include(${OTB_USE_FILE})
set ( Python_ADDITIONAL_VERSIONS "3;2" )
set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
find_package( PythonInterp )
if ( OTB_WRAP_PYTHON AND ( ${PYTHON_VERSION_MAJOR} EQUAL 2 ) )
message (WARNING "Python3 not found. There is no longer support of \
wrapping in python2 in OTB, but it can still be used.")
endif()
# Now that we have a python version the addditional versions should only
# contain the version we have to get the corresponding libs
set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
find_package ( PythonLibs )
include_directories(${PYTHON_INCLUDE_DIR})
find_package(Numpy)
if ( NUMPY_FOUND )
include_directories(${NUMPY_INCLUDE_DIRS})
else()
message( WARNING
"OTB wrappers will be done without support for NumPy (not found).")
endif()
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
file(GLOB OTBPythonWrappers_SOURCES "*.cxx")
# declare the python wrapper library
add_library(PythonWrapperLib MODULE ${OTBPythonWrappers_SOURCES})
target_link_libraries(PythonWrapperLib ${PYTHON_LIBRARIES} OTBApplicationEngine)
set_target_properties(PythonWrapperLib PROPERTIES
OUTPUT_NAME "_otbApplication"
NO_SONAME ON
PREFIX "")
if(WIN32 AND NOT CYGWIN)
set_target_properties(PythonWrapperLib PROPERTIES SUFFIX ".pyd")
endif()
if(NUMPY_FOUND)
add_definitions(-DOTB_SWIGNUMPY=1)
endif()
install(TARGETS PythonWrapperLib
DESTINATION lib/python
COMPONENT RuntimeLibraries )
......@@ -24,6 +24,9 @@ function(install_python_bindings)
PATTERN "*.pyc" EXCLUDE
PATTERN "__pycache__" EXCLUDE
)
install(DIRECTORY ${SUPERBUILD_INSTALL_DIR}/share/otb/swig
DESTINATION ${PKG_STAGE_DIR}/share/otb
)
endif()
# Handle GDAL python bindings
file(GLOB gdal_python_scripts "${SUPERBUILD_INSTALL_DIR}/bin/gdal*.py")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment