Commit 24d3a745 authored by Guilhem Saurel's avatar Guilhem Saurel

[CMake] clean

parent 88517fe9
# Copyright 2010, 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST
# Copyright 2010-2019, Florent Lamiraux, Thomas Moulard, Guilhem Saurel, JRL, CNRS/AIST, LAAS-CNRS
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
......@@ -10,7 +10,6 @@ SET(PROJECT_URL "http://github.com/${PROJECT_NAMESPACE}/${PROJECT_NAME}")
INCLUDE(cmake/base.cmake)
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/eigen.cmake)
INCLUDE(cmake/pthread.cmake)
include(cmake/python.cmake)
include(cmake/test.cmake)
INCLUDE(cmake/sphinx.cmake)
......@@ -24,6 +23,7 @@ SET(PKG_CONFIG_ADDITIONAL_VARIABLES plugindir ${PKG_CONFIG_ADDITIONAL_VARIABLES}
PROJECT(${PROJECT_NAME} CXX)
FINDPYTHON()
INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_DIRS})
# Trigger dependency to dynamic-graph.
ADD_REQUIRED_DEPENDENCY("dynamic-graph >= 3.0.0")
......
BSD 2-Clause License
Copyright (c) 2018, CNRS
Copyright (c) 2011-2019, CNRS
Author: Stack of Tasks Development Team
All rights reserved.
......
# Copyright 2010, 2011, Florent Lamiraux, CNRS
# Copyright 2010-2019, Florent Lamiraux, Guilhem Saurel, LAAS-CNRS
SET(${PROJECT_NAME}_HEADERS
dynamic-graph/python/api.hh
......
# Copyright 2010, 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST
# Copyright 2010 - 2019, Florent Lamiraux, Thomas Moulard, Guilhem Saurel, JRL, CNRS/AIST, LAAS-CNRS
#
# Python
......@@ -59,10 +59,8 @@ SET_TARGET_PROPERTIES(${PYTHON_MODULE}
PROPERTIES PREFIX "")
PKG_CONFIG_USE_DEPENDENCY(${PYTHON_MODULE} dynamic-graph)
#TARGET_LINK_LIBRARIES(${PYTHON_MODULE} ${PYTHON_LIBRARY})
CONFIG_FILES(link-to-python.hh)
INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
#
......
#
# Copyright
#
INCLUDE(CTest)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS} ${PYTHON_LIBRARY_DIRS})
ADD_DEFINITIONS(-DDEBUG=2)
# provide path to library libdynamic-graph.so
LINK_DIRECTORIES(${DYNAMIC_GRAPH_LIBRARY_DIRS})
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
LINK_DIRECTORIES(${${PROJECT_NAME}_BINARY_DIR}/src)
# Add dynamic-graph compilation flags and link to library libdynamic-graph.so
ADD_DEFINITIONS(${DYNAMIC_GRAPH_CFLAGS})
# Test the interpreter
SET(EXECUTABLE_NAME interpreter-test)
ADD_EXECUTABLE(${EXECUTABLE_NAME} interpreter-test.cc)
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} dynamic-graph-python)
ADD_TEST(${EXECUTABLE_NAME} ${EXECUTABLE_NAME})
## Test runfile
SET(EXECUTABLE_NAME interpreter-test-runfile)
ADD_EXECUTABLE(${EXECUTABLE_NAME} interpreter-test-runfile.cc)
......@@ -46,60 +23,37 @@ ADD_CUSTOM_COMMAND(TARGET interpreter-test-runfile POST_BUILD
${CMAKE_BINARY_DIR}/unitTesting
)
#### Build entity library ####
# Test the module generation
## Create an entity
set(LIBRARY_NAME custom_entity)
ADD_LIBRARY(${LIBRARY_NAME} SHARED ${LIBRARY_NAME}.cpp)
#remove the "lib" prefix from the publig output name
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES(${LIBRARY_NAME}
PROPERTIES
PREFIX ""
SOVERSION ${PROJECT_VERSION}
INSTALL_RPATH ${DYNAMIC_GRAPH_PLUGINDIR})
#add_dependencies(${LIBRARY_NAME} dynamic-graph)
target_link_libraries(${LIBRARY_NAME} dynamic-graph)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} dynamic-graph)
STRING(REPLACE - _ PYTHON_LIBRARY_NAME ${LIBRARY_NAME})
MESSAGE(STATUS "dynamic_graph_plugindir: ${DYNAMIC_GRAPH_PLUGINDIR}")
## Create its bindings
## This mimics DYNAMIC_GRAPH_PYTHON_MODULE(${LIBRARY_NAME} ${LIBRARY_NAME} "${LIBRARY_NAME}-wrap")
# Generates a local module in unitTesting
FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dynamic_graph_tests/${LIBRARY_NAME}")
CONFIGURE_FILE(
${PROJECT_SOURCE_DIR}/cmake/dynamic_graph/submodule/__init__.py.cmake
${PROJECT_BINARY_DIR}/unitTesting/dynamic_graph_tests/${LIBRARY_NAME}/__init__.py
${PROJECT_BINARY_DIR}/unitTesting/${LIBRARY_NAME}/__init__.py
)
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dynamic_graph_tests/__init__.py
"")
# Generates a local wrap.so library
SET(PYTHON_MODULE "${LIBRARY_NAME}-wrap")
SET(SOURCE_PYTHON_MODULE "cmake/dynamic_graph/python-module-py.cc")
SET(PYTHON_MODULE ${PYTHON_LIBRARY_NAME}-wrap)
CMAKE_POLICY(PUSH)
IF(POLICY CMP0037)
CMAKE_POLICY(SET CMP0037 OLD)
ENDIF()
ADD_LIBRARY(${PYTHON_MODULE}
MODULE
${PROJECT_SOURCE_DIR}/${SOURCE_PYTHON_MODULE})
ADD_LIBRARY(${PYTHON_MODULE} MODULE ${PROJECT_SOURCE_DIR}/${SOURCE_PYTHON_MODULE})
SET_TARGET_PROPERTIES(${PYTHON_MODULE}
PROPERTIES PREFIX ""
OUTPUT_NAME dynamic_graph_tests/${LIBRARY_NAME}/wrap
OUTPUT_NAME ${LIBRARY_NAME}/wrap
)
CMAKE_POLICY(POP)
TARGET_LINK_LIBRARIES(${PYTHON_MODULE} ${PUBLIC_KEYWORD} "-Wl,--no-as-needed")
TARGET_LINK_LIBRARIES(${PYTHON_MODULE} ${PUBLIC_KEYWORD} ${LIBRARY_NAME} ${PYTHON_LIBRARY})
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
## Test it
ADD_PYTHON_UNIT_TEST("test-custom-entity" "unitTesting/test_custom_entity.py" src unitTesting)
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