Commit e9a7af12 authored by Olivier Stasse's avatar Olivier Stasse Committed by Guilhem Saurel

[CMake] Fix switch to CMake export.

parent 12086f63
......@@ -10,6 +10,12 @@ SET(PROJECT_URL "http://github.com/${PROJECT_NAMESPACE}/${PROJECT_NAME}")
# Export CMake Target
SET(PROJECT_USE_CMAKE_EXPORT TRUE)
# Make sure that every header is generated in dynamic-graph
SET(CUSTOM_HEADER_DIR "dynamic-graph/python")
# Do not fail on warning
SET(CXX_DISABLE_WERROR TRUE)
INCLUDE(cmake/base.cmake)
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/eigen.cmake)
......@@ -29,16 +35,13 @@ PROJECT(${PROJECT_NAME} CXX)
FINDPYTHON()
INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_DIRS})
# Trigger dependency to dynamic-graph.
ADD_REQUIRED_DEPENDENCY("dynamic-graph >= 3.0.0")
ADD_REQUIRED_DEPENDENCY(eigen3)
ADD_PROJECT_DEPENDENCY(dynamic-graph 3.0.0 REQUIRED)
# Add dependency toward dynamic graph library in pkg-config file.
PKG_CONFIG_APPEND_LIBS("dynamic-graph-python")
# Search for Boost.
SET(BOOST_COMPONENTS filesystem system thread program_options unit_test_framework)
SET(BOOST_COMPONENTS filesystem system thread program_options unit_test_framework python)
SEARCH_FOR_BOOST()
SEARCH_FOR_EIGEN()
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(include/${CUSTOM_HEADER_DIR})
......
......@@ -9,6 +9,15 @@
SET(LIBRARY_NAME ${PROJECT_NAME})
ADD_LIBRARY(${LIBRARY_NAME} SHARED interpreter.cc dynamic_graph/python-compat.cc)
TARGET_INCLUDE_DIRECTORIES(${LIBRARY_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/>
$<INSTALL_INTERFACE:include>
)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${PYTHON_LIBRARY})
IF(UNIX)
......@@ -16,7 +25,7 @@ IF(UNIX)
ENDIF(UNIX)
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} dynamic-graph)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} dynamic-graph::dynamic-graph)
INSTALL(TARGETS ${LIBRARY_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
......
......@@ -18,6 +18,7 @@ ADD_LIBRARY(${PYTHON_MODULE}
)
TARGET_LINK_LIBRARIES(${PYTHON_MODULE} ${PYTHON_LIBRARY})
TARGET_LINK_LIBRARIES(${PYTHON_MODULE} dynamic-graph::dynamic-graph)
# Remove prefix lib
SET_TARGET_PROPERTIES(${PYTHON_MODULE}
......
# Test the interpreter
SET(EXECUTABLE_NAME interpreter-test)
ADD_EXECUTABLE(${EXECUTABLE_NAME} interpreter-test.cc)
......@@ -10,7 +9,7 @@ SET(EXECUTABLE_NAME interpreter-test-runfile)
ADD_EXECUTABLE(${EXECUTABLE_NAME} interpreter-test-runfile.cc)
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} dynamic-graph-python)
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} ${PYTHON_LIBRARY})
TARGET_LINK_BOOST_PYTHON(${EXECUTABLE_NAME})
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} ${Boost_LIBRARIES})
ADD_TEST(${EXECUTABLE_NAME} ${EXECUTABLE_NAME})
ADD_CUSTOM_COMMAND(TARGET interpreter-test-runfile POST_BUILD
......@@ -35,7 +34,11 @@ SET_TARGET_PROPERTIES(${LIBRARY_NAME}
PREFIX ""
SOVERSION ${PROJECT_VERSION}
INSTALL_RPATH ${DYNAMIC_GRAPH_PLUGINDIR})
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} dynamic-graph)
#add_dependencies(${LIBRARY_NAME} dynamic-graph)
target_link_libraries(${LIBRARY_NAME} dynamic-graph::dynamic-graph)
#PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} dynamic-graph)
## Create its bindings
## This mimics DYNAMIC_GRAPH_PYTHON_MODULE(${LIBRARY_NAME} ${LIBRARY_NAME} "${LIBRARY_NAME}-wrap")
......
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