Explorar el Código

clean up cmake

Former-commit-id: 0308d51f3c8db75800d5c570af8f72ee13e87026
Alec Jacobson hace 10 años
padre
commit
54bea23ded

+ 1 - 0
include/igl/boolean/mesh_boolean.h

@@ -4,6 +4,7 @@
 #include <igl/igl_inline.h>
 #include "MeshBooleanType.h"
 #include <Eigen/Core>
+#include <functional>
 
 namespace igl
 {

+ 2 - 2
include/igl/internal_angles.cpp

@@ -48,9 +48,9 @@ IGL_INLINE void igl::internal_angles(
   #  define IGL_OMP_MIN_VALUE 1000
   #endif
   #pragma omp parallel for if (m>IGL_OMP_MIN_VALUE)
-  for(int f = 0;f<m;f++)
+  for(size_t f = 0;f<m;f++)
   {
-    for(int d = 0;d<3;d++)
+    for(size_t d = 0;d<3;d++)
     {
       const auto & s1 = L(f,d);
       const auto & s2 = L(f,(d+1)%3);

+ 1 - 0
include/igl/triangle_triangle_adjacency.cpp

@@ -206,4 +206,5 @@ template <
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 template void igl::triangle_triangle_adjacency<Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, long, long, long>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> > const&, std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > > const&, bool, std::vector<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >, std::allocator<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > > > >&, std::vector<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >, std::allocator<std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > > > >&);
+template void igl::triangle_triangle_adjacency<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 #endif

+ 6 - 1
tutorial/403_BoundedBiharmonicWeights/CMakeLists.txt

@@ -3,7 +3,12 @@ project(403_BoundedBiharmonicWeights)
 
 include("../CMakeLists.shared")
 
-find_package(MOSEK REQUIRED)
+if(NOT MOSEK_FOUND)
+  add_definitions(-DIGL_NO_MOSEK)
+  if(LIBIGL_USE_STATIC_LIBRARY)
+    set(LIBIGLMOSEK_LIBRARY "")
+  endif(LIBIGL_USE_STATIC_LIBRARY)
+endif(NOT MOSEK_FOUND)
 
 include_directories( ${MOSEK_INCLUDE_DIR} )
 

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

@@ -4,7 +4,9 @@ project(609_Boolean)
 find_package(CGAL REQUIRED)
 include(${CGAL_USE_FILE})
 
-# for some reason must come after cgal include
+# for some reason must come after cgal include. I think that it's overwriting
+# come flags like CXX_FLAGS
+set(CMAKELISTS_SHARED_INCLUDED FALSE)
 include("../CMakeLists.shared")
 
 set(SOURCES

+ 12 - 2
tutorial/CMakeLists.shared

@@ -1,16 +1,25 @@
+if(NOT CMAKELISTS_SHARED_INCLUDED)
+set(CMAKELISTS_SHARED_INCLUDED TRUE)
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+find_package(OpenMP)
+if (OPENMP_FOUND)
+  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
+  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+endif()
+
 SET(CMAKE_VERBOSE_MAKEFILE ON)
 
-set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake)
+set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake ${PROJECT_SOURCE_DIR}/cmake)
 set(CMAKE_COLOR_MAKEFILE ON)
 
 ############################
 ## SEPARATE BUILD OPTIONS ##
 ############################
 
-find_package(ANTTWEAKBAR REQUIRED)
 find_package(OpenGL REQUIRED)
 find_package(EIGEN REQUIRED)
 find_package(LIBIGL REQUIRED)
+find_package(ANTTWEAKBAR REQUIRED)
 find_package(GLFW REQUIRED)
 
 if(NOT APPLE)
@@ -84,3 +93,4 @@ set(SHARED_LIBRARIES
 )
 
 #message(FATAL_ERROR ${SHARED_LIBRARIES})
+endif(NOT CMAKELISTS_SHARED_INCLUDED)

+ 2 - 2
tutorial/CMakeLists.txt

@@ -17,6 +17,8 @@ find_package(CGAL QUIET)
 ## Check for mosek
 find_package(MOSEK QUIET)
 
+include("CMakeLists.shared")
+
 # Chapter 1
 add_subdirectory("101_FileIO")
 add_subdirectory("102_DrawMesh")
@@ -41,9 +43,7 @@ add_subdirectory("305_QuadraticProgramming")
 # Chapter 4
 add_subdirectory("401_BiharmonicDeformation")
 add_subdirectory("402_PolyharmonicDeformation")
-if(MOSEK_FOUND)
 add_subdirectory("403_BoundedBiharmonicWeights")
-endif(MOSEK_FOUND)
 add_subdirectory("404_DualQuaternionSkinning")
 add_subdirectory("405_AsRigidAsPossible")
 add_subdirectory("406_FastAutomaticSkinningTransformations")

+ 8 - 4
tutorial/cmake/FindANTTWEAKBAR.cmake

@@ -17,20 +17,23 @@ IF (WIN32)
 	FIND_PATH( ANT_TWEAK_BAR_INCLUDE_DIR AntTweakBar.h
       PATHS
 		${PROJECT_SOURCE_DIR}/../../external/AntTweakBar/include
+		${PROJECT_SOURCE_DIR}/../external/AntTweakBar/include
 		$ENV{ANT_TWEAK_BAR_ROOT}/include
 		DOC "The directory where AntTweakBar.h resides")
 
     FIND_LIBRARY( ANT_TWEAK_BAR_LIBRARY AntTweakBar${BITS}
         PATHS
 		${PROJECT_SOURCE_DIR}/../../external/AntTweakBar/lib
-        $ENV{ANT_TWEAK_BAR_ROOT}/lib
-        DOC "The AntTweakBar library")
+		${PROJECT_SOURCE_DIR}/../external/AntTweakBar/lib
+                $ENV{ANT_TWEAK_BAR_ROOT}/lib
+                DOC "The AntTweakBar library")
 ELSE (WIN32)
 
 FIND_PATH(ANT_TWEAK_BAR_INCLUDE_DIR AntTweakBar.h
       PATHS
-	    ${PROJECT_SOURCE_DIR}/../libigl/external/AntTweakBar/include/
+	    ${LIBIGL_INCLUDE_DIR}/../external/AntTweakBar/include/
       ${PROJECT_SOURCE_DIR}/../../external/AntTweakBar/include/
+      ${PROJECT_SOURCE_DIR}/../external/AntTweakBar/include/
       /usr/local/include
       /usr/X11/include
       /usr/include
@@ -38,8 +41,9 @@ FIND_PATH(ANT_TWEAK_BAR_INCLUDE_DIR AntTweakBar.h
 
 FIND_LIBRARY( ANT_TWEAK_BAR_LIBRARY AntTweakBar
   PATHS
-		${PROJECT_SOURCE_DIR}/../libigl/external/AntTweakBar/lib
+		${LIBIGL_INCLUDE_DIR}/../external/AntTweakBar/lib
     ${PROJECT_SOURCE_DIR}/../../external/AntTweakBar/lib
+    ${PROJECT_SOURCE_DIR}/../external/AntTweakBar/lib
     /usr/local
     /usr/X11
     /usr

+ 8 - 1
tutorial/cmake/FindGLFW.cmake

@@ -7,9 +7,12 @@
 # GLFW_LIBRARIES
 #
 
+if(NOT GLFW_FOUND)
+
 FIND_PATH(GLFW_INCLUDE_DIR GLFW/glfw3.h
   PATHS
     ${PROJECT_SOURCE_DIR}/../../external/glfw/include
+    ${PROJECT_SOURCE_DIR}/../external/glfw/include
     /usr/local/include
     /usr/X11/include
     /usr/include
@@ -20,7 +23,9 @@ FIND_PATH(GLFW_INCLUDE_DIR GLFW/glfw3.h
 FIND_LIBRARY( GLFW_LIBRARIES NAMES glfw glfw3
   PATHS
     ${PROJECT_SOURCE_DIR}/../../external/glfw/src
-	${PROJECT_SOURCE_DIR}/../../external/glfw/lib/x64
+    ${PROJECT_SOURCE_DIR}/../external/glfw/src
+    ${PROJECT_SOURCE_DIR}/../../external/glfw/lib/x64
+    ${PROJECT_SOURCE_DIR}/../external/glfw/lib/x64
     /usr/local
     /usr/X11
     /usr
@@ -41,3 +46,5 @@ if(GLFW_FOUND)
 else(GLFW_FOUND)
   message(FATAL_ERROR "could NOT find GLFW")
 endif(GLFW_FOUND)
+
+endif(NOT GLFW_FOUND)

+ 14 - 19
tutorial/cmake/FindLIBIGL.cmake

@@ -4,10 +4,7 @@
 #  LIBIGL_FOUND - system has LIBIGL
 #  LIBIGL_INCLUDE_DIR - the LIBIGL include directory
 #  LIBIGL_SOURCES - the LIBIGL source files
-
-# Mosek is not required but must be found before libigl to ensure correct flags
-# are set
-find_package(Mosek QUIET)
+if(NOT LIBIGL_FOUND)
 
 FIND_PATH(LIBIGL_INCLUDE_DIR igl/readOBJ.h
    /usr/include
@@ -31,10 +28,6 @@ if(LIBIGL_INCLUDE_DIR)
    #)
 endif(LIBIGL_INCLUDE_DIR)
 
-if (NOT MOSEK_FOUND)
-  add_definitions(-DIGL_NO_MOSEK)
-endif (NOT MOSEK_FOUND)
-
 if(LIBIGL_USE_STATIC_LIBRARY)
   add_definitions(-DIGL_STATIC_LIBRARY)
   set(LIBIGL_LIB_DIRS
@@ -60,18 +53,18 @@ if(LIBIGL_USE_STATIC_LIBRARY)
   endif(NOT LIBIGLBBW_LIBRARY)
   set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES}  ${LIBIGLBBW_LIBRARY})
   FIND_LIBRARY( LIBIGLMOSEK_LIBRARY NAMES iglmosek PATHS ${LIBIGL_LIB_DIRS})
-  if(NOT LIBIGLMOSEK_LIBRARY)
-    set(LIBIGL_FOUND FALSE)
-    message(FATAL_ERROR "could NOT find libiglmosek")
-  endif(NOT LIBIGLMOSEK_LIBRARY)
+#  if(NOT LIBIGLMOSEK_LIBRARY)
+#    set(LIBIGL_FOUND FALSE)
+#    message(FATAL_ERROR "could NOT find libiglmosek")
+#  endif(NOT LIBIGLMOSEK_LIBRARY)
   set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES}  ${LIBIGLMOSEK_LIBRARY})
-  if(MOSEK_FOUND)
-    set(LIBIGL_INCLUDE_DIR ${LIBIGL_INCLUDE_DIR}  ${MOSEK_INCLUDE_DIR})
-    set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES}  ${MOSEK_LIBRARIES})
-  else(MOSEK_FOUND)
-    set(LIBIGL_FOUND FALSE)
-    message(FATAL_ERROR "could NOT find mosek")
-  endif(MOSEK_FOUND)
+#if(MOSEK_FOUND)
+#    set(LIBIGL_INCLUDE_DIR ${LIBIGL_INCLUDE_DIR}  ${MOSEK_INCLUDE_DIR})
+#    set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES}  ${MOSEK_LIBRARIES})
+#  else(MOSEK_FOUND)
+#    set(LIBIGL_FOUND FALSE)
+#    message(FATAL_ERROR "could NOT find mosek")
+#  endif(MOSEK_FOUND)
 
   FIND_LIBRARY( LIBIGLCGAL_LIBRARY NAMES iglcgal PATHS ${LIBIGL_LIB_DIRS})
   if(NOT LIBIGLCGAL_LIBRARY)
@@ -167,3 +160,5 @@ else(LIBIGL_FOUND)
 endif(LIBIGL_FOUND)
 
 MARK_AS_ADVANCED(LIBIGL_INCLUDE_DIR LIBIGL_LIBRARIES IGL_VIEWER_SOURCES)
+
+endif(NOT LIBIGL_FOUND)