Repository: stack-of-tasks/eigenpy (language: python)

Issue:
remove warnings



Discussion / hints:

Fix patch:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7dfc8c49f..689dc3dba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -192,12 +192,6 @@ ELSE()
   TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj>)
 ENDIF()
 
-IF(Boost_VERSION GREATER 107299)
-  # Silence a warning about a deprecated use of boost bind by boost python
-  # at least fo boost 1.73 to 1.75
-  ADD_DEFINITIONS(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
-ENDIF()
-
 TARGET_LINK_BOOST_PYTHON(${PROJECT_NAME} PUBLIC)
 INSTALL(TARGETS ${PROJECT_NAME}
   EXPORT ${TARGETS_EXPORT_NAME}
diff --git a/include/eigenpy/computation-info.hpp b/include/eigenpy/computation-info.hpp
index 9fdf522ae..a66855c7c 100644
--- a/include/eigenpy/computation-info.hpp
+++ b/include/eigenpy/computation-info.hpp
@@ -5,10 +5,7 @@
 #ifndef __eigenpy_decompositions_computation_info_hpp__
 #define __eigenpy_decompositions_computation_info_hpp__
 
-#include <Eigen/Core>
-#include <boost/python.hpp>
-
-#include "eigenpy/config.hpp"
+#include "eigenpy/fwd.hpp"
 
 namespace eigenpy
 {
diff --git a/include/eigenpy/eigenpy.hpp b/include/eigenpy/eigenpy.hpp
index e33442a72..de34ad89f 100644
--- a/include/eigenpy/eigenpy.hpp
+++ b/include/eigenpy/eigenpy.hpp
@@ -8,7 +8,6 @@
 
 #include "eigenpy/fwd.hpp"
 #include "eigenpy/deprecated.hpp"
-#include "eigenpy/config.hpp"
 #include "eigenpy/eigen-typedef.hpp"
 
 #define ENABLE_SPECIFIC_MATRIX_TYPE(TYPE) \
diff --git a/include/eigenpy/exception.hpp b/include/eigenpy/exception.hpp
index 816ce4828..b9799bd63 100644
--- a/include/eigenpy/exception.hpp
+++ b/include/eigenpy/exception.hpp
@@ -3,12 +3,13 @@
  * Copyright 2018-2019, INRIA
  */
 
-#include <boost/python.hpp>
+#ifndef __eigenpy_exception_hpp__
+#define __eigenpy_exception_hpp__
+
 #include <exception>
 #include <string>
 
-#ifndef __eigenpy_exception_hpp__
-#define __eigenpy_exception_hpp__
+#include "eigenpy/fwd.hpp"
 
 namespace eigenpy
 {
diff --git a/include/eigenpy/fwd.hpp b/include/eigenpy/fwd.hpp
index 02ec33450..9ba263f72 100644
--- a/include/eigenpy/fwd.hpp
+++ b/include/eigenpy/fwd.hpp
@@ -7,13 +7,21 @@
 
 #include "eigenpy/config.hpp"
 
+// Silence a warning about a deprecated use of boost bind by boost python
+// at least fo boost 1.73 to 1.75
+// ref. https://github.com/stack-of-tasks/tsid/issues/128
+#define BOOST_BIND_GLOBAL_PLACEHOLDERS
 #include <boost/python.hpp>
-#include <Eigen/Core>
+#include <boost/python/scope.hpp>
 
 #define NO_IMPORT_ARRAY
   #include "eigenpy/numpy.hpp"
 #undef NO_IMPORT_ARRAY
 
+#undef BOOST_BIND_GLOBAL_PLACEHOLDERS
+
+#include <Eigen/Core>
+
 #if EIGEN_VERSION_AT_LEAST(3,2,90)
   #define EIGENPY_DEFAULT_ALIGNMENT_VALUE Eigen::Aligned16
 #else
diff --git a/include/eigenpy/geometry-conversion.hpp b/include/eigenpy/geometry-conversion.hpp
index dd6bb227b..de6f79882 100644
--- a/include/eigenpy/geometry-conversion.hpp
+++ b/include/eigenpy/geometry-conversion.hpp
@@ -6,9 +6,8 @@
 #ifndef __eigenpy_geometry_conversion_hpp__
 #define __eigenpy_geometry_conversion_hpp__
 
-#include <Eigen/Core>
+#include "eigenpy/fwd.hpp"
 #include <Eigen/Geometry>
-#include <boost/python.hpp>
 
 namespace eigenpy
 {
diff --git a/include/eigenpy/memory.hpp b/include/eigenpy/memory.hpp
index b500920b2..3a23d626f 100644
--- a/include/eigenpy/memory.hpp
+++ b/include/eigenpy/memory.hpp
@@ -6,7 +6,7 @@
 #ifndef __eigenpy_memory_hpp__
 #define __eigenpy_memory_hpp__
 
-#include <boost/python.hpp>
+#include "eigenpy/fwd.hpp"
 
 /**
  * This section contains a convenience MACRO which allows an easy specialization of
diff --git a/include/eigenpy/numpy.hpp b/include/eigenpy/numpy.hpp
index 0389f5296..8bb32150b 100644
--- a/include/eigenpy/numpy.hpp
+++ b/include/eigenpy/numpy.hpp
@@ -5,8 +5,7 @@
 #ifndef __eigenpy_numpy_hpp__
 #define __eigenpy_numpy_hpp__
 
-#include <boost/python.hpp>
-#include "eigenpy/config.hpp"
+#include "eigenpy/fwd.hpp"
 
 #ifndef PY_ARRAY_UNIQUE_SYMBOL
   #define PY_ARRAY_UNIQUE_SYMBOL EIGENPY_ARRAY_API
diff --git a/include/eigenpy/registration.hpp b/include/eigenpy/registration.hpp
index b9e339ed5..5f4458336 100644
--- a/include/eigenpy/registration.hpp
+++ b/include/eigenpy/registration.hpp
@@ -6,8 +6,7 @@
 #ifndef __eigenpy_registration_hpp__
 #define __eigenpy_registration_hpp__
 
-#include <boost/python.hpp>
-#include <boost/python/scope.hpp>
+#include "eigenpy/fwd.hpp"
 
 namespace eigenpy
 {
diff --git a/include/eigenpy/solvers/BFGSPreconditioners.hpp b/include/eigenpy/solvers/BFGSPreconditioners.hpp
index b24c30e99..524a43d13 100644
--- a/include/eigenpy/solvers/BFGSPreconditioners.hpp
+++ b/include/eigenpy/solvers/BFGSPreconditioners.hpp
@@ -17,8 +17,7 @@
 #ifndef __eigenpy_bfgs_preconditioners_hpp__
 #define __eigenpy_bfgs_preconditioners_hpp__
 
-#include <boost/python.hpp>
-#include <Eigen/Core>
+#include "eigenpy/fwd.hpp"
 #include <Eigen/IterativeLinearSolvers>
 
 #include "eigenpy/solvers/BasicPreconditioners.hpp"
diff --git a/include/eigenpy/solvers/BasicPreconditioners.hpp b/include/eigenpy/solvers/BasicPreconditioners.hpp
index 3fe921ac5..f6b95ac82 100644
--- a/include/eigenpy/solvers/BasicPreconditioners.hpp
+++ b/include/eigenpy/solvers/BasicPreconditioners.hpp
@@ -17,8 +17,7 @@
 #ifndef __eigenpy_basic_preconditioners_hpp__
 #define __eigenpy_basic_preconditioners_hpp__
 
-#include <boost/python.hpp>
-#include <Eigen/Core>
+#include "eigenpy/fwd.hpp"
 #include <Eigen/IterativeLinearSolvers>
 
 namespace eigenpy
diff --git a/include/eigenpy/solvers/ConjugateGradient.hpp b/include/eigenpy/solvers/ConjugateGradient.hpp
index f3d1487e0..4811f7f46 100644
--- a/include/eigenpy/solvers/ConjugateGradient.hpp
+++ b/include/eigenpy/solvers/ConjugateGradient.hpp
@@ -17,7 +17,7 @@
 #ifndef __eigenpy_conjugate_gradient_hpp__
 #define __eigenpy_conjugate_gradient_hpp__
 
-#include <boost/python.hpp>
+#include "eigenpy/fwd.hpp"
 #include <Eigen/IterativeLinearSolvers>
 
 #include "eigenpy/solvers/IterativeSolverBase.hpp"
diff --git a/include/eigenpy/solvers/IterativeSolverBase.hpp b/include/eigenpy/solvers/IterativeSolverBase.hpp
index 0c617587a..825feabf7 100644
--- a/include/eigenpy/solvers/IterativeSolverBase.hpp
+++ b/include/eigenpy/solvers/IterativeSolverBase.hpp
@@ -17,9 +17,7 @@
 #ifndef __eigenpy_iterative_solver_base_hpp__
 #define __eigenpy_iterative_solver_base_hpp__
 
-#include <boost/python.hpp>
-#include <Eigen/Core>
-
+#include "eigenpy/fwd.hpp"
 #include "eigenpy/solvers/SparseSolverBase.hpp"
 
 namespace eigenpy
diff --git a/include/eigenpy/solvers/LeastSquaresConjugateGradient.hpp b/include/eigenpy/solvers/LeastSquaresConjugateGradient.hpp
index 2d9e7617b..7acdb1ce1 100644
--- a/include/eigenpy/solvers/LeastSquaresConjugateGradient.hpp
+++ b/include/eigenpy/solvers/LeastSquaresConjugateGradient.hpp
@@ -17,7 +17,7 @@
 #ifndef __eigenpy_least_square_conjugate_gradient_hpp__
 #define __eigenpy_least_square_conjugate_gradient_hpp__
 
-#include <boost/python.hpp>
+#include "eigenpy/fwd.hpp"
 #include <Eigen/IterativeLinearSolvers>
 
 #include "eigenpy/solvers/IterativeSolverBase.hpp"
diff --git a/include/eigenpy/solvers/SparseSolverBase.hpp b/include/eigenpy/solvers/SparseSolverBase.hpp
index e96a97419..911fefb2d 100644
--- a/include/eigenpy/solvers/SparseSolverBase.hpp
+++ b/include/eigenpy/solvers/SparseSolverBase.hpp
@@ -17,8 +17,7 @@
 #ifndef __eigenpy_sparse_solver_base_hpp__
 #define __eigenpy_sparse_solver_base_hpp__
 
-#include <boost/python.hpp>
-#include <Eigen/Core>
+#include "eigenpy/fwd.hpp"
 
 namespace eigenpy
 {
diff --git a/src/decompositions/decompositions.cpp b/src/decompositions/decompositions.cpp
index a556617bd..a3bbd36e8 100644
--- a/src/decompositions/decompositions.cpp
+++ b/src/decompositions/decompositions.cpp
@@ -2,8 +2,7 @@
  * Copyright 2020 INRIA
  */
 
-#include <boost/python.hpp>
-#include <Eigen/Core>
+#include "eigenpy/fwd.hpp"
 
 #include "eigenpy/decompositions/decompositions.hpp"
 


Test patch:
diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt
index 4fd09e323..8b2160de2 100644
--- a/unittest/CMakeLists.txt
+++ b/unittest/CMakeLists.txt
@@ -7,9 +7,9 @@ MACRO(ADD_LIB_UNIT_TEST test)
   CREATE_CTEST_BUILD_TESTS_TARGET()
 
   IF(BUILD_TESTING)
-    ADD_LIBRARY(${test} SHARED ${test})
+    ADD_LIBRARY(${test} SHARED "${test}.cpp")
   ELSE(BUILD_TESTING)
-    ADD_LIBRARY(${test} SHARED EXCLUDE_FROM_ALL ${test})
+    ADD_LIBRARY(${test} SHARED EXCLUDE_FROM_ALL "${test}.cpp")
   ENDIF(BUILD_TESTING)
 
   TARGET_LINK_LIBRARIES(${test} PUBLIC ${PROJECT_NAME})
diff --git a/unittest/alpha/bnpy.cpp b/unittest/alpha/bnpy.cpp
index ed3716d19..b14ea1411 100644
--- a/unittest/alpha/bnpy.cpp
+++ b/unittest/alpha/bnpy.cpp
@@ -1,6 +1,6 @@
 /* Simple test using the boost::numpy interface: return an array and a matrix. */
 
-#include <boost/python.hpp>
+#include "eigenpy/fwd.hpp"
 #include "boost/numpy.hpp"
 
 namespace bp = boost::python;
diff --git a/unittest/alpha/eigen.cpp b/unittest/alpha/eigen.cpp
index 9efe84ae4..2def19602 100644
--- a/unittest/alpha/eigen.cpp
+++ b/unittest/alpha/eigen.cpp
@@ -1,5 +1,4 @@
-#include <Eigen/Core>
-#include <boost/python.hpp>
+#include "eigenpy/fwd.hpp"
 #include <boost/numpy.hpp>
 
 
diff --git a/unittest/alpha/eigenc.cpp b/unittest/alpha/eigenc.cpp
index 73620e642..f4a56ef1c 100644
--- a/unittest/alpha/eigenc.cpp
+++ b/unittest/alpha/eigenc.cpp
@@ -1,5 +1,4 @@
-#include <Eigen/Core>
-#include <boost/python.hpp>
+#include "eigenpy/fwd.hpp"
 #include <numpy/arrayobject.h>
 
 namespace boopy
diff --git a/unittest/alpha/eigentemplate.cpp b/unittest/alpha/eigentemplate.cpp
index 59194e724..27907921b 100644
--- a/unittest/alpha/eigentemplate.cpp
+++ b/unittest/alpha/eigentemplate.cpp
@@ -1,5 +1,4 @@
-#include <Eigen/Core>
-#include <boost/python.hpp>
+#include "eigenpy/fwd.hpp"
 #include <numpy/arrayobject.h>
 
 namespace boopy
diff --git a/unittest/alpha/simple.cpp b/unittest/alpha/simple.cpp
index 558e77b94..ef5b51977 100644
--- a/unittest/alpha/simple.cpp
+++ b/unittest/alpha/simple.cpp
@@ -3,9 +3,9 @@
  * function raises and error at runtime due to inadequate binding.
  */
 
-#include <boost/python.hpp>
 #include <string>
-#include <Eigen/Core>
+
+#include "eigenpy/fwd.hpp"
 
 
 char const* testchar()
diff --git a/unittest/geometry.cpp b/unittest/geometry.cpp
index a54829837..fc561fe6e 100644
--- a/unittest/geometry.cpp
+++ b/unittest/geometry.cpp
@@ -5,11 +5,9 @@
 
 #include "eigenpy/eigenpy.hpp"
 #include "eigenpy/geometry.hpp"
-#include <Eigen/Core>
 #include <Eigen/Geometry>
 #include <iostream>
  
-#include <boost/python.hpp>
 namespace bp = boost::python;
 
 Eigen::AngleAxisd testOutAngleAxis()