Browse Source

fixed various windows issues with static library

Former-commit-id: b120817fff7080095923eff4a6e8ba5e93352eb8
schuellc 10 years ago
parent
commit
6f8f988fa5

+ 4 - 7
include/igl/AABB.h

@@ -259,14 +259,13 @@ private:
         int & i,
         RowVectorDIMS & c) const;
 public:
-      template <int SS>
       static
       inline void barycentric_coordinates(
         const RowVectorDIMS & p, 
         const RowVectorDIMS & a, 
         const RowVectorDIMS & b, 
         const RowVectorDIMS & c,
-        Eigen::Matrix<Scalar,1,SS> & bary);
+        Eigen::Matrix<Scalar,1,3> & bary);
 public:
       EIGEN_MAKE_ALIGNED_OPERATOR_NEW
     };
@@ -858,7 +857,7 @@ inline typename igl::AABB<DerivedV,DIM>::Scalar igl::AABB<DerivedV,DIM>::squared
   //other->m_max_sqr_d = std::max(other->m_left->m_max_sqr_d,other->m_right->m_max_sqr_d);
 
   return 0;
-#if false
+#if 0 // False
 
   // _Very_ conservative approximation of maximum squared distance between
   // primitives inside this and other's bounding boxes
@@ -1114,16 +1113,14 @@ inline void igl::AABB<DerivedV,DIM>::set_min(
 
 
 template <typename DerivedV, int DIM>
-template <int SS>
 inline void
 igl::AABB<DerivedV,DIM>::barycentric_coordinates(
   const RowVectorDIMS & p, 
   const RowVectorDIMS & a, 
   const RowVectorDIMS & b, 
   const RowVectorDIMS & c,
-  Eigen::Matrix<Scalar,1,SS> & bary)
+  Eigen::Matrix<Scalar,1,3> & bary)
 {
-  assert(SS==3);
   // http://gamedev.stackexchange.com/a/23745
   const RowVectorDIMS v0 = b - a;
   const RowVectorDIMS v1 = c - a;
@@ -1137,6 +1134,6 @@ igl::AABB<DerivedV,DIM>::barycentric_coordinates(
   bary(1) = (d11 * d20 - d01 * d21) / denom;
   bary(2) = (d00 * d21 - d01 * d20) / denom;
   bary(0) = 1.0f - bary(1) - bary(2);
-};
+}
 
 #endif

+ 5 - 0
include/igl/comb_frame_field.cpp

@@ -6,6 +6,11 @@
 // v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
 
+#ifdef WIN32
+  #define _USE_MATH_DEFINES
+#endif
+#include <cmath>
+
 #include "comb_frame_field.h"
 #include "local_basis.h"
 

+ 5 - 0
include/igl/compute_frame_field_bisectors.cpp

@@ -6,6 +6,11 @@
 // v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
 
+#ifdef WIN32
+  #define _USE_MATH_DEFINES
+#endif
+#include <cmath>
+
 #include "compute_frame_field_bisectors.h"
 #include "igl/local_basis.h"
 

+ 5 - 1
include/igl/dated_copy.cpp

@@ -13,9 +13,11 @@
 #include <fstream>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
 #include <iostream>
 
+#if !defined(_WIN32)
+#include <unistd.h>
+
 IGL_INLINE bool igl::dated_copy(const std::string & src_path, const std::string & dir)
 {
   using namespace std;
@@ -85,3 +87,5 @@ IGL_INLINE bool igl::dated_copy(const std::string & src_path)
 {
   return dated_copy(src_path,dirname(src_path));
 }
+
+#endif

+ 3 - 0
include/igl/dated_copy.h

@@ -5,6 +5,9 @@
 // This Source Code Form is subject to the terms of the Mozilla Public License 
 // v. 2.0. If a copy of the MPL was not distributed with this file, You can 
 // obtain one at http://mozilla.org/MPL/2.0/.
+
+// Known issues: This function does not work under windows
+
 #ifndef IGL_DATED_COPY_H
 #define IGL_DATED_COPY_H
 #include "igl_inline.h"

+ 1 - 1
include/igl/file_dialog_save.cpp

@@ -9,8 +9,8 @@
 #include <cstdio>
 #include <cstring>
 
-
 #ifdef _WIN32
+ #include <windows.h>
  #include <Commdlg.h>
 #endif
 

+ 6 - 1
include/igl/fit_rigid.h

@@ -8,7 +8,12 @@
 #ifndef IGL_FIT_RIGID_H
 #define IGL_FIT_RIGID_H
 
-#warning "Deprecated. Use igl/procrustes.h instead"
+#if defined(_WIN32)
+  #pragma message("Deprecated. Use igl/procrustes.h instead")
+#else
+  #warning "Deprecated. Use igl/procrustes.h instead"
+#endif
+
 #include "igl_inline.h"
 #include <Eigen/Core>
 #include <Eigen/Geometry>

+ 1 - 1
include/igl/flare_textures.h.REMOVED.git-id

@@ -1 +1 @@
-d7410116de836a2f96c3de72373ca1d089065867
+3d9ea820d2a9d829dd08bbdb0fe53b38ee19a50c

+ 2 - 1
include/igl/lens_flare.cpp

@@ -15,6 +15,7 @@
 #include "flare_textures.h"
 
 #include <iostream>
+#include <stdint.h>
 
 // http://www.opengl.org/archives/resources/features/KilgardTechniques/LensFlare/glflare.c
 
@@ -24,7 +25,7 @@ IGL_INLINE void igl::lens_flare_load_textures(
 {
 
   const auto setup_texture =[](
-    const uint8_t * texture, 
+    const uint8_t * texture,
     const int width,
     const int height,
     GLuint texobj,

+ 6 - 1
include/igl/lu_lagrange.cpp

@@ -25,7 +25,12 @@ IGL_INLINE bool igl::lu_lagrange(
   Eigen::SparseMatrix<T> & U)
 {
 #if EIGEN_VERSION_AT_LEAST(3,0,92)
-#  warning lu_lagrange has not yet been implemented for your Eigen Version
+#if defined(_WIN32)
+  #pragma message("lu_lagrange has not yet been implemented for your Eigen Version")
+#else
+  #warning lu_lagrange has not yet been implemented for your Eigen Version
+#endif
+
   return false;
 #else
   // number of unknowns

+ 1 - 1
include/igl/n_polyvector.cpp

@@ -100,7 +100,7 @@ precomputeInteriorEdges()
   // Flag border edges
   numInteriorEdges = 0;
   isBorderEdge.setZero(numE,1);
-  indFullToInterior = -1.*Eigen::VectorXi::Ones(numE,1);
+  indFullToInterior = -1*Eigen::VectorXi::Ones(numE,1);
 
   for(unsigned i=0; i<numE; ++i)
   {

+ 1 - 1
include/igl/n_polyvector_general.cpp

@@ -99,7 +99,7 @@ precomputeInteriorEdges()
   // Flag border edges
   numInteriorEdges = 0;
   isBorderEdge.setZero(numE,1);
-  indFullToInterior = -1.*Eigen::VectorXi::Ones(numE,1);
+  indFullToInterior = -1*Eigen::VectorXi::Ones(numE,1);
 
   for(unsigned i=0; i<numE; ++i)
   {

+ 6 - 2
include/igl/path_to_executable.cpp

@@ -9,6 +9,10 @@
 #ifdef __APPLE__
 #  include <mach-o/dyld.h>
 #endif
+#if defined(_WIN32)
+#  include <windows.h>
+#endif
+#include <stdint.h>
 IGL_INLINE std::string igl::path_to_executable()
 {
   // http://pastebin.com/ffzzxPzi
@@ -16,8 +20,8 @@ IGL_INLINE std::string igl::path_to_executable()
   std::string path;
   char buffer[1024];
   uint32_t size = sizeof(buffer);
-#if defined (WIN32) || defined (WIN64)
-  GetModuleFileName(buffer, &size);
+#if defined (WIN32)
+  GetModuleFileName(nullptr,buffer,size);
   path = buffer;
 #elif defined (__APPLE__)
   if(_NSGetExecutablePath(buffer, &size) == 0)

+ 1 - 0
include/igl/polar_dec.cpp

@@ -14,6 +14,7 @@
 #include <cmath>
 #include <Eigen/Eigenvalues>
 #include <iostream>
+#include <cfenv>
 
 // From Olga's CGAL mentee's ARAP code
 template <

+ 1 - 1
include/igl/shine_textures.h.REMOVED.git-id

@@ -1 +1 @@
-0d5fca3720af7a84eac998513a77ff1ef619d5f0
+2967056d5a154b0a8840900f53e7d3bac498f7f2

+ 2 - 2
include/igl/sparse.cpp

@@ -107,8 +107,8 @@ template void igl::sparse<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<dou
 template void igl::sparse<Eigen::Matrix<double, -1, -1, 0, -1, -1>, double>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<double, 0, int>&);
 template Eigen::SparseMatrix<Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar, 0, int> igl::sparse<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&);
 template Eigen::SparseMatrix<Eigen::Matrix<double, -1, 1, 0, -1, 1>::Scalar, 0, int> igl::sparse<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&);
-template void igl::sparse<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >, double>(Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, unsigned long, unsigned long, Eigen::SparseMatrix<double, 0, int>&);
+//template void igl::sparse<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >, double>(Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, unsigned long, unsigned long, Eigen::SparseMatrix<double, 0, int>&);
 template void igl::sparse<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >, double>(Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::SparseMatrix<double, 0, int>&);
 template void igl::sparse<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, double>(Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&, Eigen::SparseMatrix<double, 0, int>&);
-template void igl::sparse<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, std::complex<double> >(Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&, unsigned long, unsigned long, Eigen::SparseMatrix<std::complex<double>, 0, int>&);
+//template void igl::sparse<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, std::complex<double> >(Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&, unsigned long, unsigned long, Eigen::SparseMatrix<std::complex<double>, 0, int>&);
 #endif

+ 1 - 1
include/igl/triangle_triangle_adjacency.cpp

@@ -214,7 +214,7 @@ template <
     {
       const Index e = f + m*c;
       //const Index c = e/m;
-      const vector<Index> & N = uE2E[EMAP(e)];
+      const vector<uE2EType> & N = uE2E[EMAP(e)];
       for(const auto & ne : N)
       {
         const Index nf = ne%m;

+ 1 - 1
include/igl/viewer/Viewer.cpp

@@ -32,7 +32,7 @@
 #include <Eigen/LU>
 
 #define GLFW_INCLUDE_GLU
-#define GLFW_INCLUDE_GLCOREARB
+//#define GLFW_INCLUDE_GLCOREARB
 #include <GLFW/glfw3.h>
 
 #include <cmath>

+ 4 - 0
include/igl/viewer/ViewerCore.cpp

@@ -16,6 +16,10 @@
 #include <Eigen/Geometry>
 #include <iostream>
 
+#ifdef _WIN32
+#  undef DrawText
+#endif
+
 #ifdef ENABLE_SERIALIZATION
 #include <igl/serialize.h>
 namespace igl {

+ 12 - 2
optional/CMakeLists.txt

@@ -17,6 +17,14 @@ else (GLFW_FOUND)
   message(STATUS "GLFW not found.")
 endif(GLFW_FOUND)
 
+## Check for GLEW
+find_package(GLEW QUIET)
+if (GLEW_FOUND)
+  include_directories( ${GLEW_INCLUDE_DIR})
+else (GLEW_FOUND)
+  message(STATUS "GLEW not found.")
+endif(GLEW_FOUND)
+
 find_package(OpenGL QUIET)
 
 ## Check for Anttweakbar
@@ -301,5 +309,7 @@ if (NANOGUI_FOUND)
 
 endif (NANOGUI_FOUND)
 
-# Pass the list of compiled libraries to the parent
-set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} PARENT_SCOPE)
+# Pass the list of compiled libraries to the parent if there is one
+if(NOT ${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
+  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} PARENT_SCOPE)
+endif (NOT ${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})

+ 2 - 2
tutorial/cmake/FindMATLAB.cmake

@@ -40,7 +40,7 @@
 SET(MATLAB_FOUND 0)
 IF(WIN32)
   # Search for a version of Matlab available, starting from the most modern one to older versions
-  FOREACH(MATVER "7.14" "7.11" "7.10" "7.9" "7.8" "7.7" "7.6" "7.5" "7.4")
+  FOREACH(MATVER "7.14" "7.11" "7.17" "7.10" "7.9" "7.8" "7.7" "7.6" "7.5" "7.4" "8.0" "8.1" "8.2" "8.3" "8.4" "8.5")
     IF((NOT DEFINED MATLAB_ROOT)
         OR ("${MATLAB_ROOT}" STREQUAL "")
         OR ("${MATLAB_ROOT}" STREQUAL "/registry"))
@@ -187,7 +187,7 @@ ELSE(WIN32)
 
 ENDIF(WIN32)
 
-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
   set(MATLAB_LIBSTDCPP "-lstdc++")
 endif ()