Cleanup: Fix build error with MSVC
authorLazydodo <github@lazydodo.com>
Wed, 21 Aug 2019 16:38:33 +0000 (10:38 -0600)
committerLazydodo <github@lazydodo.com>
Wed, 21 Aug 2019 16:38:33 +0000 (10:38 -0600)
Previously eigens internal include order somehow implicitly provided
M_PI and friends. The recent eigen version bump broke this implicit
behaviour, better to be explicit that we need the math defines for MSVC.

intern/iksolver/CMakeLists.txt
intern/libmv/CMakeLists.txt
intern/libmv/libmv/tracking/track_region.cc
intern/libmv/libmv/tracking/track_region.h

index 5e12cdbcc2f53bc4486588efe20427b1184ea70c..a7a346ccddd4d373f70fc90ca74546a13201bf22 100644 (file)
@@ -27,6 +27,10 @@ set(INC_SYS
   ${EIGEN3_INCLUDE_DIRS}
 )
 
+if(WIN32)
+  add_definitions(-D_USE_MATH_DEFINES)
+endif()
+
 set(SRC
   intern/IK_QJacobian.cpp
   intern/IK_QJacobianSolver.cpp
index 019364d84dfc236c26d43261cb0efe6d0b5d9a1c..e16e27368d06a3daadc9d2d5bdffba413ceaa0db 100644 (file)
@@ -38,6 +38,9 @@ set(LIB
 )
 
 if(WITH_LIBMV)
+  if(WIN32)
+    add_definitions(-D_USE_MATH_DEFINES)
+  endif()
   add_definitions(${GFLAGS_DEFINES})
   add_definitions(${GLOG_DEFINES})
   add_definitions(${CERES_DEFINES})
index ef6dac65236eb75aed30fc3d349cad20f43e40fc..895c9a1e23d0b6223d5823911466744cc1f14521 100644 (file)
@@ -25,9 +25,6 @@
 // smart coder went through the TODO's and made the suggested performance
 // enhancements.
 
-// Necessary for M_E when building with MSVC.
-#define _USE_MATH_DEFINES
-
 #include "libmv/tracking/track_region.h"
 
 #include <Eigen/SVD>
index be1d8ef3e03488c1c876e5552d4317c630da022e..61dce22bcb837a30faeda2f222b5000dc9eb34bf 100644 (file)
@@ -20,9 +20,6 @@
 
 #ifndef LIBMV_TRACKING_TRACK_REGION_H_
 
-// Necessary for M_E when building with MSVC.
-#define _USE_MATH_DEFINES
-
 #include "libmv/image/image.h"
 #include "libmv/image/sample.h"
 #include "libmv/numeric/numeric.h"