Răsfoiți Sursa

Merge branch 'cgal' of https://github.com/jdumas/libigl into jdumas-cgal

Former-commit-id: 68c3b590363ab268469b1d2fee8cc42f96a5b4e5
Daniele Panozzo 7 ani în urmă
părinte
comite
ed843f6e6d

+ 21 - 8
.appveyor.yml

@@ -8,21 +8,34 @@ branches:
     - alecjacobson
     - cmake
     - cgal
+environment:
+  BOOST_ROOT: C:/Libraries/boost_1_65_1
 install:
   - git submodule update --init --recursive
   - cinstall: python
 build_script:
-  - echo Running cmake...
   - cd c:\projects\libigl
-  - cd external
+  # External libraries (boost)
+  # - cd external
+  # - mkdir build
+  # - cd build
+  # - cmake -G "Visual Studio 15 2017 Win64" -T "host=x64" ..
+  # - msbuild %MSBuildOptions% libigl_external.sln
+  # - cd ../..
+  # Python bindings
+  # - cd python
+  # - mkdir build
+  # - cd build
+  # - cmake -DLIBIGL_WITH_EMBREE=OFF -DLIBIGL_USE_STATIC_LIBRARY=ON ../
+  # - msbuild %MSBuildOptions% pyigl.sln
+  # - cd ../tutorial
+  # - ${PYTHON} 101_FileIO.py
+  # - cd ../../
+  # Tutorials
+  - cd tutorial
   - mkdir build
   - cd build
-  - cmake -G "Visual Studio 15 2017 Win64" -T "host=x64" ..
-  - msbuild %MSBuildOptions% libigl_external.sln
-  - cd ../../tutorial
-  - mkdir build
-  - cd build
-  - cmake -D "LIBIGL_USE_STATIC_LIBRARY=ON" -D "LIBIGL_WITH_ANTTWEAKBAR=OFF" -D "BOOST_ROOT=../external/boost/" -G "Visual Studio 15 2017 Win64" ../
+  - cmake -DLIBIGL_USE_STATIC_LIBRARY=ON -G "Visual Studio 15 2017 Win64" ../
   - set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
   - set MSBuildOptions=/v:m /p:Configuration=Debug /logger:%MSBuildLogger%
   - msbuild %MSBuildOptions% libigl_tutorials.sln

+ 5 - 0
.gitignore

@@ -28,6 +28,11 @@ external/embree/bin/*
 external/embree/bin
 external/embree/doc/html/*
 external/embree/doc/latex/*
+external/gmp
+external/mpfr
+external/boost
+external/.cache
+external/build
 .DS_Store
 libigl.zip
 *tags

+ 68 - 64
.travis.yml

@@ -1,67 +1,71 @@
+dist: trusty
+sudo: true
 language: cpp
-sudo: false
-dist: precise
+cache: ccache
 matrix:
   include:
-    - os: linux
-      compiler: gcc-4.8.1
-      script:
-        - git submodule update --init --recursive
-        - mkdir external/glfw/include/GL
-        - wget --no-check-certificate -P external/glfw/include/GL http://www.opengl.org/registry/api/GL/glcorearb.h
-        - cd python
-        - mkdir build
-        - cd build
-        - cmake -DCMAKE_CXX_COMPILER=g++-4.8 -DCMAKE_C_COMPILER=gcc-4.8 -DLIBIGL_WITH_EMBREE=OFF -DLIBIGL_USE_STATIC_LIBRARY=ON ../
-        - make -j 2
-        - cd ../tutorial
-        - python3 101_FileIO.py || { cd ../; mkdir build2; cd build2; cmake -DCMAKE_CXX_COMPILER=g++-4.8 -DCMAKE_C_COMPILER=gcc-4.8 -DLIBIGL_WITH_EMBREE=OFF -DLIBIGL_USE_STATIC_LIBRARY=ON - DCHECK_UNDEFINED=ON ../; make -j 2; }
-        - cd ../../
-        - cd tutorial
-        - mkdir build
-        - cd build
-        - cmake -DLIBIGL_USE_STATIC_LIBRARY=ON  -DCMAKE_CXX_COMPILER=g++-4.8 -DCMAKE_C_COMPILER=gcc-4.8 -DLIBIGL_WITH_EMBREE=OFF ../
-        - make -j 2
-      addons:
-        apt:
-          sources:
-            - ubuntu-toolchain-r-test
-            - george-edison55-precise-backports
-          packages:
-            - xorg-dev
-            - libglu1-mesa-dev
-            - g++-4.8
-            - cmake
-            - cmake-data
-            - libblas-dev
-            - liblapack-dev
-    #         - binutils
-    #         - libx11-dev
-    #         - mesa-common-dev
-    #         - libgl1-mesa-dev
-    #         - libglu1-mesa-dev
-    #         - libxrandr-dev
-    #         - libxi-dev
-    #         - libxmu-dev
-    #         - libblas-dev
-    #         - xorg-dev
-    - os: osx
-      compiler: clang
-      script:
-        # - brew update
-        # - brew upgrade cmake
-        # - brew upgrade cgal
-        - git submodule update --init --recursive
-        - cd python
-        - mkdir build
-        - cd build
-        - cmake ../
-        - make -j 2
-        - cd ../tutorial
-        - python 101_FileIO.py
-        - cd ../../
-        - cd tutorial
-        - mkdir build
-        - cd build
-        - cmake -DLIBIGL_USE_STATIC_LIBRARY=ON ../
-        - make -j 2
+  - os: linux
+    compiler: gcc # 4.8.4 by default on Trusty
+    addons:
+      apt:
+        sources:
+        - ubuntu-toolchain-r-test
+        packages:
+        - libmpfr-dev
+        - libboost-filesystem-dev
+        - libboost-system-dev
+        - libboost-thread-dev
+        - libblas-dev
+        - liblapack-dev
+        - xorg-dev
+        - libglu1-mesa-dev
+    env:
+    - MATRIX_EVAL="export CONFIG=Debug && CHECK_UNDEFINED=ON && PYTHON=python3"
+  - os: linux
+    compiler: gcc-7
+    addons:
+      apt:
+        sources:
+        - ubuntu-toolchain-r-test
+        packages:
+        - gcc-7
+        - g++-7
+        - libmpfr-dev
+        - libboost-filesystem-dev
+        - libboost-system-dev
+        - libboost-thread-dev
+        - libblas-dev
+        - liblapack-dev
+        - xorg-dev
+        - libglu1-mesa-dev
+    env:
+    - MATRIX_EVAL="export CC=gcc-7 && CXX=g++-7 && CONFIG=Debug && CHECK_UNDEFINED=OFF && PYTHON=python3"
+  - os: osx
+    compiler: clang
+    env:
+    - MATRIX_EVAL="export CONFIG=Debug && CHECK_UNDEFINED=OFF && PYTHON=python"
+
+install:
+- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ccache; fi
+- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi
+- eval "${MATRIX_EVAL}"
+- ccache --max-size=5.0G
+- ccache -V && ccache --show-stats && ccache --zero-stats
+
+script:
+# Python bindings
+- cd python
+- mkdir build
+- cd build
+- cmake -DCMAKE_BUILD_TYPE=$CONFIG -DLIBIGL_WITH_EMBREE=OFF -DLIBIGL_USE_STATIC_LIBRARY=ON -DCHECK_UNDEFINED=${CHECK_UNDEFINED} ../
+- make -j 2
+- cd ../tutorial
+- ${PYTHON} 101_FileIO.py
+- cd ../../
+# Tutorials
+- cd tutorial
+- mkdir build
+- cd build
+- cmake -DCMAKE_BUILD_TYPE=$CONFIG -DLIBIGL_USE_STATIC_LIBRARY=ON ../
+- make -j 2
+- ccache --show-stats

+ 1 - 0
include/igl/AABB.cpp

@@ -1071,4 +1071,5 @@ template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::init<Eigen
 // generated by autoexplicit.sh
 template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::init<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
 template double igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, double, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&) const;
+template bool igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::intersect_ray<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, igl::Hit&) const;
 #endif

+ 26 - 25
include/igl/copyleft/tetgen/tetrahedralize.cpp

@@ -1,15 +1,15 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 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 "tetrahedralize.h"
 #include "mesh_to_tetgenio.h"
 #include "tetgenio_to_tetmesh.h"
 
-// IGL includes 
+// IGL includes
 #include "../../matrix_to_list.h"
 #include "../../list_to_matrix.h"
 #include "../../boundary_facets.h"
@@ -19,11 +19,11 @@
 #include <iostream>
 
 IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
-  const std::vector<std::vector<REAL > > & V, 
-  const std::vector<std::vector<int> > & F, 
+  const std::vector<std::vector<REAL > > & V,
+  const std::vector<std::vector<int> > & F,
   const std::string switches,
-  std::vector<std::vector<REAL > > & TV, 
-  std::vector<std::vector<int > > & TT, 
+  std::vector<std::vector<REAL > > & TV,
+  std::vector<std::vector<int > > & TT,
   std::vector<std::vector<int> > & TF)
 {
   using namespace std;
@@ -60,10 +60,10 @@ IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
 }
 
 template <
-  typename DerivedV, 
-  typename DerivedF, 
-  typename DerivedTV, 
-  typename DerivedTT, 
+  typename DerivedV,
+  typename DerivedF,
+  typename DerivedTV,
+  typename DerivedTT,
   typename DerivedTF>
 IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
   const Eigen::PlainObjectBase<DerivedV>& V,
@@ -101,12 +101,12 @@ IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
 }
 
 template <
-  typename DerivedV, 
-  typename DerivedF, 
-  typename DerivedVM, 
-  typename DerivedFM, 
-  typename DerivedTV, 
-  typename DerivedTT, 
+  typename DerivedV,
+  typename DerivedF,
+  typename DerivedVM,
+  typename DerivedFM,
+  typename DerivedTV,
+  typename DerivedTT,
   typename DerivedTF,
   typename DerivedTM>
 IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
@@ -124,7 +124,7 @@ IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
   vector<vector<REAL> > vV,vTV;
   vector<vector<int> > vF,vTT,vTF;
   vector<int> vTM;
-	
+
   matrix_to_list(V,vV);
   matrix_to_list(F,vF);
 	vector<int> vVM = matrix_to_list(VM);
@@ -156,13 +156,13 @@ IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
   return e;
 }
 IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
-  const std::vector<std::vector<REAL > > & V, 
-  const std::vector<std::vector<int> > & F, 
-  const std::vector<int> & VM, 
+  const std::vector<std::vector<REAL > > & V,
+  const std::vector<std::vector<int> > & F,
+  const std::vector<int> & VM,
 	const std::vector<int> & FM,
   const std::string switches,
-  std::vector<std::vector<REAL > > & TV, 
-  std::vector<std::vector<int > > & TT, 
+  std::vector<std::vector<REAL > > & TV,
+  std::vector<std::vector<int > > & TT,
   std::vector<std::vector<int> > & TF,
   std::vector<int> & TM)
 {
@@ -216,4 +216,5 @@ IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
 // Explicit template instantiation
 template int igl::copyleft::tetgen::tetrahedralize<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<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&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 template int igl::copyleft::tetgen::tetrahedralize<Eigen::Matrix<double, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -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<int, -1, -1, 0, -1, -1>,Eigen::Matrix<int, -1, 1, 0, -1, 1> >(const 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> > &,const Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > &,const std::basic_string<char, std::char_traits<char>, std::allocator<char> >,Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > &,Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > &,Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > &, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > &);
+template int igl::copyleft::tetgen::tetrahedralize<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -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<int, -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> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 #endif

+ 1 - 1
include/igl/exact_geodesic.cpp.REMOVED.git-id

@@ -1 +1 @@
-0ffa8b0392da9471a2fd26ec71effd909d4a75f3
+a0c5a93d2bc144890fbfa8d5e413d4dddc4a2827

+ 1 - 0
include/igl/matrix_to_list.cpp

@@ -75,4 +75,5 @@ template void igl::matrix_to_list<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::D
 template void igl::matrix_to_list<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::vector<std::vector<Eigen::Matrix<int, -1, 1, 0, -1, 1>::Scalar, std::allocator<Eigen::Matrix<int, -1, 1, 0, -1, 1>::Scalar> >, std::allocator<std::vector<Eigen::Matrix<int, -1, 1, 0, -1, 1>::Scalar, std::allocator<Eigen::Matrix<int, -1, 1, 0, -1, 1>::Scalar> > > >&);
 template void igl::matrix_to_list<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, std::vector<Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar, std::allocator<Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar> >&);
 template void igl::matrix_to_list<Eigen::Matrix<int, 1, -1, 1, 1, -1> >(Eigen::DenseBase<Eigen::Matrix<int, 1, -1, 1, 1, -1> > const&, std::vector<Eigen::Matrix<int, 1, -1, 1, 1, -1>::Scalar, std::allocator<Eigen::Matrix<int, 1, -1, 1, 1, -1>::Scalar> >&);
+template std::vector<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, std::allocator<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar> > igl::matrix_to_list<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
 #endif

+ 15 - 10
include/igl/ray_box_intersect.cpp

@@ -1,9 +1,9 @@
 // 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 "ray_box_intersect.h"
 #include <vector>
@@ -27,7 +27,7 @@ IGL_INLINE bool igl::ray_box_intersect(
     const Eigen::Vector3f& rayo,
     const Eigen::Vector3f& rayd,
     const Eigen::Vector3f& bmin,
-    const Eigen::Vector3f& bmax, 
+    const Eigen::Vector3f& bmax,
     float & tnear,
     float & tfar
     )->bool
@@ -35,12 +35,12 @@ IGL_INLINE bool igl::ray_box_intersect(
     Eigen::Vector3f bnear;
     Eigen::Vector3f bfar;
     // Checks for intersection testing on each direction coordinate
-    // Computes 
+    // Computes
     float t1, t2;
     tnear = -1e+6f, tfar = 1e+6f; //, tCube;
     bool intersectFlag = true;
     for (int i = 0; i < 3; ++i) {
-  //    std::cout << "coordinate " << i << ": bmin " << bmin(i) << ", bmax " << bmax(i) << std::endl; 
+  //    std::cout << "coordinate " << i << ": bmin " << bmin(i) << ", bmax " << bmax(i) << std::endl;
       assert(bmin(i) <= bmax(i));
       if (::fabs(rayd(i)) < 1e-6) {   // Ray parallel to axis i-th
         if (rayo(i) < bmin(i) || rayo(i) > bmax(i)) {
@@ -59,12 +59,12 @@ IGL_INLINE bool igl::ray_box_intersect(
         }
   //      std::cout << "  bnear " << bnear(i) << ", bfar " << bfar(i) << std::endl;
         // Finds the distance parameters t1 and t2 of the two ray-box intersections:
-        // t1 must be the closest to the ray origin rayo. 
+        // t1 must be the closest to the ray origin rayo.
         t1 = (bnear(i) - rayo(i)) / rayd(i);
         t2 = (bfar(i) - rayo(i)) / rayd(i);
         if (t1 > t2) {
           std::swap(t1,t2);
-        } 
+        }
         // The two intersection values are used to saturate tnear and tfar
         if (t1 > tnear) {
           tnear = t1;
@@ -72,7 +72,7 @@ IGL_INLINE bool igl::ray_box_intersect(
         if (t2 < tfar) {
           tfar = t2;
         }
-  //      std::cout << "  t1 " << t1 << ", t2 " << t2 << ", tnear " << tnear << ", tfar " << tfar 
+  //      std::cout << "  t1 " << t1 << ", t2 " << t2 << ", tnear " << tnear << ", tfar " << tfar
   //        << "  tnear > tfar? " << (tnear > tfar) << ", tfar < 0? " << (tfar < 0) << std::endl;
         if(tnear > tfar) {
           intersectFlag = false;
@@ -143,3 +143,8 @@ IGL_INLINE bool igl::ray_box_intersect(
   return true;
 #endif
 }
+
+#ifdef IGL_STATIC_LIBRARY
+// Explicit template instantiation
+template bool igl::ray_box_intersect<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, double>(Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::AlignedBox<double, 3> const&, double const&, double const&, double&, double&);
+#endif

+ 12 - 10
include/igl/ray_mesh_intersect.cpp

@@ -1,9 +1,9 @@
 // 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 "ray_mesh_intersect.h"
 
@@ -15,8 +15,8 @@ extern "C"
 template <
   typename Derivedsource,
   typename Deriveddir,
-  typename DerivedV, 
-  typename DerivedF> 
+  typename DerivedV,
+  typename DerivedF>
 IGL_INLINE bool igl::ray_mesh_intersect(
   const Eigen::MatrixBase<Derivedsource> & s,
   const Eigen::MatrixBase<Deriveddir> & dir,
@@ -26,14 +26,14 @@ IGL_INLINE bool igl::ray_mesh_intersect(
 {
   using namespace Eigen;
   using namespace std;
-  // Should be but can't be const 
+  // Should be but can't be const
   Vector3d s_d = s.template cast<double>();
   Vector3d dir_d = dir.template cast<double>();
   hits.clear();
   // loop over all triangles
   for(int f = 0;f<F.rows();f++)
   {
-    // Should be but can't be const 
+    // Should be but can't be const
     RowVector3d v0 = V.row(F(f,0)).template cast<double>();
     RowVector3d v1 = V.row(F(f,1)).template cast<double>();
     RowVector3d v2 = V.row(F(f,2)).template cast<double>();
@@ -57,8 +57,8 @@ IGL_INLINE bool igl::ray_mesh_intersect(
 template <
   typename Derivedsource,
   typename Deriveddir,
-  typename DerivedV, 
-  typename DerivedF> 
+  typename DerivedV,
+  typename DerivedF>
 IGL_INLINE bool igl::ray_mesh_intersect(
   const Eigen::MatrixBase<Derivedsource> & source,
   const Eigen::MatrixBase<Deriveddir> & dir,
@@ -81,4 +81,6 @@ IGL_INLINE bool igl::ray_mesh_intersect(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
 template bool igl::ray_mesh_intersect<Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<igl::Hit, std::allocator<igl::Hit> >&);
+template bool igl::ray_mesh_intersect<Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::Hit&);
+template bool igl::ray_mesh_intersect<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Block<Eigen::Matrix<int, -1, -1, 0, -1, -1> const, 1, -1, false> >(Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Block<Eigen::Matrix<int, -1, -1, 0, -1, -1> const, 1, -1, false> > const&, igl::Hit&);
 #endif

+ 1 - 1
python/CMakeLists.txt

@@ -144,7 +144,7 @@ elseif(UNIX)
   # .SO file extension on Linux/Mac OS
   set_target_properties(pyigl PROPERTIES SUFFIX ".so")
 
-  #Enable flag if undefined symbols appear on pyigl module import to get notified about the missing symbols at link time
+  # Enable flag if undefined symbols appear on pyigl module import to get notified about the missing symbols at link time
   option(CHECK_UNDEFINED        "Check for undefined symbols"    OFF)
 
   # Strip unnecessary sections of the binary on Linux/Mac OS

+ 17 - 0
shared/cmake/DownloadProject.CMakeLists.cmake.in

@@ -0,0 +1,17 @@
+# Distributed under the OSI-approved MIT License.  See accompanying
+# file LICENSE or https://github.com/Crascit/DownloadProject for details.
+
+cmake_minimum_required(VERSION 2.8.2)
+
+project(${DL_ARGS_PROJ}-download NONE)
+
+include(ExternalProject)
+ExternalProject_Add(${DL_ARGS_PROJ}-download
+                    ${DL_ARGS_UNPARSED_ARGUMENTS}
+                    SOURCE_DIR          "${DL_ARGS_SOURCE_DIR}"
+                    BINARY_DIR          "${DL_ARGS_BINARY_DIR}"
+                    CONFIGURE_COMMAND   ""
+                    BUILD_COMMAND       ""
+                    INSTALL_COMMAND     ""
+                    TEST_COMMAND        ""
+)

+ 182 - 0
shared/cmake/DownloadProject.cmake

@@ -0,0 +1,182 @@
+# Distributed under the OSI-approved MIT License.  See accompanying
+# file LICENSE or https://github.com/Crascit/DownloadProject for details.
+#
+# MODULE:   DownloadProject
+#
+# PROVIDES:
+#   download_project( PROJ projectName
+#                    [PREFIX prefixDir]
+#                    [DOWNLOAD_DIR downloadDir]
+#                    [SOURCE_DIR srcDir]
+#                    [BINARY_DIR binDir]
+#                    [QUIET]
+#                    ...
+#   )
+#
+#       Provides the ability to download and unpack a tarball, zip file, git repository,
+#       etc. at configure time (i.e. when the cmake command is run). How the downloaded
+#       and unpacked contents are used is up to the caller, but the motivating case is
+#       to download source code which can then be included directly in the build with
+#       add_subdirectory() after the call to download_project(). Source and build
+#       directories are set up with this in mind.
+#
+#       The PROJ argument is required. The projectName value will be used to construct
+#       the following variables upon exit (obviously replace projectName with its actual
+#       value):
+#
+#           projectName_SOURCE_DIR
+#           projectName_BINARY_DIR
+#
+#       The SOURCE_DIR and BINARY_DIR arguments are optional and would not typically
+#       need to be provided. They can be specified if you want the downloaded source
+#       and build directories to be located in a specific place. The contents of
+#       projectName_SOURCE_DIR and projectName_BINARY_DIR will be populated with the
+#       locations used whether you provide SOURCE_DIR/BINARY_DIR or not.
+#
+#       The DOWNLOAD_DIR argument does not normally need to be set. It controls the
+#       location of the temporary CMake build used to perform the download.
+#
+#       The PREFIX argument can be provided to change the base location of the default
+#       values of DOWNLOAD_DIR, SOURCE_DIR and BINARY_DIR. If all of those three arguments
+#       are provided, then PREFIX will have no effect. The default value for PREFIX is
+#       CMAKE_BINARY_DIR.
+#
+#       The QUIET option can be given if you do not want to show the output associated
+#       with downloading the specified project.
+#
+#       In addition to the above, any other options are passed through unmodified to
+#       ExternalProject_Add() to perform the actual download, patch and update steps.
+#       The following ExternalProject_Add() options are explicitly prohibited (they
+#       are reserved for use by the download_project() command):
+#
+#           CONFIGURE_COMMAND
+#           BUILD_COMMAND
+#           INSTALL_COMMAND
+#           TEST_COMMAND
+#
+#       Only those ExternalProject_Add() arguments which relate to downloading, patching
+#       and updating of the project sources are intended to be used. Also note that at
+#       least one set of download-related arguments are required.
+#
+#       If using CMake 3.2 or later, the UPDATE_DISCONNECTED option can be used to
+#       prevent a check at the remote end for changes every time CMake is run
+#       after the first successful download. See the documentation of the ExternalProject
+#       module for more information. It is likely you will want to use this option if it
+#       is available to you. Note, however, that the ExternalProject implementation contains
+#       bugs which result in incorrect handling of the UPDATE_DISCONNECTED option when
+#       using the URL download method or when specifying a SOURCE_DIR with no download
+#       method. Fixes for these have been created, the last of which is scheduled for
+#       inclusion in CMake 3.8.0. Details can be found here:
+#
+#           https://gitlab.kitware.com/cmake/cmake/commit/bdca68388bd57f8302d3c1d83d691034b7ffa70c
+#           https://gitlab.kitware.com/cmake/cmake/issues/16428
+#
+#       If you experience build errors related to the update step, consider avoiding
+#       the use of UPDATE_DISCONNECTED.
+#
+# EXAMPLE USAGE:
+#
+#   include(DownloadProject)
+#   download_project(PROJ                googletest
+#                    GIT_REPOSITORY      https://github.com/google/googletest.git
+#                    GIT_TAG             master
+#                    UPDATE_DISCONNECTED 1
+#                    QUIET
+#   )
+#
+#   add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
+#
+#========================================================================================
+
+
+set(_DownloadProjectDir "${CMAKE_CURRENT_LIST_DIR}")
+
+include(CMakeParseArguments)
+
+function(download_project)
+
+    set(options QUIET)
+    set(oneValueArgs
+        PROJ
+        PREFIX
+        DOWNLOAD_DIR
+        SOURCE_DIR
+        BINARY_DIR
+        # Prevent the following from being passed through
+        CONFIGURE_COMMAND
+        BUILD_COMMAND
+        INSTALL_COMMAND
+        TEST_COMMAND
+    )
+    set(multiValueArgs "")
+
+    cmake_parse_arguments(DL_ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+    # Hide output if requested
+    if (DL_ARGS_QUIET)
+        set(OUTPUT_QUIET "OUTPUT_QUIET")
+    else()
+        unset(OUTPUT_QUIET)
+        message(STATUS "Downloading/updating ${DL_ARGS_PROJ}")
+    endif()
+
+    # Set up where we will put our temporary CMakeLists.txt file and also
+    # the base point below which the default source and binary dirs will be.
+    # The prefix must always be an absolute path.
+    if (NOT DL_ARGS_PREFIX)
+        set(DL_ARGS_PREFIX "${CMAKE_BINARY_DIR}")
+    else()
+        get_filename_component(DL_ARGS_PREFIX "${DL_ARGS_PREFIX}" ABSOLUTE
+                               BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+    endif()
+    if (NOT DL_ARGS_DOWNLOAD_DIR)
+        set(DL_ARGS_DOWNLOAD_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJ}-download")
+    endif()
+
+    # Ensure the caller can know where to find the source and build directories
+    if (NOT DL_ARGS_SOURCE_DIR)
+        set(DL_ARGS_SOURCE_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJ}-src")
+    endif()
+    if (NOT DL_ARGS_BINARY_DIR)
+        set(DL_ARGS_BINARY_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJ}-build")
+    endif()
+    set(${DL_ARGS_PROJ}_SOURCE_DIR "${DL_ARGS_SOURCE_DIR}" PARENT_SCOPE)
+    set(${DL_ARGS_PROJ}_BINARY_DIR "${DL_ARGS_BINARY_DIR}" PARENT_SCOPE)
+
+    # The way that CLion manages multiple configurations, it causes a copy of
+    # the CMakeCache.txt to be copied across due to it not expecting there to
+    # be a project within a project.  This causes the hard-coded paths in the
+    # cache to be copied and builds to fail.  To mitigate this, we simply
+    # remove the cache if it exists before we configure the new project.  It
+    # is safe to do so because it will be re-generated.  Since this is only
+    # executed at the configure step, it should not cause additional builds or
+    # downloads.
+    file(REMOVE "${DL_ARGS_DOWNLOAD_DIR}/CMakeCache.txt")
+
+    # Create and build a separate CMake project to carry out the download.
+    # If we've already previously done these steps, they will not cause
+    # anything to be updated, so extra rebuilds of the project won't occur.
+    # Make sure to pass through CMAKE_MAKE_PROGRAM in case the main project
+    # has this set to something not findable on the PATH.
+    configure_file("${_DownloadProjectDir}/DownloadProject.CMakeLists.cmake.in"
+                   "${DL_ARGS_DOWNLOAD_DIR}/CMakeLists.txt")
+    execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"
+                        -D "CMAKE_MAKE_PROGRAM:FILE=${CMAKE_MAKE_PROGRAM}"
+                        .
+                    RESULT_VARIABLE result
+                    ${OUTPUT_QUIET}
+                    WORKING_DIRECTORY "${DL_ARGS_DOWNLOAD_DIR}"
+    )
+    if(result)
+        message(FATAL_ERROR "CMake step for ${DL_ARGS_PROJ} failed: ${result}")
+    endif()
+    execute_process(COMMAND ${CMAKE_COMMAND} --build .
+                    RESULT_VARIABLE result
+                    ${OUTPUT_QUIET}
+                    WORKING_DIRECTORY "${DL_ARGS_DOWNLOAD_DIR}"
+    )
+    if(result)
+        message(FATAL_ERROR "Build step for ${DL_ARGS_PROJ} failed: ${result}")
+    endif()
+
+endfunction()

+ 0 - 97
shared/cmake/FindCGAL.cmake

@@ -1,97 +0,0 @@
-#
-# The following module is based on FindVTK.cmake
-#
-
-# - Find a CGAL installation or binary tree.
-# The following variables are set if CGAL is found.  If CGAL is not
-# found, CGAL_FOUND is set to false.
-#
-#  CGAL_FOUND         - Set to true when CGAL is found.
-#  CGAL_USE_FILE      - CMake file to use CGAL.
-#
-
-# Construct consitent error messages for use below.
-set(CGAL_DIR_DESCRIPTION "directory containing CGALConfig.cmake. This is either the binary directory where CGAL was configured or PREFIX/lib/CGAL for an installation.")
-set(CGAL_DIR_MESSAGE     "CGAL not found.  Set the CGAL_DIR cmake variable or environment variable to the ${CGAL_DIR_DESCRIPTION}")
-
-set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
-
-if ( NOT CGAL_DIR )
-
-  # Get the system search path as a list.
-  if(UNIX)
-    string(REGEX MATCHALL "[^:]+" CGAL_DIR_SEARCH1 "$ENV{PATH}")
-  else()
-    string(REGEX REPLACE "\\\\" "/" CGAL_DIR_SEARCH1 "$ENV{PATH}")
-  endif()
-
-  string(REGEX REPLACE "/;" ";" CGAL_DIR_SEARCH2 "${CGAL_DIR_SEARCH1}")
-
-  # Construct a set of paths relative to the system search path.
-  set(CGAL_DIR_SEARCH "")
-
-  foreach(dir ${CGAL_DIR_SEARCH2})
-
-    set(CGAL_DIR_SEARCH ${CGAL_DIR_SEARCH} ${dir}/../lib/CGAL )
-
-  endforeach()
-
-
-  #
-  # Look for an installation or build tree.
-  #
-  find_path(CGAL_DIR CGALConfig.cmake
-    # Look for CGAL in 'external/' folder
-    "${CMAKE_CURRENT_LIST_DIR}/../../external/cgal/lib/CGAL"
-
-    # Look for an environment variable CGAL_DIR.
-    $ENV{CGAL_DIR}
-
-    # Look in places relative to the system executable search path.
-    ${CGAL_DIR_SEARCH}
-
-    # Look in standard UNIX install locations.
-    /usr/lib/x86_64-linux-gnu/cmake/CGAL
-    /opt/local/share/CGAL/cmake
-    /usr/local/lib/CGAL
-    /usr/lib/CGAL
-
-    # Read from the CMakeSetup registry entries.  It is likely that
-    # CGAL will have been recently built.
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10]
-
-    # Help the user find it if we cannot.
-    DOC "The ${CGAL_DIR_DESCRIPTION}"
-  )
-
-endif()
-
-if ( CGAL_DIR )
-
-  if ( EXISTS "${CGAL_DIR}/CGALConfig.cmake" )
-    include( "${CGAL_DIR}/CGALConfig.cmake" )
-    set( CGAL_FOUND TRUE )
-  endif()
-
-endif()
-
-if(CGAL_FOUND)
-  MESSAGE(STATUS "Found CGAL: ${CGAL_DIR}")
-else()
-  if(CGAL_FIND_REQUIRED)
-    MESSAGE(FATAL_ERROR ${CGAL_DIR_MESSAGE})
-  else()
-    if(NOT CGAL_FIND_QUIETLY)
-      MESSAGE(STATUS ${CGAL_DIR_MESSAGE})
-    endif()
-  endif()
-endif()

+ 61 - 41
shared/cmake/libigl.cmake

@@ -21,19 +21,14 @@ endif()
 ### Find packages to populate default options ###
 #
 # COMPONENTS should match subsequent calls
-find_package(CGAL COMPONENTS Core) # --> CGAL_FOUND
-find_package(Boost 1.48 COMPONENTS thread system) # --> BOOST_FOUND
-if(CGAL_FOUND AND BOOST_FOUND)
-  set(CGAL_AND_BOOST_FOUND TRUE)
-endif()
 find_package(Matlab COMPONENTS MEX_COMPILER MX_LIBRARY ENG_LIBRARY) # --> Matlab_FOUND
 find_package(MOSEK) # --> MOSEK_FOUND
 find_package(OpenGL) # --> OPENGL_FOUND
 
 ### Available options ###
-option(LIBIGL_USE_STATIC_LIBRARY     "Use libigl as static library" OFF)
+option(LIBIGL_USE_STATIC_LIBRARY     "Use libigl as static library" ON)
 option(LIBIGL_WITH_ANTTWEAKBAR       "Use AntTweakBar"    OFF)
-option(LIBIGL_WITH_CGAL              "Use CGAL"           "${CGAL_AND_BOOST_FOUND}")
+option(LIBIGL_WITH_CGAL              "Use CGAL"           ON)
 option(LIBIGL_WITH_COMISO            "Use CoMiso"         ON)
 option(LIBIGL_WITH_CORK              "Use Cork"           OFF)
 option(LIBIGL_WITH_EMBREE            "Use Embree"         OFF)
@@ -86,9 +81,6 @@ target_compile_features(igl_common INTERFACE ${CXX11_FEATURES})
 if(MSVC)
   # Enable parallel compilation for Visual Studio
   target_compile_options(igl_common INTERFACE /MP /bigobj)
-  if(LIBIGL_WITH_CGAL)
-    target_compile_options(igl_common INTERFACE "/MD$<$<CONFIG:Debug>:d>")
-  endif()
 endif()
 
 if(BUILD_SHARED_LIBS)
@@ -110,6 +102,38 @@ target_link_libraries(igl_common INTERFACE ${CMAKE_THREAD_LIBS_INIT})
 
 ################################################################################
 
+include(DownloadProject)
+
+# Shortcut function
+function(igl_download_project name)
+  download_project(
+    PROJ         ${name}
+    SOURCE_DIR   ${LIBIGL_EXTERNAL}/${name}
+    DOWNLOAD_DIR ${LIBIGL_EXTERNAL}/.cache/${name}
+    ${ARGN}
+  )
+endfunction()
+
+################################################################################
+
+## CGAL dependencies on Windows: GMP & MPFR
+function(igl_download_cgal_deps)
+  if(WIN32)
+    igl_download_project(gmp
+        URL     https://cgal.geometryfactory.com/CGAL/precompiled_libs/auxiliary/x64/GMP/5.0.1/gmp-all-CGAL-3.9.zip
+        URL_MD5 508c1292319c832609329116a8234c9f
+    )
+    igl_download_project(mpfr
+        URL https://cgal.geometryfactory.com/CGAL/precompiled_libs/auxiliary/x64/MPFR/3.0.0/mpfr-all-CGAL-3.9.zip
+        URL_MD5 48840454eef0ff18730050c05028734b
+    )
+    set(ENV{GMP_DIR} "${LIBIGL_EXTERNAL}/gmp")
+    set(ENV{MPFR_DIR} "${LIBIGL_EXTERNAL}/mpfr")
+  endif()
+endfunction()
+
+################################################################################
+
 function(compile_igl_module module_dir)
   string(REPLACE "/" "_" module_name "${module_dir}")
   if(module_name STREQUAL "core")
@@ -164,23 +188,25 @@ if(LIBIGL_WITH_ANTTWEAKBAR)
 endif()
 
 ################################################################################
-### Compile the cgal parts ###
+### Compile the CGAL part ###
 if(LIBIGL_WITH_CGAL)
+  # Try to find the CGAL library
   # CGAL Core is needed for
   # `Exact_predicates_exact_constructions_kernel_with_sqrt`
-  if(EXISTS ${LIBIGL_EXTERNAL}/boost)
-    set(BOOST_ROOT "${LIBIGL_EXTERNAL}/boost")
+  if(NOT TARGET CGAL::CGAL)
+    set(CGAL_DIR "${LIBIGL_EXTERNAL}/cgal")
+    igl_download_cgal_deps()
+    if(EXISTS ${LIBIGL_EXTERNAL}/boost)
+      set(BOOST_ROOT "${LIBIGL_EXTERNAL}/boost")
+    endif()
+    set(CGAL_Boost_USE_STATIC_LIBS ON CACHE BOOL "" FORCE)
+    find_package(CGAL CONFIG COMPONENTS Core PATHS ${CGAL_DIR} NO_DEFAULT_PATH)
   endif()
-  find_package(CGAL COMPONENTS Core)
-  if(CGAL_FOUND)
+
+  # If CGAL has been found, then build the libigl module
+  if(TARGET CGAL::CGAL AND TARGET CGAL::CGAL_Core)
     compile_igl_module("cgal")
-    if(WIN32)
-      set(Boost_USE_STATIC_LIBS ON) # Favor static Boost libs on Windows
-    endif()
-    target_include_directories(igl_cgal ${IGL_SCOPE} "${GMP_INCLUDE_DIR}" "${MPFR_INCLUDE_DIR}")
-    find_package(Boost 1.48 REQUIRED thread system)
-    target_include_directories(igl_cgal ${IGL_SCOPE} ${CGAL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
-    target_link_libraries(igl_cgal ${IGL_SCOPE} CGAL::CGAL CGAL::CGAL_Core ${Boost_LIBRARIES})
+    target_link_libraries(igl_cgal ${IGL_SCOPE} CGAL::CGAL CGAL::CGAL_Core)
   else()
     set(LIBIGL_WITH_CGAL OFF CACHE BOOL "" FORCE)
   endif()
@@ -188,19 +214,15 @@ endif()
 
 # Helper function for `igl_copy_cgal_dll()`
 function(igl_copy_imported_dll src_target dst_target)
-  get_target_property(configurations ${src_target} IMPORTED_CONFIGURATIONS)
-  foreach(config ${configurations})
-    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()
+  get_target_property(other_libs ${src_target} INTERFACE_LINK_LIBRARIES)
+  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()
 endfunction()
 
@@ -213,7 +235,7 @@ function(igl_copy_cgal_dll target)
 endfunction()
 
 ################################################################################
-# Compile CoMISo
+### Compile the CoMISo part ###
 # NOTE: this cmakefile works only with the
 # comiso available here: https://github.com/libigl/CoMISo
 if(LIBIGL_WITH_COMISO)
@@ -225,7 +247,7 @@ if(LIBIGL_WITH_COMISO)
 endif()
 
 ################################################################################
-### Compile the cork parts ###
+### Compile the cork part ###
 if(LIBIGL_WITH_CORK)
   set(CORK_DIR "${LIBIGL_EXTERNAL}/cork")
   if(NOT TARGET cork)
@@ -248,6 +270,7 @@ if(LIBIGL_WITH_EMBREE)
   set(EMBREE_TASKING_SYSTEM "INTERNAL" CACHE BOOL " " FORCE)
   set(EMBREE_TUTORIALS OFF CACHE BOOL " " FORCE)
   set(EMBREE_MAX_ISA NONE CACHE STRINGS " " FORCE)
+  set(BUILD_TESTING OFF CACHE BOOL " " FORCE)
 
   # set(ENABLE_INSTALLER OFF CACHE BOOL " " FORCE)
   if(MSVC)
@@ -309,8 +332,7 @@ if(LIBIGL_WITH_MOSEK)
 endif()
 
 ################################################################################
-### Compile the opengl parts ###
-
+### Compile the opengl part ###
 if(LIBIGL_WITH_OPENGL)
   # OpenGL module
   find_package(OpenGL REQUIRED)
@@ -327,7 +349,6 @@ endif()
 
 ################################################################################
 ### Compile the GLFW part ###
-
 if(LIBIGL_WITH_OPENGL_GLFW)
   if(TARGET igl::opengl)
     # GLFW module
@@ -345,7 +366,6 @@ endif()
 
 ################################################################################
 ### Compile the ImGui part ###
-
 if(LIBIGL_WITH_OPENGL_GLFW_IMGUI)
   if(TARGET igl::opengl_glfw)
     # ImGui module