From fa2a7fbca0da3145391267dadc2d7ea937e04dd1 Mon Sep 17 00:00:00 2001
From: seanyen <seanyen@microsoft.com>
Date: Wed, 17 Jul 2019 00:29:08 -0700
Subject: [PATCH] Fix windows/MSVC build.

---
 CMakeLists.txt              |  3 +++
 include/eigenpy/details.hpp |  8 ++++----
 include/eigenpy/expose.hpp  |  2 +-
 include/eigenpy/ref.hpp     | 12 ++++++------
 4 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e1a9bd54..5bd79e52 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -109,6 +109,8 @@ SET(${PROJECT_NAME}_HEADERS
 INCLUDE_DIRECTORIES(${${PROJECT_NAME}_BINARY_DIR}/include)
 INCLUDE_DIRECTORIES(${${PROJECT_NAME}_SOURCE_DIR}/include)
 
+LINK_DIRECTORIES(${PYTHON_LIBRARY_DIRS})
+
 # ----------------------------------------------------
 # --- TARGETS ----------------------------------------
 # ----------------------------------------------------
@@ -130,6 +132,7 @@ ADD_LIBRARY(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}${PYTHON_SOABI}")
 
 TARGET_LINK_BOOST_PYTHON(${PROJECT_NAME})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) 
 PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} eigen3)
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
 
diff --git a/include/eigenpy/details.hpp b/include/eigenpy/details.hpp
index f0d32ade..92df398a 100644
--- a/include/eigenpy/details.hpp
+++ b/include/eigenpy/details.hpp
@@ -300,7 +300,7 @@ namespace eigenpy
       // Check if the Scalar type of the obj_ptr is compatible with the Scalar type of MatType
       if ((PyArray_ObjectType(reinterpret_cast<PyObject *>(obj_ptr), 0)) == NPY_INT)
       {
-        if(not FromTypeToType<int,typename MatType::Scalar>::value)
+        if(!FromTypeToType<int,typename MatType::Scalar>::value)
         {
 #ifndef NDEBUG
           std::cerr << "The Python matrix scalar type (int) cannot be converted into the scalar type of the Eigen matrix. Loss of arithmetic precision" << std::endl;
@@ -310,7 +310,7 @@ namespace eigenpy
       }
       else if ((PyArray_ObjectType(reinterpret_cast<PyObject *>(obj_ptr), 0)) == NPY_LONG)
       {
-        if(not FromTypeToType<long,typename MatType::Scalar>::value)
+        if(!FromTypeToType<long,typename MatType::Scalar>::value)
         {
 #ifndef NDEBUG
           std::cerr << "The Python matrix scalar type (long) cannot be converted into the scalar type of the Eigen matrix. Loss of arithmetic precision" << std::endl;
@@ -320,7 +320,7 @@ namespace eigenpy
       }
       else if ((PyArray_ObjectType(reinterpret_cast<PyObject *>(obj_ptr), 0)) == NPY_FLOAT)
       {
-        if(not FromTypeToType<float,typename MatType::Scalar>::value)
+        if(!FromTypeToType<float,typename MatType::Scalar>::value)
         {
 #ifndef NDEBUG
           std::cerr << "The Python matrix scalar type (float) cannot be converted into the scalar type of the Eigen matrix. Loss of arithmetic precision" << std::endl;
@@ -330,7 +330,7 @@ namespace eigenpy
       }
       else if ((PyArray_ObjectType(reinterpret_cast<PyObject *>(obj_ptr), 0)) == NPY_DOUBLE)
       {
-        if(not FromTypeToType<double,typename MatType::Scalar>::value)
+        if(!FromTypeToType<double,typename MatType::Scalar>::value)
         {
 #ifndef NDEBUG
           std::cerr << "The Python matrix scalar (double) type cannot be converted into the scalar type of the Eigen matrix. Loss of arithmetic precision." << std::endl;
diff --git a/include/eigenpy/expose.hpp b/include/eigenpy/expose.hpp
index 5ce9fc83..24158cd2 100644
--- a/include/eigenpy/expose.hpp
+++ b/include/eigenpy/expose.hpp
@@ -27,7 +27,7 @@ namespace eigenpy
   template<typename T>
   inline void expose()
   {
-    if(not register_symbolic_link_to_registered_type<T>())
+    if(!register_symbolic_link_to_registered_type<T>())
       internal::call_expose<T>::run();
   }
 }
diff --git a/include/eigenpy/ref.hpp b/include/eigenpy/ref.hpp
index afeb3072..1f05bd67 100644
--- a/include/eigenpy/ref.hpp
+++ b/include/eigenpy/ref.hpp
@@ -11,19 +11,19 @@
 
 // For old Eigen versions, EIGEN_DEVICE_FUNC is not defined.
 // We must define it just in the scope of this file.
-#if not EIGEN_VERSION_AT_LEAST(3,2,90)
+#if !EIGEN_VERSION_AT_LEAST(3,2,90)
 #define EIGEN_DEVICE_FUNC
 #endif
 
 namespace eigenpy
 {
 
-  template<typename PlainObjectType>
-  struct Ref : Eigen::Ref<PlainObjectType,EIGENPY_DEFAULT_ALIGNMENT_VALUE,typename StrideType<PlainObjectType>::type>
+  template<typename PlainObjectTypeT>
+  struct Ref : Eigen::Ref<PlainObjectTypeT,EIGENPY_DEFAULT_ALIGNMENT_VALUE,typename StrideType<PlainObjectTypeT>::type>
   {
   public:
-    typedef Eigen::Ref<PlainObjectType,EIGENPY_DEFAULT_ALIGNMENT_VALUE,typename StrideType<PlainObjectType>::type> Base;
-    
+    typedef Eigen::Ref<PlainObjectTypeT,EIGENPY_DEFAULT_ALIGNMENT_VALUE,typename eigenpy::template StrideType<PlainObjectTypeT>::type> Base;
+
   private:
     typedef Eigen::internal::traits<Base> Traits;
     template<typename Derived>
@@ -83,7 +83,7 @@ namespace eigenpy
   }; // struct Ref<PlainObjectType>
 }
 
-#if not EIGEN_VERSION_AT_LEAST(3,2,90)
+#if !EIGEN_VERSION_AT_LEAST(3,2,90)
 #undef EIGEN_DEVICE_FUNC
 #endif
 
-- 
GitLab