From a97950c5e36848e375b88a7cbed50c4aebe76da0 Mon Sep 17 00:00:00 2001
From: Guilhem Saurel <guilhem.saurel@laas.fr>
Date: Tue, 3 Mar 2020 18:33:09 +0100
Subject: [PATCH] [CMake] clean: keep minimal required instructions

---
 CMakeLists.txt                                | 62 +++++++++----
 cmake                                         |  2 +-
 include/dynamic-graph/python/CMakeLists.txt   | 17 ----
 .../dynamic-graph/python/link-to-python.hh.in | 14 ---
 src/CMakeLists.txt                            | 87 +++----------------
 src/dynamic_graph/CMakeLists.txt              | 35 ++++----
 src/interpreter.cc                            |  9 +-
 tests/CMakeLists.txt                          | 46 ++++++++++
 {unitTesting => tests}/custom_entity.cpp      |  0
 .../dynamic-graph-python-test.cc              |  0
 tests/dynamic-graph-python-test.cpp           |  8 ++
 .../dynamic-graph-python-test.hh              |  0
 .../interpreter-test-runfile.cc               | 14 +--
 {unitTesting => tests}/interpreter-test.cc    |  0
 {unitTesting => tests}/main.cc                |  0
 {unitTesting => tests}/test_bindings.py       |  0
 {unitTesting => tests}/test_custom_entity.py  |  0
 .../test_python-name_error.py                 |  0
 {unitTesting => tests}/test_python-ok.py      |  0
 .../test_python-restart_interpreter.py        |  0
 .../test_python-syntax_error.py               |  0
 unitTesting/CMakeLists.txt                    | 66 --------------
 22 files changed, 145 insertions(+), 215 deletions(-)
 delete mode 100644 include/dynamic-graph/python/CMakeLists.txt
 delete mode 100644 include/dynamic-graph/python/link-to-python.hh.in
 create mode 100644 tests/CMakeLists.txt
 rename {unitTesting => tests}/custom_entity.cpp (100%)
 rename {unitTesting => tests}/dynamic-graph-python-test.cc (100%)
 create mode 100644 tests/dynamic-graph-python-test.cpp
 rename {unitTesting => tests}/dynamic-graph-python-test.hh (100%)
 rename {unitTesting => tests}/interpreter-test-runfile.cc (81%)
 rename {unitTesting => tests}/interpreter-test.cc (100%)
 rename {unitTesting => tests}/main.cc (100%)
 rename {unitTesting => tests}/test_bindings.py (100%)
 rename {unitTesting => tests}/test_custom_entity.py (100%)
 rename {unitTesting => tests}/test_python-name_error.py (100%)
 rename {unitTesting => tests}/test_python-ok.py (100%)
 rename {unitTesting => tests}/test_python-restart_interpreter.py (100%)
 rename {unitTesting => tests}/test_python-syntax_error.py (100%)
 delete mode 100644 unitTesting/CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3b9df1a..08b9695 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,46 +2,74 @@
 
 CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
 
-SET(PROJECT_NAMESPACE stack-of-tasks)
+# Project properties
+SET(PROJECT_ORG stack-of-tasks)
 SET(PROJECT_NAME dynamic-graph-python)
 SET(PROJECT_DESCRIPTION "Dynamic graph library Python bindings")
-SET(PROJECT_URL "http://github.com/${PROJECT_NAMESPACE}/${PROJECT_NAME}")
+SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
 
+# Project options
+OPTION(SUFFIX_SO_VERSION "Suffix library name with its version" ON)
+
+# Project configuration
 SET(PROJECT_USE_CMAKE_EXPORT TRUE)
 SET(CUSTOM_HEADER_DIR "dynamic-graph/python")
 SET(CXX_DISABLE_WERROR TRUE)
 SET(DOXYGEN_USE_MATHJAX YES)
 
+# JRL-cmakemodule setup
 INCLUDE(cmake/base.cmake)
 INCLUDE(cmake/boost.cmake)
-INCLUDE(cmake/eigen.cmake)
 INCLUDE(cmake/python.cmake)
-INCLUDE(cmake/test.cmake)
 INCLUDE(cmake/sphinx.cmake)
 
-SET(PKG_CONFIG_ADDITIONAL_VARIABLES plugindir ${PKG_CONFIG_ADDITIONAL_VARIABLES})
-
-OPTION(SUFFIX_SO_VERSION
-  "Suffix shared library name by a string depending on git status of project"
-  ON)
-
+# Project definition
 COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
 PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
 
+# Project dependencies
 FINDPYTHON()
-INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_DIRS})
 
-ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES eigen3)
 ADD_PROJECT_DEPENDENCY(dynamic-graph REQUIRED PKG_CONFIG_REQUIRES dynamic-graph)
-
-PKG_CONFIG_APPEND_LIBS("dynamic-graph-python")
-
 SET(BOOST_COMPONENTS filesystem system thread program_options unit_test_framework python)
 SEARCH_FOR_BOOST()
 
+
+# Main Library
+SET(${PROJECT_NAME}_HEADERS
+  include/${CUSTOM_HEADER_DIR}/api.hh
+  include/${CUSTOM_HEADER_DIR}/convert-dg-to-py.hh
+  include/${CUSTOM_HEADER_DIR}/dynamic-graph-py.hh
+  include/${CUSTOM_HEADER_DIR}/exception.hh
+  include/${CUSTOM_HEADER_DIR}/exception-python.hh
+  include/${CUSTOM_HEADER_DIR}/interpreter.hh
+  include/${CUSTOM_HEADER_DIR}/python-compat.hh
+  include/${CUSTOM_HEADER_DIR}/signal-wrapper.hh
+  )
+
+SET(${PROJECT_NAME}_SOURCES
+  src/interpreter.cc
+  src/dynamic_graph/python-compat.cc
+  )
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED
+  ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS})
+TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${PYTHON_INCLUDE_DIRS})
+TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES}
+  ${PYTHON_LIBRARY} ${Boost_PYTHON_LIBRARIES} dynamic-graph::dynamic-graph)
+
+IF(SUFFIX_SO_VERSION)
+  SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
+ENDIF(SUFFIX_SO_VERSION)
+
+TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE PYTHON_LIBRARY="${PYTHON_LIBRARY}")
+
+INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
+
 ADD_SUBDIRECTORY(src)
-ADD_SUBDIRECTORY(include/${CUSTOM_HEADER_DIR})
 ADD_SUBDIRECTORY(doc)
-ADD_SUBDIRECTORY(unitTesting)
+ADD_SUBDIRECTORY(tests)
 
+PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME})
 INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})
diff --git a/cmake b/cmake
index 4514454..321eb1c 160000
--- a/cmake
+++ b/cmake
@@ -1 +1 @@
-Subproject commit 4514454f5f9462047b5c29f61b6c3e0db731c416
+Subproject commit 321eb1ccf1d94570eb564f3659b13ef3ef82239e
diff --git a/include/dynamic-graph/python/CMakeLists.txt b/include/dynamic-graph/python/CMakeLists.txt
deleted file mode 100644
index d33af63..0000000
--- a/include/dynamic-graph/python/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright 2010-2019, Florent Lamiraux, Guilhem Saurel, LAAS-CNRS
-
-SET(${PROJECT_NAME}_HEADERS
-  api.hh
-  convert-dg-to-py.hh
-  dynamic-graph-py.hh
-  exception.hh
-  exception-python.hh
-  interpreter.hh
-  python-compat.hh
-  signal-wrapper.hh
-)
-
-INSTALL(FILES ${${PROJECT_NAME}_HEADERS} DESTINATION include/${CUSTOM_HEADER_DIR})
-
-CONFIG_FILES(link-to-python.hh)
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/link-to-python.hh DESTINATION include/${CUSTOM_HEADER_DIR})
diff --git a/include/dynamic-graph/python/link-to-python.hh.in b/include/dynamic-graph/python/link-to-python.hh.in
deleted file mode 100644
index 91b7bd3..0000000
--- a/include/dynamic-graph/python/link-to-python.hh.in
+++ /dev/null
@@ -1,14 +0,0 @@
-// -*- mode: c++ -*-
-// Copyright 2011, Florent Lamiraux, CNRS.
-
-#ifdef WIN32
-#include <Windows.h>
-#else
-#include <dlfcn.h>
-#endif
-
-namespace dynamicgraph {
-  namespace python {
-    std::string libpython("@PYTHON_LIBRARY@");
-  } // namespace python
-} // namespace dynamicgraph
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 39a57e4..b600bd2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,80 +1,21 @@
-# Copyright 2010-2020, Florent Lamiraux, Thomas Moulard, Olivier Stasse, Guilhem Saurel, JRL, CNRS/AIST, LAAS-CNRS
-
-#
-#
-#  Python interpreter
-#
-#
-
-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}/>
-  INTERFACE
-  $<INSTALL_INTERFACE:include>
-)
-
-TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${PYTHON_LIBRARY})
-
-IF(UNIX)
-  TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${Boost_LIBRARIES})
-  TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${Boost_PYTHON_LIBRARIES})
-  TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${CMAKE_DL_LIBS})
-ENDIF(UNIX)
-
-IF (SUFFIX_SO_VERSION)
-  SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
-ENDIF ()
-
-TARGET_LINK_LIBRARIES(${LIBRARY_NAME} dynamic-graph::dynamic-graph)
-
-INSTALL(TARGETS ${LIBRARY_NAME}
-  EXPORT ${TARGETS_EXPORT_NAME}
-  PUBLIC_HEADER
-  INCLUDES DESTINATION include
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  )
-
-#
-#
 #  Python bindings
-#
-#
 
 ADD_SUBDIRECTORY(dynamic_graph)
 
-SET (PYTHON_SOURCES
-    __init__.py
-    attrpath.py
-    entity.py
-    signal_base.py
-    script_shortcuts.py
-    tools.py
-    )
+SET(PYTHON_SOURCES
+  __init__.py
+  attrpath.py
+  entity.py
+  signal_base.py
+  script_shortcuts.py
+  tools.py
+  )
 
-FOREACH (SOURCE ${PYTHON_SOURCES})
-    PYTHON_INSTALL_ON_SITE(dynamic_graph ${SOURCE})
-ENDFOREACH (SOURCE)
+FOREACH(source ${PYTHON_SOURCES})
+  PYTHON_INSTALL_ON_SITE(dynamic_graph ${source})
+ENDFOREACH(source)
 
 # --- ADD the wrap on the dg modules
-# Tracer plugin
-IF(WIN32)
-    SET(TRACER_PLUGIN ${DYNAMIC_GRAPH_PLUGINDIR}/tracer${CMAKE_STATIC_LIBRARY_SUFFIX})
-ELSE(WIN32)
-    SET(TRACER_PLUGIN ${DYNAMIC_GRAPH_PLUGINDIR}/tracer${CMAKE_SHARED_LIBRARY_SUFFIX})
-ENDIF(WIN32)
-DYNAMIC_GRAPH_PYTHON_MODULE("tracer" ${TRACER_PLUGIN} tracer-wrap)
-
-# TracerRealTime plugin
-IF(WIN32)
-    SET(TRACERREALTIME_PLUGIN ${DYNAMIC_GRAPH_PLUGINDIR}/tracer-real-time${CMAKE_STATIC_LIBRARY_SUFFIX})
-ELSE(WIN32)
-    SET(TRACERREALTIME_PLUGIN ${DYNAMIC_GRAPH_PLUGINDIR}/tracer-real-time${CMAKE_SHARED_LIBRARY_SUFFIX})
-ENDIF(WIN32)
-DYNAMIC_GRAPH_PYTHON_MODULE("tracer_real_time" ${TRACERREALTIME_PLUGIN} tracer_real_time-wrap)
+LINK_DIRECTORIES(${DYNAMIC_GRAPH_PLUGINDIR})
+DYNAMIC_GRAPH_PYTHON_MODULE("tracer" tracer tracer-wrap)
+DYNAMIC_GRAPH_PYTHON_MODULE("tracer_real_time" tracer-real-time tracer_real_time-wrap)
diff --git a/src/dynamic_graph/CMakeLists.txt b/src/dynamic_graph/CMakeLists.txt
index abf9881..adc8bd7 100644
--- a/src/dynamic_graph/CMakeLists.txt
+++ b/src/dynamic_graph/CMakeLists.txt
@@ -2,27 +2,26 @@
 
 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
-    python-compat.cc
-    signal-base-py.cc
-    signal-caster-py.cc
-    signal-wrapper.cc
-    )
+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
+  python-compat.cc
+  signal-base-py.cc
+  signal-caster-py.cc
+  signal-wrapper.cc
+  )
 
-TARGET_LINK_LIBRARIES(${PYTHON_MODULE} ${PYTHON_LIBRARY})
-TARGET_LINK_LIBRARIES(${PYTHON_MODULE} dynamic-graph::dynamic-graph)
+TARGET_INCLUDE_DIRECTORIES(${PYTHON_MODULE} SYSTEM PUBLIC ${PYTHON_INCLUDE_DIRS})
+TARGET_LINK_LIBRARIES(${PYTHON_MODULE} ${PYTHON_LIBRARY}
+  dynamic-graph::dynamic-graph)
 
 # Remove prefix lib
-SET_TARGET_PROPERTIES(${PYTHON_MODULE}
-    PROPERTIES PREFIX "")
+SET_TARGET_PROPERTIES(${PYTHON_MODULE} PROPERTIES PREFIX "")
 
 INSTALL(TARGETS ${PYTHON_MODULE}
   EXPORT ${TARGETS_EXPORT_NAME}
diff --git a/src/interpreter.cc b/src/interpreter.cc
index 5ee3e05..d0d35d9 100644
--- a/src/interpreter.cc
+++ b/src/interpreter.cc
@@ -1,10 +1,15 @@
 // -*- mode: c++ -*-
 // Copyright 2011, Florent Lamiraux, CNRS.
 
+#ifdef WIN32
+#include <Windows.h>
+#else
+#include <dlfcn.h>
+#endif
+
 #include <iostream>
 #include "dynamic-graph/debug.h"
 #include "dynamic-graph/python/interpreter.hh"
-#include "dynamic-graph/python/link-to-python.hh"
 
 std::ofstream dg_debugfile("/tmp/dynamic-graph-traces.txt", std::ios::trunc& std::ios::out);
 
@@ -61,7 +66,7 @@ Interpreter::Interpreter() {
   // load python dynamic library
   // this is silly, but required to be able to import dl module.
 #ifndef WIN32
-  dlopen(libpython.c_str(), RTLD_LAZY | RTLD_GLOBAL);
+  dlopen(PYTHON_LIBRARY, RTLD_LAZY | RTLD_GLOBAL);
 #endif
   Py_Initialize();
   PyEval_InitThreads();
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 0000000..acec158
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,46 @@
+# Copyright 2010-2020, Florent Lamiraux, Thomas Moulard, Olivier Stasse, Guilhem Saurel, JRL, CNRS/AIST, LAAS-CNRS
+
+# Test the interpreter
+ADD_UNIT_TEST(interpreter-test interpreter-test.cc)
+TARGET_LINK_LIBRARIES(interpreter-test ${PROJECT_NAME})
+
+# Test runfile
+ADD_UNIT_TEST(interpreter-test-runfile interpreter-test-runfile.cc)
+TARGET_LINK_LIBRARIES(interpreter-test-runfile ${PYTHON_LIBRARY} ${Boost_LIBRARIES} ${PROJECT_NAME})
+TARGET_COMPILE_DEFINITIONS(interpreter-test-runfile PRIVATE PATH="${CMAKE_CURRENT_LIST_DIR}/")
+
+# Test the module generation
+## Create an entity
+
+SET(LIBRARY_NAME "custom_entity")
+ADD_LIBRARY(${LIBRARY_NAME} SHARED "${LIBRARY_NAME}.cpp")
+IF(SUFFIX_SO_VERSION)
+  SET_TARGET_PROPERTIES(${LIBRARY_NAME}
+    PROPERTIES SOVERSION ${PROJECT_VERSION})
+ENDIF(SUFFIX_SO_VERSION)
+
+target_link_libraries(${LIBRARY_NAME} dynamic-graph::dynamic-graph)
+
+## Create its bindings
+## This mimics DYNAMIC_GRAPH_PYTHON_MODULE(${LIBRARY_NAME} ${LIBRARY_NAME} "${LIBRARY_NAME}-wrap")
+
+CONFIGURE_FILE(
+  ${PROJECT_SOURCE_DIR}/cmake/dynamic_graph/submodule/__init__.py.cmake
+  ${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}/__init__.py
+  )
+SET(PYTHON_MODULE "${LIBRARY_NAME}-wrap")
+SET(SOURCE_PYTHON_MODULE "cmake/dynamic_graph/python-module-py.cc")
+ADD_LIBRARY(${PYTHON_MODULE} MODULE ${PROJECT_SOURCE_DIR}/${SOURCE_PYTHON_MODULE})
+SET_TARGET_PROPERTIES(${PYTHON_MODULE} PROPERTIES
+  PREFIX ""
+  OUTPUT_NAME ${LIBRARY_NAME}/wrap)
+
+TARGET_LINK_LIBRARIES(${PYTHON_MODULE} "-Wl,--no-as-needed")
+TARGET_LINK_LIBRARIES(${PYTHON_MODULE} ${LIBRARY_NAME} ${PYTHON_LIBRARY})
+TARGET_INCLUDE_DIRECTORIES(${PYTHON_MODULE} SYSTEM PUBLIC ${PYTHON_INCLUDE_DIRS})
+
+## Test it
+ADD_PYTHON_UNIT_TEST("test-custom-entity" "tests/test_custom_entity.py" src tests)
+
+# also test other bindings, using this custom entity
+ADD_PYTHON_UNIT_TEST("test-bindings" "tests/test_bindings.py" src tests)
diff --git a/unitTesting/custom_entity.cpp b/tests/custom_entity.cpp
similarity index 100%
rename from unitTesting/custom_entity.cpp
rename to tests/custom_entity.cpp
diff --git a/unitTesting/dynamic-graph-python-test.cc b/tests/dynamic-graph-python-test.cc
similarity index 100%
rename from unitTesting/dynamic-graph-python-test.cc
rename to tests/dynamic-graph-python-test.cc
diff --git a/tests/dynamic-graph-python-test.cpp b/tests/dynamic-graph-python-test.cpp
new file mode 100644
index 0000000..a45ddad
--- /dev/null
+++ b/tests/dynamic-graph-python-test.cpp
@@ -0,0 +1,8 @@
+/*
+ *  Copyright
+ */
+
+#include <iostream>
+#include "dynamic-graph-python-test.hh"
+
+GraphTest::GraphTest() { std::cout << "Constructor of unitTesting object of class Graph." << std::endl; }
diff --git a/unitTesting/dynamic-graph-python-test.hh b/tests/dynamic-graph-python-test.hh
similarity index 100%
rename from unitTesting/dynamic-graph-python-test.hh
rename to tests/dynamic-graph-python-test.hh
diff --git a/unitTesting/interpreter-test-runfile.cc b/tests/interpreter-test-runfile.cc
similarity index 81%
rename from unitTesting/interpreter-test-runfile.cc
rename to tests/interpreter-test-runfile.cc
index 0ae7ea2..e87047c 100644
--- a/unitTesting/interpreter-test-runfile.cc
+++ b/tests/interpreter-test-runfile.cc
@@ -49,18 +49,18 @@ int main(int argc, char** argv) {
   // This test succeeds only because it is launched before "test_python-ok.py"
   // because re as been imported in a previous test and it is not
   // safe to delete imported module...
-  res = testFile("test_python-name_error.py",
+  res = testFile(PATH "test_python-name_error.py",
                  std::string("Traceback (most recent call last):\n"
-                             "  File \"test_python-name_error.py\", line 7, in <module>\n"
+                             "  File \"" PATH "test_python-name_error.py\", line 7, in <module>\n"
                              "    pathList = re.split(':', pkgConfigPath)  # noqa\n"
                              "NameError: name 're' is not defined\n"),
                  numTest) &&
         res;
 
-  res = testFile("test_python-ok.py", "", numTest) && res;
-  res = testFile("unexistant_file.py", "unexistant_file.py cannot be open", numTest) && res;
-  res = testFile("test_python-syntax_error.py",
-                 std::string("  File \"test_python-syntax_error.py\", line 2\n"
+  res = testFile(PATH "test_python-ok.py", "", numTest) && res;
+  res = testFile(PATH "unexistant_file.py", PATH "unexistant_file.py cannot be open", numTest) && res;
+  res = testFile(PATH "test_python-syntax_error.py",
+                 std::string("  File \"" PATH "test_python-syntax_error.py\", line 2\n"
                              "    hello world\n"
 #if PY_MINOR_VERSION >= 8
                              "          ^\n"
@@ -70,6 +70,6 @@ int main(int argc, char** argv) {
                              "SyntaxError: invalid syntax\n"),
                  numTest) &&
         res;
-  res = testInterpreterDestructor("test_python-restart_interpreter.py", "") && res;
+  res = testInterpreterDestructor(PATH "test_python-restart_interpreter.py", "") && res;
   return (res ? 0 : 1);
 }
diff --git a/unitTesting/interpreter-test.cc b/tests/interpreter-test.cc
similarity index 100%
rename from unitTesting/interpreter-test.cc
rename to tests/interpreter-test.cc
diff --git a/unitTesting/main.cc b/tests/main.cc
similarity index 100%
rename from unitTesting/main.cc
rename to tests/main.cc
diff --git a/unitTesting/test_bindings.py b/tests/test_bindings.py
similarity index 100%
rename from unitTesting/test_bindings.py
rename to tests/test_bindings.py
diff --git a/unitTesting/test_custom_entity.py b/tests/test_custom_entity.py
similarity index 100%
rename from unitTesting/test_custom_entity.py
rename to tests/test_custom_entity.py
diff --git a/unitTesting/test_python-name_error.py b/tests/test_python-name_error.py
similarity index 100%
rename from unitTesting/test_python-name_error.py
rename to tests/test_python-name_error.py
diff --git a/unitTesting/test_python-ok.py b/tests/test_python-ok.py
similarity index 100%
rename from unitTesting/test_python-ok.py
rename to tests/test_python-ok.py
diff --git a/unitTesting/test_python-restart_interpreter.py b/tests/test_python-restart_interpreter.py
similarity index 100%
rename from unitTesting/test_python-restart_interpreter.py
rename to tests/test_python-restart_interpreter.py
diff --git a/unitTesting/test_python-syntax_error.py b/tests/test_python-syntax_error.py
similarity index 100%
rename from unitTesting/test_python-syntax_error.py
rename to tests/test_python-syntax_error.py
diff --git a/unitTesting/CMakeLists.txt b/unitTesting/CMakeLists.txt
deleted file mode 100644
index 1d87466..0000000
--- a/unitTesting/CMakeLists.txt
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright 2010-2020, Florent Lamiraux, Thomas Moulard, Olivier Stasse, Guilhem Saurel, JRL, CNRS/AIST, LAAS-CNRS
-# 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)
-TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} dynamic-graph-python)
-TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} ${PYTHON_LIBRARY})
-TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} ${Boost_LIBRARIES})
-ADD_TEST(${EXECUTABLE_NAME}  ${EXECUTABLE_NAME})
-
-ADD_CUSTOM_COMMAND(TARGET interpreter-test-runfile POST_BUILD
-  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/unitTesting/test_python-ok.py
-  ${CMAKE_BINARY_DIR}/unitTesting
-  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/unitTesting/test_python-name_error.py
-  ${CMAKE_BINARY_DIR}/unitTesting
-  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/unitTesting/test_python-syntax_error.py
-  ${CMAKE_BINARY_DIR}/unitTesting
-  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/unitTesting/test_python-restart_interpreter.py
-  ${CMAKE_BINARY_DIR}/unitTesting
-)
-
-
-# Test the module generation
-## Create an entity
-
-SET(LIBRARY_NAME "custom_entity")
-ADD_LIBRARY(${LIBRARY_NAME} SHARED ${LIBRARY_NAME}.cpp)
-IF (SUFFIX_SO_VERSION)
-  SET_TARGET_PROPERTIES(${LIBRARY_NAME}
-    PROPERTIES SOVERSION ${PROJECT_VERSION})
-ENDIF ()
-SET_TARGET_PROPERTIES(${LIBRARY_NAME}
-  PROPERTIES
-  PREFIX ""
-  INSTALL_RPATH ${DYNAMIC_GRAPH_PLUGINDIR})
-
-target_link_libraries(${LIBRARY_NAME} dynamic-graph::dynamic-graph)
-
-## Create its bindings
-## This mimics DYNAMIC_GRAPH_PYTHON_MODULE(${LIBRARY_NAME} ${LIBRARY_NAME} "${LIBRARY_NAME}-wrap")
-
-CONFIGURE_FILE(
-  ${PROJECT_SOURCE_DIR}/cmake/dynamic_graph/submodule/__init__.py.cmake
-  ${PROJECT_BINARY_DIR}/unitTesting/${LIBRARY_NAME}/__init__.py
-  )
-SET(PYTHON_MODULE "${LIBRARY_NAME}-wrap")
-SET(SOURCE_PYTHON_MODULE "cmake/dynamic_graph/python-module-py.cc")
-ADD_LIBRARY(${PYTHON_MODULE} MODULE ${PROJECT_SOURCE_DIR}/${SOURCE_PYTHON_MODULE})
-SET_TARGET_PROPERTIES(${PYTHON_MODULE}
-  PROPERTIES PREFIX ""
-  OUTPUT_NAME ${LIBRARY_NAME}/wrap
-  )
-
-TARGET_LINK_LIBRARIES(${PYTHON_MODULE} ${PUBLIC_KEYWORD} "-Wl,--no-as-needed")
-TARGET_LINK_LIBRARIES(${PYTHON_MODULE} ${PUBLIC_KEYWORD} ${LIBRARY_NAME} ${PYTHON_LIBRARY})
-
-## Test it
-ADD_PYTHON_UNIT_TEST("test-custom-entity" "unitTesting/test_custom_entity.py" src unitTesting)
-
-# also test other bindings, using this custom entity
-ADD_PYTHON_UNIT_TEST("test-bindings" "unitTesting/test_bindings.py" src unitTesting)
-- 
GitLab