Browse Source

fix for static lib on linux

Former-commit-id: fcaf056ddd467498d7265969871ac84316cfa586
Daniele Panozzo 10 years ago
parent
commit
ad4d8022ae
3 changed files with 15 additions and 5 deletions
  1. 7 5
      include/igl/unproject.cpp
  2. 6 0
      include/igl/unproject.h
  3. 2 0
      tutorial/CMakeLists.txt

+ 7 - 5
include/igl/unproject.cpp

@@ -10,6 +10,8 @@
 #include <Eigen/Dense>
 #include <Eigen/LU>
 
+#ifndef IGL_OPENGL_4
+
 IGL_INLINE void igl::unproject(
   const double winX,
   const double winY,
@@ -34,7 +36,7 @@ IGL_INLINE void igl::unproject(
 }
 
 // #ifndef IGL_NO_OPENGL
-// #ifndef IGL_OPENGL_4
+
 #include "OpenGL_convenience.h"
 
 template <typename Derivedwin>
@@ -55,7 +57,7 @@ IGL_INLINE Eigen::PlainObjectBase<Derivedwin> igl::unproject(
   return objd.template cast<Scalar>();
 }
 
-// #endif
+#endif
 // #endif
 
 template <typename Scalar>
@@ -81,14 +83,14 @@ IGL_INLINE Eigen::Matrix<Scalar,3,1> igl::unproject(
 
 #ifdef IGL_STATIC_LIBRARY
 
-#ifndef IGL_NO_OPENGL
+//#ifndef IGL_NO_OPENGL
 #ifndef IGL_OPENGL_4
 // Explicit template instanciation
+template Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> > igl::unproject<Eigen::Matrix<double, 3, 1, 0, 3, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> > const&);
 #endif
-#endif
+//#endif
 
 template Eigen::Matrix<float, 3, 1, 0, 3, 1> igl::unproject<float>(Eigen::Matrix<float, 3, 1, 0, 3, 1> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&);
 template Eigen::Matrix<double, 3, 1, 0, 3, 1> igl::unproject<double>(Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, Eigen::Matrix<double, 4, 4, 0, 4, 4> const&, Eigen::Matrix<double, 4, 4, 0, 4, 4> const&, Eigen::Matrix<double, 4, 1, 0, 4, 1> const&);
-template Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> > igl::unproject<Eigen::Matrix<double, 3, 1, 0, 3, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> > const&);
 
 #endif

+ 6 - 0
include/igl/unproject.h

@@ -11,6 +11,10 @@
 #include <Eigen/Core>
 namespace igl
 {
+
+
+  #ifndef IGL_OPENGL_4
+
   // Wrapper for gluUnproject that uses the current GL_MODELVIEW_MATRIX,
   // GL_PROJECTION_MATRIX, and GL_VIEWPORT
   // Inputs:
@@ -33,6 +37,8 @@ namespace igl
   IGL_INLINE Eigen::PlainObjectBase<Derivedwin> unproject(
     const Eigen::PlainObjectBase<Derivedwin> & win);
 
+  #endif
+
   // Eigen reimplementation of gluUnproject
   // Inputs:
   //   win  screen space x, y, and z coordinates

+ 2 - 0
tutorial/CMakeLists.txt

@@ -32,6 +32,8 @@ include("CMakeLists.shared")
 
 #Compile libigl
 add_definitions(-DIGL_STATIC_LIBRARY)
+add_definitions(-DIGL_NO_OPENGL)
+
 add_subdirectory("../optional" "libigl")
 include_directories("../include")