Explorar el Código

tutorials now use the static build by default

Former-commit-id: 60bf7c764fcc5aefe134eb091146c8167f4cbba9
Daniele Panozzo hace 10 años
padre
commit
e265d25705

+ 2 - 2
include/igl/embree/unproject_in_mesh.cpp

@@ -115,8 +115,8 @@ IGL_INLINE int igl::embree::unproject_in_mesh(
 
 #ifdef IGL_STATIC_LIBRARY
 #  ifndef IGL_OPENLGL_4
-template int igl::embree::unproject_in_mesh<Eigen::Matrix<double, 3, 1, 0, 3, 1> >(double, double, igl::embree::EmbreeIntersector const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&, std::vector<igl::embree::Hit, std::allocator<igl::embree::Hit> >&);
-template int igl::embree::unproject_in_mesh<Eigen::Matrix<double, 3, 1, 0, 3, 1> >(double, double, igl::embree::EmbreeIntersector const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&);
+//template int igl::embree::unproject_in_mesh<Eigen::Matrix<double, 3, 1, 0, 3, 1> >(double, double, igl::embree::EmbreeIntersector const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&, std::vector<igl::embree::Hit, std::allocator<igl::embree::Hit> >&);
+//template int igl::embree::unproject_in_mesh<Eigen::Matrix<double, 3, 1, 0, 3, 1> >(double, double, igl::embree::EmbreeIntersector const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&);
 #  endif
 template int igl::embree::unproject_in_mesh<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::Matrix<float, 2, 1, 0, 2, 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&, igl::embree::EmbreeIntersector const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, std::vector<igl::embree::Hit, std::allocator<igl::embree::Hit> >&);
 template int igl::embree::unproject_in_mesh<Eigen::Matrix<double, 1, 3, 1, 1, 3> >(Eigen::Matrix<float, 2, 1, 0, 2, 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&, igl::embree::EmbreeIntersector const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&, std::vector<igl::embree::Hit, std::allocator<igl::embree::Hit> >&);

+ 3 - 2
include/igl/nchoosek.cpp

@@ -46,7 +46,7 @@ IGL_INLINE void igl::nchoosek(
   int running_j = 0;
   Matrix<typename DerivedU::Scalar,1,Dynamic> running(1,k);
   int N = V.size();
-  const std::function<void(int,int)> doCombs = 
+  const std::function<void(int,int)> doCombs =
     [&running,&N,&doCombs,&running_i,&running_j,&U,&V](int offset, int k)
   {
     if(k==0)
@@ -55,7 +55,7 @@ IGL_INLINE void igl::nchoosek(
       running_i++;
       return;
     }
-    for (int i = offset; i <= N - k; ++i) 
+    for (int i = offset; i <= N - k; ++i)
     {
       running(running_j) = V(i);
       running_j++;
@@ -68,4 +68,5 @@ IGL_INLINE void igl::nchoosek(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
+template void igl::nchoosek<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 #endif

+ 9 - 9
include/igl/unproject.cpp

@@ -6,8 +6,8 @@
 // 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/.
 #include "unproject.h"
-#ifndef IGL_NO_OPENGL
-#ifndef IGL_OPENGL_4
+//#ifndef IGL_NO_OPENGL
+//#ifndef IGL_OPENGL_4
 
 #include <Eigen/Dense>
 #include <Eigen/LU>
@@ -54,8 +54,8 @@ IGL_INLINE Eigen::PlainObjectBase<Derivedwin> igl::unproject(
   return objd.template cast<Scalar>();
 }
 
-#endif
-#endif
+//#endif
+//#endif
 
 
 template <typename Scalar>
@@ -81,8 +81,8 @@ IGL_INLINE Eigen::Matrix<Scalar,3,1> igl::unproject(
 
 #ifdef IGL_STATIC_LIBRARY
 
-#ifndef IGL_NO_OPENGL
-#ifndef IGL_OPENGL_4
+//#ifndef IGL_NO_OPENGL
+//#ifndef IGL_OPENGL_4
 // Explicit template instanciation
 template void igl::unproject<Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::Matrix<double, 3, 1, 0, 3, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&);
 template void igl::unproject<Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::Matrix<float, 3, 1, 0, 3, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> >&);
@@ -92,8 +92,8 @@ template Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> > igl::unpr
 template void igl::unproject<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&);
 template Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > igl::unproject<Eigen::Matrix<double, 1, 3, 1, 1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&);
 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&);
-#endif
-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&);
-#endif
+//#endif
+//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&);
+//#endif
 
 #endif

+ 29 - 0
optional/CMakeLists.txt

@@ -150,6 +150,7 @@ file(GLOB SOURCES
 )
 
 add_library(igl STATIC ${SOURCES})
+set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "igl")
 
 #### Compile the AntTweakBar part
 if (ANTTWEAKBAR_FOUND)
@@ -157,6 +158,7 @@ if (ANTTWEAKBAR_FOUND)
     "${PROJECT_SOURCE_DIR}/../include/igl/anttweakbar/*.cpp"
   )
 add_library(iglanttweakbar STATIC ${SOURCES_ANTTWEAKBAR})
+set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglanttweakbar")
 endif (ANTTWEAKBAR_FOUND)
 
 #### Compile the BBW part
@@ -165,6 +167,7 @@ file(GLOB SOURCES_BBW
   "${PROJECT_SOURCE_DIR}/../include/igl/bbw/*.cpp"
 )
 add_library(iglbbw STATIC ${SOURCES_BBW})
+set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglbbw")
 
 #### Compile the mosek part
 if (MOSEK_FOUND)
@@ -172,6 +175,8 @@ if (MOSEK_FOUND)
     "${PROJECT_SOURCE_DIR}/../include/igl/mosek/*.cpp"
   )
 add_library(iglmosek STATIC ${SOURCES_MOSEK})
+set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglmosek")
+
 endif (MOSEK_FOUND)
 
 #### Compile the cgal part
@@ -181,6 +186,7 @@ if (CGAL_FOUND)
   )
 
 add_library(iglcgal STATIC ${SOURCES_CGAL})
+set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglcgal")
 
 #### Compile the boolean part
 if (NOT CORK_FOUND)
@@ -192,6 +198,8 @@ file(GLOB SOURCES_BOOLEAN
 )
 
 add_library(iglboolean STATIC ${SOURCES_BOOLEAN})
+set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglboolean")
+
 endif (CGAL_FOUND)
 
 #### Compile the embree part
@@ -201,6 +209,8 @@ if (EMBREE_FOUND)
   )
 
   add_library(iglembree STATIC ${SOURCES_EMBREE})
+  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglembree")
+
 endif (EMBREE_FOUND)
 
 #### Compile the lim part
@@ -210,6 +220,8 @@ if (LIM_FOUND)
   )
 
   add_library(igllim STATIC ${SOURCES_LIM})
+  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "igllim")
+
 endif (LIM_FOUND)
 
 #### Compile the matlab part
@@ -219,6 +231,8 @@ if (MATLAB_FOUND)
   )
 
   add_library(iglmatlab STATIC ${SOURCES_MATLAB})
+  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglmatlab")
+
 endif (MATLAB_FOUND)
 
 #### Compile the png part
@@ -227,6 +241,8 @@ if (PNG_FOUND AND YIMG_FOUND)
     "${PROJECT_SOURCE_DIR}/../include/igl/png/*.cpp"
   )
   add_library(iglpng STATIC ${SOURCES_PNG})
+  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglpng")
+
 endif (PNG_FOUND AND YIMG_FOUND)
 
 #### Compile the tetgen part
@@ -236,6 +252,8 @@ if (TETGEN_FOUND)
   )
 
   add_library(igltetgen STATIC ${SOURCES_TETGEN})
+  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "igltetgen")
+
 endif (TETGEN_FOUND)
 
 #### Compile the triangle part
@@ -245,6 +263,8 @@ if (TRIANGLE_FOUND)
   )
 
   add_library(igltriangle STATIC ${SOURCES_TRIANGLE})
+  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "igltriangle")
+
 endif (TRIANGLE_FOUND)
 
 #### Compile the xml part
@@ -254,6 +274,8 @@ if (TINYXML2_FOUND)
   )
 
   add_library(iglxml STATIC ${SOURCES_XML})
+  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglxml")
+
 endif (TINYXML2_FOUND)
 
 #### Compile the xml part
@@ -263,6 +285,8 @@ if (LIBCOMISO_FOUND)
   )
 
   add_library(iglcomiso STATIC ${SOURCES_COMISO})
+  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglcomiso")
+
 endif (LIBCOMISO_FOUND)
 
 #### Compile the viewer
@@ -272,4 +296,9 @@ if (GLFW_FOUND AND NANOGUI_FOUND)
   )
 
   add_library(iglviewer STATIC ${SOURCES_VIEWER})
+  set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} "iglviewer")
+
 endif (GLFW_FOUND AND NANOGUI_FOUND)
+
+# Pass the list of compiled libraries to the parent
+set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} PARENT_SCOPE)

+ 1 - 1
tutorial/609_Boolean/CMakeLists.txt

@@ -11,7 +11,7 @@ remove_cxx_flag("-stdlib=libc++")
 
 # for some reason must come after cgal include. I think that it's overwriting
 # come flags like CXX_FLAGS
-set(CMAKELISTS_SHARED_INCLUDED FALSE)
+#set(CMAKELISTS_SHARED_INCLUDED FALSE)
 include("../CMakeLists.shared")
 
 set(SOURCES

+ 4 - 4
tutorial/CMakeLists.shared

@@ -25,7 +25,7 @@ set(CMAKE_COLOR_MAKEFILE ON)
 
 find_package(OpenGL REQUIRED)
 find_package(EIGEN REQUIRED)
-find_package(LIBIGL REQUIRED)
+#find_package(LIBIGL REQUIRED)
 find_package(NANOGUI REQUIRED)
 find_package(GLFW REQUIRED)
 
@@ -51,7 +51,7 @@ if(NOT APPLE)
 endif(NOT APPLE)
 
 include_directories( ${EIGEN_INCLUDE_DIR})
-include_directories( ${LIBIGL_INCLUDE_DIRS})
+#include_directories( ${LIBIGL_INCLUDE_DIRS})
 include_directories( ${GLFW_INCLUDE_DIR})
 include_directories(
 	/usr/local/include
@@ -84,7 +84,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" ST
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register")
 endif()
 
-set(SHARED_SOURCES ${LIBIGL_SOURCES})
+# set(SHARED_SOURCES ${LIBIGL_SOURCES})
 
 if(NOT APPLE)
 	set(SHARED_SOURCES ${SHARED_SOURCES} ${GLEW_SOURCES})
@@ -94,7 +94,7 @@ endif(NOT APPLE)
 
 
 set(SHARED_LIBRARIES
-		${LIBIGL_LIBRARIES}
+#		${LIBIGL_LIBRARIES}
 		${OPENGL_LIBRARIES}
 		${NANOGUI_LIBRARY}
 		${EIGEN_LIBRARIES}

+ 11 - 0
tutorial/CMakeLists.txt

@@ -3,6 +3,8 @@ project(libigl_tutorials)
 
 message("Generated with config types: ${CMAKE_CONFIGURATION_TYPES}")
 
+SET(LIBIGL_USE_STATIC_LIBRARY 1)
+
 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../)
 SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
 
@@ -19,6 +21,15 @@ find_package(TRIANGLE QUIET)
 message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
 include("CMakeLists.shared")
 
+#Compile libigl
+add_definitions(-DIGL_STATIC_LIBRARY)
+add_subdirectory("../optional" ".")
+include_directories("../include")
+
+message(STATUS "Linking with: ${LIBIGL_LIBRARIES}")
+list(APPEND SHARED_LIBRARIES ${LIBIGL_LIBRARIES})
+
+
 # Chapter 1
 add_subdirectory("101_FileIO")
 add_subdirectory("102_DrawMesh")

+ 1 - 0
tutorial/cmake/FindLIBIGL.cmake

@@ -35,6 +35,7 @@ endif(LIBIGL_INCLUDE_DIR)
 if(LIBIGL_USE_STATIC_LIBRARY)
   add_definitions(-DIGL_STATIC_LIBRARY)
   set(LIBIGL_LIB_DIRS
+   ${CMAKE_BINARY_DIR}/
    ${PROJECT_SOURCE_DIR}/../../lib
    ${PROJECT_SOURCE_DIR}/../lib
    ${PROJECT_SOURCE_DIR}/lib