Skip to content
Browse files

rewrite Eigen detection in CMakelists. cleanup files for pull request.

  • Loading branch information...
1 parent 702525f commit a9045315baac2e8bd24428668cfa88f116984af7 @donbright donbright committed Aug 19, 2012
Showing with 49 additions and 59 deletions.
  1. +2 −2 eigen.pri
  2. +2 −1 scripts/linux-build-dependencies.sh
  3. +1 −0 src/dxfdata.cc
  4. +2 −0 src/dxfdim.cc
  5. +2 −4 src/dxftess-cgal.cc
  6. +40 −52 tests/CMakeLists.txt
View
4 eigen.pri
@@ -22,12 +22,12 @@ CONFIG(mingw-cross-env) {
# Optionally specify location of Eigen3 using the
# OPENSCAD_LIBRARIES env. variable
!isEmpty(OPENSCAD_LIBRARIES_DIR) {
- isEmpty(EIGEN_INCLUDEPATH) {
+ isEmpty(EIGEN_INCLUDEPATH) {
exists($$OPENSCAD_LIBRARIES_DIR/include/eigen3) {
EIGEN_INCLUDEPATH = $$OPENSCAD_LIBRARIES_DIR/include/eigen3
}
}
- isEmpty(EIGEN_INCLUDEPATH) {
+ isEmpty(EIGEN_INCLUDEPATH) {
exists($$OPENSCAD_LIBRARIES_DIR/include/eigen2) {
EIGEN_INCLUDEPATH = $$OPENSCAD_LIBRARIES_DIR/include/eigen2
}
View
3 scripts/linux-build-dependencies.sh
@@ -268,6 +268,7 @@ build_eigen()
make install
}
+
OPENSCADDIR=$PWD
if [ ! -f $OPENSCADDIR/openscad.pro ]; then
echo "Must be run from the OpenSCAD source root directory"
@@ -329,7 +330,7 @@ fi
build_eigen 3.1.1
build_gmp 5.0.5
build_mpfr 3.1.1
-build_boost 1.50.0
+build_boost 1.47.0
# NB! For CGAL, also update the actual download URL in the function
build_cgal 4.0.2
build_glew 1.7.0
View
1 src/dxfdata.cc
@@ -39,6 +39,7 @@
#include <boost/algorithm/string.hpp>
#include <algorithm>
#include <sstream>
+#include <map>
#include <QDir>
#include "value.h"
View
2 src/dxfdim.cc
@@ -183,7 +183,9 @@ Value builtin_dxf_cross(const Context *ctx, const std::vector<std::string> &argn
return dxf_cross_cache[key] = Value(ret);
}
}
+
PRINTB("WARNING: Can't find cross in '%s', layer '%s'!", filename % layername);
+
return Value();
}
View
6 src/dxftess-cgal.cc
@@ -107,10 +107,8 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool /* do_tr
std::vector<struct triangle> tri;
Grid2d<point_info_t> point_info(GRID_FINE);
-// boost::unordered_map<edge_t,int> edge_to_triangle;
-// boost::unordered_map<edge_t,int> edge_to_path;
- std::map<edge_t,int> edge_to_triangle;
- std::map<edge_t,int> edge_to_path;
+ boost::unordered_map<edge_t,int> edge_to_triangle;
+ boost::unordered_map<edge_t,int> edge_to_path;
CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
try {
View
92 tests/CMakeLists.txt
@@ -178,74 +178,62 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
endif()
endif()
-# First try to find Eigen3. If it's not there, fallback to Eigen2
+# Priority
+# 3. EIGEN3DIR / EIGEN2DIR if set
+# 1. OPENSCAD_LIBRARIES eigen3
+# 2. OPENSCAD_LIBRARIES eigen2
+# 4. system's standard include paths for eigen3
+# 5. system's standard include paths for eigen2
-# Eigen3
+set(EIGEN3_DIR "$ENV{EIGEN3DIR}")
+set(EIGEN2_DIR "$ENV{EIGEN2DIR}")
+set(OPENSCAD_LIBDIR "$ENV{OPENSCAD_LIBRARIES}")
-if (NOT $ENV{EIGEN3DIR} STREQUAL "")
- set(EIGEN3_DIR "$ENV{EIGEN3DIR}")
-elseif (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "")
- set(EIGEN3_DIR "$ENV{OPENSCAD_LIBRARIES}")
+if (EIGEN3_DIR)
+ find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS "${EIGEN3_DIR}/include/eigen3" "${EIGEN3_DIR}")
+endif()
+if (EIGEN2_DIR)
+ find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS "${EIGEN2_DIR}/include/eigen2" "${EIGEN2_DIR}")
endif()
-if (NOT EIGEN3_INCLUDE_DIR)
- if (EIGEN3_DIR)
- set(EIGEN3_FIND_HINTS "${EIGEN3_DIR}/include/eigen3")
- endif()
+if (NOT EIGEN_INCLUDE_DIR)
+ find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS ${OPENSCAD_LIBDIR}/include/eigen3)
+endif()
+if (NOT EIGEN_INCLUDE_DIR)
+ find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS ${OPENSCAD_LIBDIR}/include/eigen2)
+endif()
+
+if (NOT EIGEN_INCLUDE_DIR)
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
- set(EIGEN3_FIND_PATHS /usr/local/include/eigen3)
+ find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS /usr/local/include/eigen3)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
- set(EIGEN3_FIND_PATHS /usr/pkg/include/eigen3)
- else()
- set(EIGEN3_FIND_PATHS /opt/local/include/eigen3 /usr/include/eigen3)
- endif()
- find_path(EIGEN3_INCLUDE_DIR
- Eigen/Core
- HINTS ${EIGEN3_FIND_HINTS}
- PATHS ${EIGEN3_FIND_PATHS})
- if (NOT EIGEN3_INCLUDE_DIR)
- message(STATUS "Eigen3 not found, will attempt to find Eigen2")
+ find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS /usr/pkg/include/eigen3)
+ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS /opt/local/include/eigen3)
else()
- message(STATUS "Eigen3 found in " ${EIGEN3_INCLUDE_DIR})
- inclusion(EIGEN3_DIR EIGEN3_INCLUDE_DIR)
+ find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS /usr/include/eigen3)
endif()
endif()
-
-# Eigen2
-
-if (NOT EIGEN3_INCLUDE_DIR)
-
-if (NOT $ENV{EIGEN2DIR} STREQUAL "")
- set(EIGEN2_DIR "$ENV{EIGEN2DIR}")
-elseif (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "")
- set(EIGEN2_DIR "$ENV{OPENSCAD_LIBRARIES}")
-endif()
-
-if (NOT EIGEN2_INCLUDE_DIR)
- if (EIGEN2_DIR)
- set(EIGEN2_FIND_HINTS "${EIGEN2_DIR}/include/eigen2")
- endif()
+if (NOT EIGEN_INCLUDE_DIR)
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
- set(EIGEN2_FIND_PATHS /usr/local/include/eigen2)
+ find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS /usr/local/include/eigen2)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
- set(EIGEN2_FIND_PATHS /usr/pkg/include/eigen2)
+ find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS /usr/pkg/include/eigen2)
+ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS /opt/local/include/eigen2)
else()
- set(EIGEN2_FIND_PATHS /opt/local/include/eigen2 /usr/include/eigen2)
- endif()
- find_path(EIGEN2_INCLUDE_DIR
- Eigen/Core
- HINTS ${EIGEN2_FIND_HINTS}
- PATHS ${EIGEN2_FIND_PATHS})
- if (NOT EIGEN2_INCLUDE_DIR)
- message(FATAL_ERROR "Eigen2 not found")
- else()
- message(STATUS "Eigen2 found in " ${EIGEN2_INCLUDE_DIR})
+ find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS /usr/include/eigen2)
endif()
endif()
-inclusion(EIGEN2_DIR EIGEN2_INCLUDE_DIR)
-endif() # if (NOT EIGEN3_INCLUDE_DIR)
+if (NOT EIGEN_INCLUDE_DIR)
+ message(STATUS "Eigen not found")
+else()
+ message(STATUS "Eigen found in " ${EIGEN_INCLUDE_DIR})
+ inclusion(EIGEN_DIR EIGEN_INCLUDE_DIR)
+endif()
+
# OpenCSG
if (NOT $ENV{OPENCSGDIR} STREQUAL "")

0 comments on commit a904531

Please sign in to comment.
Something went wrong with that request. Please try again.