Commit 73697581 authored by Laurent Belcour's avatar Laurent Belcour

[CMake] Adding Python compilation with pybind11

parent 86d13198
......@@ -22,7 +22,6 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/configs/cmake/)
find_package(Eigen3)
find_package(OpenMP)
find_package(PythonLibs)
find_package(Boost COMPONENTS python)
find_package(Doxygen)
find_package(Ceres)
find_package(NLOPT)
......@@ -32,11 +31,13 @@ add_definitions(-DALTA_PLUGIN_DIRECTORY="/usr/lib/alta_plugins")
# Add core and library include files
include_directories("external/build" "sources" ${EIGEN3_INCLUDE_DIR})
include_directories("external" "external/Catch/include" "external/quadprog++")
include_directories("external/pybind11/include")
# Look for header only dependencies
find_file(EIGEN_FOUND "Eigen/Core" HINTS ${EIGEN3_INCLUDE_DIR})
find_file(CATCH_FOUND "catch.hpp" HINTS external/Catch/include)
find_file(FLANN_FOUND "flann/flann.hpp")
find_file(EIGEN_FOUND "Eigen/Core" HINTS ${EIGEN3_INCLUDE_DIR})
find_file(CATCH_FOUND "catch.hpp" HINTS external/Catch/include)
find_file(FLANN_FOUND "flann/flann.hpp")
find_file(PYBIND_FOUND "pybind11/pybind11.h")
# Check if Eigen is found
if(NOT EIGEN_FOUND)
......@@ -190,11 +191,11 @@ endif()
#alta_add_plugin(nonlinear_fitter_ipopt nonlinear_fitter_ipopt/fitter.cpp)
# Python bindings
if(PYTHONLIBS_FOUND AND Boost_FOUND)
if(PYTHONLIBS_FOUND AND PYBIND_FOUND)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/python)
include_directories(${PYTHON_INCLUDE_DIRS} ${Boost_INCLUDE_DIR})
include_directories(${PYTHON_INCLUDE_DIRS})
add_library(alta SHARED sources/python/alta.cpp)
target_link_libraries(alta core ${PYTHON_LIBRARIES} ${Boost_LIBRARIES})
target_link_libraries(alta core ${PYTHON_LIBRARIES})
set_target_properties(alta PROPERTIES PREFIX "")
if(APPLE)
set_target_properties(alta PROPERTIES SUFFIX ".so")
......
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