Commit 7c44de53 authored by Guilhem Saurel's avatar Guilhem Saurel

[CMake] move headers in include, and lib at its place

parent 24d3a745
......@@ -37,6 +37,6 @@ SEARCH_FOR_BOOST()
SEARCH_FOR_EIGEN()
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(include/${CUSTOM_HEADER_DIR})
ADD_SUBDIRECTORY(doc)
ADD_SUBDIRECTORY(unitTesting)
# Copyright 2010-2019, Florent Lamiraux, Guilhem Saurel, LAAS-CNRS
SET(${PROJECT_NAME}_HEADERS
dynamic-graph/python/api.hh
dynamic-graph/python/exception-python.hh
api.hh
convert-dg-to-py.hh
dynamic-graph-py.hh
exception.hh
exception-python.hh
interpreter.hh
signal-wrapper.hh
)
CONFIG_FILES(link-to-python.hh)
......@@ -180,7 +180,7 @@ __attribute__((unused)) static struct PyModuleDef dynamicGraphModuleDef = {
NULL,
NULL};
#define GETSTATE(m) ((struct dynamicgraph::python::module_state*)PyModule_GetState(m))
#define DGPYERROR GETSTATE(PyState_FindModule(&dynamicgraph::python::dynamicGraphModuleDef))->dgpyError
#define DGPYERROR GETSTATE(PyState_FindModule(&dynamicGraphModuleDef))->dgpyError
#define INITERROR return NULL
#else
__attribute__((unused)) static struct module_state _state;
......
......@@ -3,6 +3,8 @@
#ifndef DYNAMIC_GRAPH_PYTHON_EXCEPTION
#define DYNAMIC_GRAPH_PYTHON_EXCEPTION
#include "dynamic-graph/python/dynamic-graph-py.hh"
/// \brief Catch all exceptions which may be sent when C++ code is
/// called.
#define CATCH_ALL_EXCEPTIONS() \
......
# Copyright 2010 - 2019, Florent Lamiraux, Thomas Moulard, Guilhem Saurel, JRL, CNRS/AIST, LAAS-CNRS
#
# Python
#
INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS} ${PYTHON_LIBRARY_DIRS})
#
#
# Python interpreter
#
#
SET(LIBRARY_NAME ${PROJECT_NAME})
ADD_LIBRARY(${LIBRARY_NAME}
SHARED
interpreter.cc)
ADD_LIBRARY(${LIBRARY_NAME} SHARED interpreter.cc)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME}
${PYTHON_LIBRARY})
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${PYTHON_LIBRARY})
TARGET_LINK_BOOST_PYTHON(${LIBRARY_NAME})
IF(UNIX)
......@@ -29,8 +20,7 @@ ENDIF(UNIX)
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} dynamic-graph)
INSTALL(TARGETS ${LIBRARY_NAME}
DESTINATION lib)
INSTALL(TARGETS ${LIBRARY_NAME} DESTINATION lib)
#
#
......@@ -38,36 +28,7 @@ INSTALL(TARGETS ${LIBRARY_NAME}
#
#
SET(PYTHON_MODULE wrap)
ADD_LIBRARY(${PYTHON_MODULE}
MODULE
convert-dg-to-py.cc
debug-py.cc
dynamic-graph-py.cc
entity-py.cc
exception-python.cc
factory-py.cc
pool-py.cc
signal-base-py.cc
signal-caster-py.cc
signal-wrapper.cc
)
# Remove prefix lib
SET_TARGET_PROPERTIES(${PYTHON_MODULE}
PROPERTIES PREFIX "")
PKG_CONFIG_USE_DEPENDENCY(${PYTHON_MODULE} dynamic-graph)
CONFIG_FILES(link-to-python.hh)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
#
# Installation
#
INSTALL(TARGETS ${PYTHON_MODULE} DESTINATION ${PYTHON_SITELIB}/dynamic_graph)
ADD_SUBDIRECTORY(dynamic_graph)
SET (PYTHON_SOURCES
__init__.py
......
# Copyright 2010 - 2019, Florent Lamiraux, Thomas Moulard, Guilhem Saurel, JRL, CNRS/AIST, LAAS-CNRS
SET(PYTHON_MODULE wrap)
ADD_LIBRARY(${PYTHON_MODULE}
MODULE
convert-dg-to-py.cc
debug-py.cc
dynamic-graph-py.cc
entity-py.cc
exception-python.cc
factory-py.cc
pool-py.cc
signal-base-py.cc
signal-caster-py.cc
signal-wrapper.cc
)
# Remove prefix lib
SET_TARGET_PROPERTIES(${PYTHON_MODULE}
PROPERTIES PREFIX "")
PKG_CONFIG_USE_DEPENDENCY(${PYTHON_MODULE} dynamic-graph)
INSTALL(TARGETS ${PYTHON_MODULE} DESTINATION ${PYTHON_SITELIB}/dynamic_graph)
// Copyright 2010, Florent Lamiraux, Thomas Moulard, LAAS-CNRS.
#include "../src/convert-dg-to-py.hh"
#include <iostream>
#include <sstream>
......@@ -8,6 +7,8 @@
#include <dynamic-graph/signal.h>
#include <dynamic-graph/signal-caster.h>
#include "dynamic-graph/python/convert-dg-to-py.hh"
namespace dynamicgraph {
using ::dynamicgraph::SignalBase;
......
......@@ -12,10 +12,10 @@
#include <dynamic-graph/pool.h>
#include <dynamic-graph/entity.h>
#include <vector>
#include "exception.hh"
#include "dynamic-graph/python/exception.hh"
#include <boost/shared_ptr.hpp>
#include "dynamic-graph-py.hh"
#include "dynamic-graph/python/dynamic-graph-py.hh"
typedef boost::shared_ptr<std::ofstream> ofstreamShrPtr;
......
......@@ -9,9 +9,9 @@
#include <dynamic-graph/exception-factory.h>
#include <dynamic-graph/signal-base.h>
#include "exception.hh"
#include "dynamic-graph-py.hh"
#include "signal-wrapper.hh"
#include "dynamic-graph/python/exception.hh"
#include "dynamic-graph/python/dynamic-graph-py.hh"
#include "dynamic-graph/python/signal-wrapper.hh"
namespace dynamicgraph {
namespace python {
......@@ -117,7 +117,7 @@ void initwrap(void)
if (module == NULL) INITERROR;
struct dynamicgraph::python::module_state* st = GETSTATE(module);
DGPYERROR = PyErr_NewException(const_cast<char*>("dynamic_graph.dgpyError"), NULL, NULL);
st->dgpyError = PyErr_NewException(const_cast<char*>("dynamic_graph.dgpyError"), NULL, NULL);
if (st->dgpyError == NULL) {
Py_DECREF(module);
INITERROR;
......
......@@ -11,9 +11,9 @@
#include <dynamic-graph/pool.h>
#include <dynamic-graph/linear-algebra.h>
#include "dynamic-graph-py.hh"
#include "convert-dg-to-py.hh"
#include "exception.hh"
#include "dynamic-graph/python/dynamic-graph-py.hh"
#include "dynamic-graph/python/convert-dg-to-py.hh"
#include "dynamic-graph/python/exception.hh"
// Ignore "dereferencing type-punned pointer will break strict-aliasing rules"
// warnings on gcc caused by Py_RETURN_TRUE and Py_RETURN_FALSE.
......
......@@ -7,7 +7,7 @@
*
*/
#include <dynamic-graph/python/exception-python.hh>
#include "dynamic-graph/python/exception-python.hh"
#include <dynamic-graph/debug.h>
#include <stdarg.h>
#include <cstdio>
......
......@@ -4,7 +4,7 @@
#include <iostream>
#include <dynamic-graph/factory.h>
#include "dynamic-graph-py.hh"
#include "dynamic-graph/python/dynamic-graph-py.hh"
using dynamicgraph::Entity;
using dynamicgraph::ExceptionAbstract;
......
......@@ -4,9 +4,9 @@
#include <dynamic-graph/pool.h>
#include <dynamic-graph/entity.h>
#include <vector>
#include "exception.hh"
#include "dynamic-graph-py.hh"
#include "dynamic-graph/python/exception.hh"
#include "dynamic-graph/python/dynamic-graph-py.hh"
namespace dynamicgraph {
namespace python {
......
......@@ -12,10 +12,10 @@
#include <dynamic-graph/pool.h>
#include <dynamic-graph/factory.h>
#include "dynamic-graph-py.hh"
#include "convert-dg-to-py.hh"
#include "exception.hh"
#include "signal-wrapper.hh"
#include "dynamic-graph/python/dynamic-graph-py.hh"
#include "dynamic-graph/python/convert-dg-to-py.hh"
#include "dynamic-graph/python/exception.hh"
#include "dynamic-graph/python/signal-wrapper.hh"
using dynamicgraph::SignalBase;
......
......@@ -6,7 +6,7 @@
#include <dynamic-graph/signal-caster.h>
#include "dynamic-graph-py.hh"
#include "dynamic-graph/python/dynamic-graph-py.hh"
namespace dynamicgraph {
namespace python {
......
// Copyright (c) 2018, Joseph Mirabel
// Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
#include "signal-wrapper.hh"
#include <Python.h>
#include <dynamic-graph/factory.h>
#include <dynamic-graph/command-bind.h>
#include "dynamic-graph/python/signal-wrapper.hh"
namespace dynamicgraph {
namespace python {
namespace signalWrapper {
......
......@@ -4,7 +4,7 @@
#include <iostream>
#include "dynamic-graph/debug.h"
#include "dynamic-graph/python/interpreter.hh"
#include "link-to-python.hh"
#include "dynamic-graph/python/link-to-python.hh"
#include <boost/python/errors.hpp>
#include <boost/python/object.hpp>
......
......@@ -27,9 +27,8 @@ ADD_CUSTOM_COMMAND(TARGET interpreter-test-runfile POST_BUILD
# Test the module generation
## Create an entity
set(LIBRARY_NAME custom_entity)
SET(LIBRARY_NAME "custom_entity")
ADD_LIBRARY(${LIBRARY_NAME} SHARED ${LIBRARY_NAME}.cpp)
SET_TARGET_PROPERTIES(${LIBRARY_NAME}
PROPERTIES
PREFIX ""
......
......@@ -2,17 +2,12 @@
# 2019 CNRS
#
import os
import sys
import time
from custom_entity import CustomEntity
from dynamic_graph import (addLoggerCoutOutputStream, addLoggerFileOutputStream, closeLoggerFileOutputStream,
real_time_logger_destroy, real_time_logger_spin_once)
from dynamic_graph.entity import VerbosityLevel
from dynamic_graph_tests.custom_entity import CustomEntity
# Put local python module at first priority
sys.path.insert(0, os.getcwd() + '/../src')
sys.path.insert(0, os.getcwd())
print(os.getcwd())
......
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