浏览代码

Fix DLL copy for CGAL + add build instruction for Windows.

Former-commit-id: 73aafb42558733a412b0ba80267a8fcb4c4bf5f7
Jérémie Dumas 7 年之前
父节点
当前提交
901f15dc25
共有 4 个文件被更改,包括 26 次插入15 次删除
  1. 13 11
      include/igl/combine.cpp
  2. 11 4
      shared/cmake/libigl.cmake
  3. 1 0
      tutorial/609_Boolean/CMakeLists.txt
  4. 1 0
      tutorial/610_CSGTree/CMakeLists.txt

+ 13 - 11
include/igl/combine.cpp

@@ -1,17 +1,17 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2016 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// 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 
+//
+// 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/.
 #include "combine.h"
 #include <cassert>
 
 template <
-  typename DerivedVV, 
-  typename DerivedFF, 
-  typename DerivedV, 
+  typename DerivedVV,
+  typename DerivedFF,
+  typename DerivedV,
   typename DerivedF,
   typename DerivedVsizes,
   typename DerivedFsizes>
@@ -23,7 +23,7 @@ IGL_INLINE void igl::combine(
   Eigen::PlainObjectBase<DerivedVsizes> & Vsizes,
   Eigen::PlainObjectBase<DerivedFsizes> & Fsizes)
 {
-  assert(VV.size() == FF.size() && 
+  assert(VV.size() == FF.size() &&
     "Lists of verex lists and face lists should be same size");
   Vsizes.resize(VV.size());
   Fsizes.resize(FF.size());
@@ -66,9 +66,9 @@ IGL_INLINE void igl::combine(
 }
 
 template <
-  typename DerivedVV, 
-  typename DerivedFF, 
-  typename DerivedV, 
+  typename DerivedVV,
+  typename DerivedFF,
+  typename DerivedV,
   typename DerivedF>
 IGL_INLINE void igl::combine(
   const std::vector<DerivedVV> & VV,
@@ -84,4 +84,6 @@ IGL_INLINE void igl::combine(
 // Explicit template instantiation
 template void igl::combine<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<unsigned long, -1, 1, 0, -1, 1>, Eigen::Matrix<unsigned long, -1, 1, 0, -1, 1> >(std::vector<Eigen::Matrix<double, -1, -1, 0, -1, -1>, std::allocator<Eigen::Matrix<double, -1, -1, 0, -1, -1> > > const&, std::vector<Eigen::Matrix<int, -1, -1, 0, -1, -1>, std::allocator<Eigen::Matrix<int, -1, -1, 0, -1, -1> > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned long, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned long, -1, 1, 0, -1, 1> >&);
 template void igl::combine<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3> >(std::vector<Eigen::Matrix<double, -1, 3, 1, -1, 3>, std::allocator<Eigen::Matrix<double, -1, 3, 1, -1, 3> > > const&, std::vector<Eigen::Matrix<int, -1, 3, 1, -1, 3>, std::allocator<Eigen::Matrix<int, -1, 3, 1, -1, 3> > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> >&);
+template void igl::combine<Eigen::Matrix<double,-1,-1,0,-1,-1>, Eigen::Matrix<int,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,-1,0,-1,-1>,Eigen::Matrix<unsigned __int64,-1,1,0,-1,1>,Eigen::Matrix<unsigned __int64,-1,1,0,-1,1> >(class std::vector<Eigen::Matrix<double,-1,-1,0,-1,-1>,class std::allocator<Eigen::Matrix<double,-1,-1,0,-1,-1> > > const &,class std::vector<Eigen::Matrix<int,-1,-1,0,-1,-1>,class std::allocator<Eigen::Matrix<int,-1,-1,0,-1,-1> > > const &,Eigen::PlainObjectBase<Eigen::Matrix<double,-1,-1,0,-1,-1> > &,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,-1,0,-1,-1> > &,Eigen::PlainObjectBase<Eigen::Matrix<unsigned __int64,-1,1,0,-1,1> > &,Eigen::PlainObjectBase<Eigen::Matrix<unsigned __int64,-1,1,0,-1,1> > &);
+template void igl::combine<Eigen::Matrix<double,-1,-1,0,-1,-1>, Eigen::Matrix<int,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,-1,0,-1,-1>,Eigen::Matrix<unsigned __int64,-1,1,0,-1,1>,Eigen::Matrix<unsigned __int64,-1,1,0,-1,1> >(class std::vector<Eigen::Matrix<double,-1,-1,0,-1,-1>,class std::allocator<Eigen::Matrix<double,-1,-1,0,-1,-1> > > const &,class std::vector<Eigen::Matrix<int,-1,-1,0,-1,-1>,class std::allocator<Eigen::Matrix<int,-1,-1,0,-1,-1> > > const &,Eigen::PlainObjectBase<Eigen::Matrix<double,-1,-1,0,-1,-1> > &,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,-1,0,-1,-1> > &,Eigen::PlainObjectBase<Eigen::Matrix<unsigned __int64,-1,1,0,-1,1> > &,Eigen::PlainObjectBase<Eigen::Matrix<unsigned __int64,-1,1,0,-1,1> > &);
 #endif

+ 11 - 4
shared/cmake/libigl.cmake

@@ -153,10 +153,17 @@ endif()
 function(igl_copy_imported_dll src_target dst_target)
   get_target_property(configurations ${src_target} IMPORTED_CONFIGURATIONS)
   foreach(config ${configurations})
-    get_target_property(location ${src_target} IMPORTED_LOCATION_${config})
-    if(EXISTS "${location}" AND location MATCHES "^.*\\.dll$")
-      add_custom_command(TARGET ${dst_target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${location}" $<TARGET_FILE_DIR:${dst_target}>)
-    endif()
+    get_target_property(main_lib ${src_target} IMPORTED_LOCATION_${config})
+    get_target_property(other_libs ${src_target} IMPORTED_LINK_INTERFACE_LIBRARIES_${config})
+    set(locations)
+    list(APPEND locations ${main_lib} ${other_libs})
+    foreach(location ${locations})
+      string(REGEX MATCH "^(.*)\\.[^.]*$" dummy ${location})
+      set(location "${CMAKE_MATCH_1}.dll")
+      if(EXISTS "${location}" AND location MATCHES "^.*\\.dll$")
+        add_custom_command(TARGET ${dst_target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${location}" $<TARGET_FILE_DIR:${dst_target}>)
+      endif()
+    endforeach()
   endforeach()
 endfunction()
 

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

@@ -3,3 +3,4 @@ project(609_Boolean)
 
 add_executable(${PROJECT_NAME}_bin main.cpp)
 target_link_libraries(${PROJECT_NAME}_bin igl::core igl::cgal igl::opengl igl::opengl_glfw tutorials)
+igl_copy_cgal_dll(${PROJECT_NAME}_bin)

+ 1 - 0
tutorial/610_CSGTree/CMakeLists.txt

@@ -3,3 +3,4 @@ project(610_CSGTree)
 
 add_executable(${PROJECT_NAME}_bin main.cpp)
 target_link_libraries(${PROJECT_NAME}_bin igl::core igl::cgal igl::opengl igl::opengl_glfw tutorials)
+igl_copy_cgal_dll(${PROJECT_NAME}_bin)