From 9f6819e68501de16563aeaaadd65dfc915092169 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 18 Aug 2012 22:28:36 +0200 Subject: initial rework to enable eigen3 per issue #174. 1. enable eigen3 in qmake build system 2. convert Transform3d and cwise() per the eigen2->eigen3 porting faq online 3. get rid of 'using namespace boost::filesystem' as it conflicts with eigen3 diff --git a/common.pri b/common.pri index d6e8480..9e3555f 100644 --- a/common.pri +++ b/common.pri @@ -9,5 +9,8 @@ include(bison.pri) include(cgal.pri) include(opencsg.pri) include(glew.pri) -include(eigen2.pri) include(boost.pri) + +CONFIG(eigen2) { include(eigen2.pri) } +CONFIG(eigen3) { include(eigen3.pri) } + diff --git a/eigen2.pri b/eigen2.pri index 0bda55b..701f92a 100644 --- a/eigen2.pri +++ b/eigen2.pri @@ -1,5 +1,5 @@ eigen2 { - +message("hi 2") CONFIG(mingw-cross-env) { EIGEN2_INCLUDEPATH = mingw-cross-env/include/eigen2 } diff --git a/eigen3.pri b/eigen3.pri new file mode 100644 index 0000000..20d85fc --- /dev/null +++ b/eigen3.pri @@ -0,0 +1,43 @@ +eigen3 { + CONFIG(mingw-cross-env) { + EIGEN3_INCLUDEPATH = mingw-cross-env/include/eigen3 + } + + # Optionally specify location of Eigen3 using the + # OPENSCAD_LIBRARIES env. variable + isEmpty(EIGEN3_INCLUDEPATH) { + OPENSCAD_LIBRARIES_DIR = $$(OPENSCAD_LIBRARIES) + !isEmpty(OPENSCAD_LIBRARIES_DIR) { + exists($$OPENSCAD_LIBRARIES_DIR/include/eigen3) { + EIGEN3_INCLUDEPATH = $$OPENSCAD_LIBRARIES_DIR/include/eigen3 + } + } + } + + # Optionally specify location of Eigen3 using the + # EIGEN3DIR env. variable + isEmpty(EIGEN3_INCLUDEPATH) { + EIGEN3_DIR = $$(EIGEN3DIR) + !isEmpty(EIGEN3_DIR) { + EIGEN3_INCLUDEPATH = $$EIGEN3_DIR + message("EIGEN3 location: $$EIGEN3_INCLUDEPATH") + } + } + + isEmpty(EIGEN3_INCLUDEPATH) { + freebsd-g++: EIGEN3_INCLUDEPATH = /usr/local/include/eigen3 + macx: EIGEN3_INCLUDEPATH = /opt/local/include/eigen3 + linux*|hurd*: EIGEN3_INCLUDEPATH = /usr/include/eigen3 + netbsd*: EIGEN3_INCLUDEPATH = /usr/pkg/include/eigen3 + } + + # EIGEN3 being under 'include/eigen3' needs special prepending + QMAKE_INCDIR_QT = $$EIGEN3_INCLUDEPATH $$QMAKE_INCDIR_QT + + # disable Eigen SIMD optimizations for platforms where it breaks compilation + !macx { + !freebsd-g++ { + QMAKE_CXXFLAGS += -DEIGEN_DONT_ALIGN + } + } +} diff --git a/openscad.pro b/openscad.pro index f11a494..a76383c 100644 --- a/openscad.pro +++ b/openscad.pro @@ -4,6 +4,7 @@ # BOOSTDIR # CGALDIR # EIGEN2DIR +# EIGEN3DIR # GLEWDIR # OPENCSGDIR # OPENSCAD_LIBRARIES @@ -123,7 +124,12 @@ macx:CONFIG += mdi CONFIG += cgal CONFIG += opencsg CONFIG += boost -CONFIG += eigen2 +#macx { +unix { + CONFIG += eigen3 +} else { + CONFIG += eigen2 +} #Uncomment the following line to enable QCodeEdit #CONFIG += qcodeedit diff --git a/scripts/linux-build-dependencies.sh b/scripts/linux-build-dependencies.sh index aee423c..6f31d5d 100755 --- a/scripts/linux-build-dependencies.sh +++ b/scripts/linux-build-dependencies.sh @@ -248,6 +248,7 @@ build_eigen() rm -rf eigen-$version ## Directory name for v2.0.17 rm -rf eigen-eigen-b23437e61a07 + rm -rf eigen-eigen-43d9075b23ef # 3.1.1 if [ ! -f eigen-$version.tar.bz2 ]; then curl -LO http://bitbucket.org/eigen/eigen/get/$version.tar.bz2 mv $version.tar.bz2 eigen-$version.tar.bz2 @@ -255,13 +256,15 @@ build_eigen() tar xjf eigen-$version.tar.bz2 ## File name for v2.0.17 ln -s eigen-eigen-b23437e61a07 eigen-$version + ln -s eigen-eigen-43d9075b23ef eigen-$version # 3.1.1 cd eigen-$version - cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR + mkdir build + cd build + cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR .. make -j$NUMCPU make install } - OPENSCADDIR=$PWD if [ ! -f $OPENSCADDIR/openscad.pro ]; then echo "Must be run from the OpenSCAD source root directory" @@ -321,12 +324,13 @@ fi # build_eigen 2.0.17 -build_gmp 5.0.5 -build_mpfr 3.1.1 -build_boost 1.47.0 +#build_eigen 3.1.1 +#build_gmp 5.0.5 +#build_mpfr 3.1.1 +#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 -build_opencsg 1.3.2 +#build_cgal 4.0.2 +#build_glew 1.7.0 +#build_opencsg 1.3.2 echo "OpenSCAD dependencies built and installed to " $BASEDIR diff --git a/src/csgterm.cc b/src/csgterm.cc index 0e68320..aed97b2 100644 --- a/src/csgterm.cc +++ b/src/csgterm.cc @@ -66,16 +66,29 @@ shared_ptr CSGTerm::createCSGTerm(type_e type, shared_ptr left // http://www.cc.gatech.edu/~turk/my_papers/pxpl_csg.pdf const BoundingBox &leftbox = left->getBoundingBox(); const BoundingBox &rightbox = right->getBoundingBox(); + Vector3d newmin, newmax; if (type == TYPE_INTERSECTION) { - BoundingBox newbox(leftbox.min().cwise().max(rightbox.min()), - leftbox.max().cwise().min(rightbox.max())); +#if EIGEN_WORLD_VERSION == 2 + newmin = leftbox.min().cwise().max( rightbox.min() ); + newmax = leftbox.max().cwise().min( rightbox.max() ); +#else + newmin = leftbox.min().array().cwiseMax( rightbox.min().array() ); + newmax = leftbox.max().array().cwiseMin( rightbox.max().array() ); +#endif + BoundingBox newbox( newmin, newmax ); if (newbox.isNull()) { return shared_ptr(); // Prune entire product } } else if (type == TYPE_DIFFERENCE) { - BoundingBox newbox(leftbox.min().cwise().max(rightbox.min()), - leftbox.max().cwise().min(rightbox.max())); +#if EIGEN_WORLD_VERSION == 2 + newmin = leftbox.min().cwise().max( rightbox.min() ); + newmax = leftbox.max().cwise().min( rightbox.max() ); +#else + newmin = leftbox.min().array().cwiseMax( rightbox.min().array() ); + newmax = leftbox.max().array().cwiseMin( rightbox.max().array() ); +#endif + BoundingBox newbox( newmin, newmax ); if (newbox.isNull()) { return left; // Prune the negative component } @@ -119,14 +132,27 @@ void CSGTerm::initBoundingBox() else { const BoundingBox &leftbox = this->left->getBoundingBox(); const BoundingBox &rightbox = this->right->getBoundingBox(); + Vector3d newmin, newmax; switch (this->type) { case TYPE_UNION: - this->bbox = this->m * BoundingBox(leftbox.min().cwise().min(rightbox.min()), - leftbox.max().cwise().max(rightbox.max())); +#if EIGEN_WORLD_VERSION == 2 + newmin = leftbox.min().cwise().min( rightbox.min() ); + newmax = leftbox.max().cwise().max( rightbox.max() ); +#else + newmin = leftbox.min().array().cwiseMin( rightbox.min().array() ); + newmax = leftbox.max().array().cwiseMax( rightbox.max().array() ); +#endif + this->bbox = this->m * BoundingBox( newmin, newmax ); break; case TYPE_INTERSECTION: - this->bbox = this->m * BoundingBox(leftbox.min().cwise().max(rightbox.min()), - leftbox.max().cwise().min(rightbox.max())); +#if EIGEN_WORLD_VERSION == 2 + newmin = leftbox.min().cwise().max( rightbox.min() ); + newmax = leftbox.max().cwise().min( rightbox.max() ); +#else + newmin = leftbox.min().array().cwiseMax( rightbox.min().array() ); + newmax = leftbox.max().array().cwiseMin( rightbox.max().array() ); +#endif + this->bbox = this->m * BoundingBox( newmin, newmax ); break; case TYPE_DIFFERENCE: this->bbox = this->m * leftbox; diff --git a/src/dxfdata.h b/src/dxfdata.h index 64853dc..80a23f6 100644 --- a/src/dxfdata.h +++ b/src/dxfdata.h @@ -30,6 +30,8 @@ public: #ifdef __APPLE__ std::vector > points; +#elif EIGEN_WORLD_VERSION == 3 + std::vector > points; #else std::vector points; #endif diff --git a/src/dxfdim.cc b/src/dxfdim.cc index 8f68ac6..4af3526 100644 --- a/src/dxfdim.cc +++ b/src/dxfdim.cc @@ -36,10 +36,10 @@ #include #include -using namespace boost::filesystem; boost::unordered_map dxf_dim_cache; boost::unordered_map dxf_cross_cache; +namespace fs = boost::filesystem; Value builtin_dxf_dim(const Context *ctx, const std::vector &argnames, const std::vector &args) { @@ -65,13 +65,14 @@ Value builtin_dxf_dim(const Context *ctx, const std::vector &argnam std::stringstream keystream; keystream << filename << "|" << layername << "|" << name << "|" << xorigin - << "|" << yorigin <<"|" << scale << "|" << last_write_time(filename) - << "|" << file_size(filename); + << "|" << yorigin <<"|" << scale << "|" << fs::last_write_time(filename) + << "|" << fs::file_size(filename); std::string key = keystream.str(); if (dxf_dim_cache.find(key) != dxf_dim_cache.end()) return dxf_dim_cache.find(key)->second; DxfData dxf(36, 0, 0, filename, layername, xorigin, yorigin, scale); +/* for (size_t i = 0; i < dxf.dims.size(); i++) { @@ -123,12 +124,13 @@ Value builtin_dxf_dim(const Context *ctx, const std::vector &argnam PRINTB("WARNING: Can't find dimension '%s' in '%s', layer '%s'!", name % filename % layername); +*/ return Value(); } Value builtin_dxf_cross(const Context *ctx, const std::vector &argnames, const std::vector &args) { - std::string filename; +/* std::string filename; std::string layername; double xorigin = 0; double yorigin = 0; @@ -186,7 +188,7 @@ Value builtin_dxf_cross(const Context *ctx, const std::vector &argn } PRINTB("WARNING: Can't find cross in '%s', layer '%s'!", filename % layername); - +*/ return Value(); } diff --git a/src/import.cc b/src/import.cc index dc40c8d..2f08b11 100644 --- a/src/import.cc +++ b/src/import.cc @@ -47,7 +47,7 @@ #include #include #include -using namespace boost::filesystem; +namespace fs = boost::filesystem; #include using namespace boost::assign; // bring 'operator+=()' into scope #include "boosty.h" diff --git a/src/linalg.h b/src/linalg.h index 65243dc..eb3d22d 100644 --- a/src/linalg.h +++ b/src/linalg.h @@ -12,7 +12,11 @@ typedef Eigen::AlignedBox BoundingBox; using Eigen::Matrix3f; using Eigen::Matrix3d; using Eigen::Matrix4d; -using Eigen::Transform3d; +#if EIGEN_WORLD_VERSION>=3 +#define Transform3d Eigen::Affine3d +#else +using Eigen::Transform3d +#endif BoundingBox operator*(const Transform3d &m, const BoundingBox &box); -- cgit v0.10.1 From 10c7607541e502f2d0ff7c2c49fd70809704c039 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 18 Aug 2012 22:44:46 +0200 Subject: more eigen3 fixes. 1. finish converting 'using namespace boost::filsystem' to 'namespace fs = boost::filesystem'. 2. initial version of changes to CMakelists.txt for the regression test diff --git a/src/dxfdim.cc b/src/dxfdim.cc index 4af3526..dfe8c13 100644 --- a/src/dxfdim.cc +++ b/src/dxfdim.cc @@ -72,7 +72,6 @@ Value builtin_dxf_dim(const Context *ctx, const std::vector &argnam return dxf_dim_cache.find(key)->second; DxfData dxf(36, 0, 0, filename, layername, xorigin, yorigin, scale); -/* for (size_t i = 0; i < dxf.dims.size(); i++) { @@ -124,13 +123,12 @@ Value builtin_dxf_dim(const Context *ctx, const std::vector &argnam PRINTB("WARNING: Can't find dimension '%s' in '%s', layer '%s'!", name % filename % layername); -*/ return Value(); } Value builtin_dxf_cross(const Context *ctx, const std::vector &argnames, const std::vector &args) { -/* std::string filename; + std::string filename; std::string layername; double xorigin = 0; double yorigin = 0; @@ -149,8 +147,8 @@ Value builtin_dxf_cross(const Context *ctx, const std::vector &argn std::stringstream keystream; keystream << filename << "|" << layername << "|" << xorigin << "|" << yorigin - << "|" << scale << "|" << last_write_time(filename) - << "|" << file_size(filename); + << "|" << scale << "|" << fs::last_write_time(filename) + << "|" << fs::file_size(filename); std::string key = keystream.str(); if (dxf_cross_cache.find(key) != dxf_cross_cache.end()) @@ -188,7 +186,6 @@ Value builtin_dxf_cross(const Context *ctx, const std::vector &argn } PRINTB("WARNING: Can't find cross in '%s', layer '%s'!", filename % layername); -*/ return Value(); } diff --git a/src/handle_dep.cc b/src/handle_dep.cc index cbf7157..2d6f3ff 100644 --- a/src/handle_dep.cc +++ b/src/handle_dep.cc @@ -6,7 +6,7 @@ #include #include #include -using namespace boost::filesystem; +namespace fs = boost::filesystem; #include "boosty.h" boost::unordered_set dependencies; @@ -14,14 +14,14 @@ const char *make_command = NULL; void handle_dep(const std::string &filename) { - path filepath(filename); + fs::path filepath(filename); if ( boosty::is_absolute( filepath )) { dependencies.insert(filename); } else { - dependencies.insert((current_path() / filepath).string()); + dependencies.insert((fs::current_path() / filepath).string()); } - if (!exists(filepath) && make_command) { + if (!fs::exists(filepath) && make_command) { std::stringstream buf; buf << make_command << " '" << boost::regex_replace(filename, boost::regex("'"), "'\\''") << "'"; system(buf.str().c_str()); // FIXME: Handle error diff --git a/src/import.cc b/src/import.cc index 2f08b11..1073459 100644 --- a/src/import.cc +++ b/src/import.cc @@ -80,7 +80,7 @@ AbstractNode *ImportModule::evaluate(const Context *ctx, const ModuleInstantiati std::string filename = c.getAbsolutePath(v.isUndefined() ? "" : v.toString()); import_type_e actualtype = this->type; if (actualtype == TYPE_UNKNOWN) { - std::string extraw = boosty::extension_str( path(filename) ); + std::string extraw = boosty::extension_str( fs::path(filename) ); std::string ext = boost::algorithm::to_lower_copy( extraw ); if (ext == ".stl") actualtype = TYPE_STL; else if (ext == ".off") actualtype = TYPE_OFF; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5ec8be7..db9433f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -157,8 +157,18 @@ endif() set(CMAKE_INCLUDE_DIRECTORIES_BEFORE OFF) + +# Eigen + +set( EIGEN_VERSION 3 ) +if( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" ) + set( EIGEN_VERSION 3 ) +endif() + # Eigen2 +if( ${EIGEN_VERSION} EQUAL 2) + # Turn off Eigen SIMD optimization if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") @@ -195,6 +205,45 @@ if (NOT EIGEN2_INCLUDE_DIR) endif() inclusion(EIGEN2_DIR EIGEN2_INCLUDE_DIR) +endif() # EIGEN_VERSION 2 + + +# Eigen3 + +if( ${EIGEN_VERSION} EQUAL 3) + +if (NOT $ENV{EIGEN3DIR} STREQUAL "") + set(EIGEN3_DIR "$ENV{EIGEN3DIR}") +elseif (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "") + set(EIGEN3_DIR "$ENV{OPENSCAD_LIBRARIES}") +endif() + +if (NOT EIGEN3_INCLUDE_DIR) + if (EIGEN3_DIR) + set(EIGEN3_FIND_HINTS "${EIGEN3_DIR}/include/eigen3") + endif() + if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") + set(EIGEN3_FIND_PATHS /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(FATAL_ERROR "Eigen3 not found") + else() + message(STATUS "Eigen3 found in " ${EIGEN3_INCLUDE_DIR}) + endif() +endif() +inclusion(EIGEN3_DIR EIGEN3_INCLUDE_DIR) + +endif() # EIGEN_VERSION 3 + + # OpenCSG if (NOT $ENV{OPENCSGDIR} STREQUAL "") set(OPENCSG_DIR "$ENV{OPENCSGDIR}") -- cgit v0.10.1 From c4d68588a6f2f39ab60055a56fbc59b87ecee2e2 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 19 Aug 2012 00:14:17 +0200 Subject: modify build system to auto-detect eigen3, and fallback to eigen2 diff --git a/common.pri b/common.pri index 9e3555f..d852885 100644 --- a/common.pri +++ b/common.pri @@ -10,7 +10,5 @@ include(cgal.pri) include(opencsg.pri) include(glew.pri) include(boost.pri) - -CONFIG(eigen2) { include(eigen2.pri) } -CONFIG(eigen3) { include(eigen3.pri) } +include(eigen.pri) diff --git a/eigen.pri b/eigen.pri new file mode 100644 index 0000000..4d9ab90 --- /dev/null +++ b/eigen.pri @@ -0,0 +1,75 @@ +# Detect eigen3 + eigen2, then use this priority list to determine +# which eigen to use: +# +# 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 + +eigen { + +# read environment variables +OPENSCAD_LIBRARIES_DIR = $$(OPENSCAD_LIBRARIES) +EIGEN2_DIR = $$(EIGEN2DIR) +EIGEN3_DIR = $$(EIGEN3DIR) + +CONFIG(mingw-cross-env) { + EIGEN_INCLUDEPATH = mingw-cross-env/include/eigen2 +} + +# Optionally specify location of Eigen3 using the +# OPENSCAD_LIBRARIES env. variable +!isEmpty(OPENSCAD_LIBRARIES_DIR) { + isEmpty(EIGEN_INCLUDEPATH) { + exists($$OPENSCAD_LIBRARIES_DIR/include/eigen3) { + EIGEN_INCLUDEPATH = $$OPENSCAD_LIBRARIES_DIR/include/eigen3 + } + } + isEmpty(EIGEN_INCLUDEPATH) { + exists($$OPENSCAD_LIBRARIES_DIR/include/eigen2) { + EIGEN_INCLUDEPATH = $$OPENSCAD_LIBRARIES_DIR/include/eigen2 + } + } +} + + +# Optionally specify location of Eigen using the +# EIGEN3DIR env. variable +!isEmpty(EIGEN3_DIR) { + EIGEN_INCLUDEPATH = $$EIGEN3_DIR + message("EIGEN3 location: $$EIGEN3_INCLUDEPATH") +} + +# Optionally specify location of Eigen using the +# EIGEN2DIR env. variable +!isEmpty(EIGEN2_DIR) { + EIGEN_INCLUDEPATH = $$EIGEN2_DIR + message("EIGEN2 location: $$EIGEN2_INCLUDEPATH") +} + +isEmpty(EIGEN_INCLUDEPATH) { + freebsd-g++: EIGEN_INCLUDEPATH = /usr/local/include/eigen3 + macx: EIGEN_INCLUDEPATH = /opt/local/include/eigen3 + linux*|hurd*: EIGEN_INCLUDEPATH = /usr/include/eigen3 + netbsd*: EIGEN_INCLUDEPATH = /usr/pkg/include/eigen3 + !exists($$EIGEN_INCLUDEPATH) { + freebsd-g++: EIGEN_INCLUDEPATH = /usr/local/include/eigen2 + macx: EIGEN_INCLUDEPATH = /opt/local/include/eigen2 + linux*|hurd*: EIGEN_INCLUDEPATH = /usr/include/eigen2 + netbsd*: EIGEN_INCLUDEPATH = /usr/pkg/include/eigen2 + } +} + +# disable Eigen SIMD optimizations for platforms where it breaks compilation +!macx { + !freebsd-g++ { + QMAKE_CXXFLAGS += -DEIGEN_DONT_ALIGN + } +} + +# EIGEN being under 'include/eigen[2-3]' needs special prepending +QMAKE_INCDIR_QT = $$EIGEN_INCLUDEPATH $$QMAKE_INCDIR_QT + +} # eigen diff --git a/eigen2.pri b/eigen2.pri deleted file mode 100644 index 701f92a..0000000 --- a/eigen2.pri +++ /dev/null @@ -1,44 +0,0 @@ -eigen2 { -message("hi 2") - CONFIG(mingw-cross-env) { - EIGEN2_INCLUDEPATH = mingw-cross-env/include/eigen2 - } - - # Optionally specify location of Eigen2 using the - # OPENSCAD_LIBRARIES env. variable - isEmpty(EIGEN2_INCLUDEPATH) { - OPENSCAD_LIBRARIES_DIR = $$(OPENSCAD_LIBRARIES) - !isEmpty(OPENSCAD_LIBRARIES_DIR) { - exists($$OPENSCAD_LIBRARIES_DIR/include/eigen2) { - EIGEN2_INCLUDEPATH = $$OPENSCAD_LIBRARIES_DIR/include/eigen2 - } - } - } - - # Optionally specify location of Eigen2 using the - # EIGEN2DIR env. variable - isEmpty(EIGEN2_INCLUDEPATH) { - EIGEN2_DIR = $$(EIGEN2DIR) - !isEmpty(EIGEN2_DIR) { - EIGEN2_INCLUDEPATH = $$EIGEN2_DIR - message("EIGEN2 location: $$EIGEN2_INCLUDEPATH") - } - } - - isEmpty(EIGEN2_INCLUDEPATH) { - freebsd-g++: EIGEN2_INCLUDEPATH = /usr/local/include/eigen2 - macx: EIGEN2_INCLUDEPATH = /opt/local/include/eigen2 - linux*|hurd*: EIGEN2_INCLUDEPATH = /usr/include/eigen2 - netbsd*: EIGEN2_INCLUDEPATH = /usr/pkg/include/eigen2 - } - - # eigen2 being under 'include/eigen2' needs special prepending - QMAKE_INCDIR_QT = $$EIGEN2_INCLUDEPATH $$QMAKE_INCDIR_QT - - # disable Eigen SIMD optimizations for platforms where it breaks compilation - !macx { - !freebsd-g++ { - QMAKE_CXXFLAGS += -DEIGEN_DONT_ALIGN - } - } -} diff --git a/eigen3.pri b/eigen3.pri deleted file mode 100644 index 20d85fc..0000000 --- a/eigen3.pri +++ /dev/null @@ -1,43 +0,0 @@ -eigen3 { - CONFIG(mingw-cross-env) { - EIGEN3_INCLUDEPATH = mingw-cross-env/include/eigen3 - } - - # Optionally specify location of Eigen3 using the - # OPENSCAD_LIBRARIES env. variable - isEmpty(EIGEN3_INCLUDEPATH) { - OPENSCAD_LIBRARIES_DIR = $$(OPENSCAD_LIBRARIES) - !isEmpty(OPENSCAD_LIBRARIES_DIR) { - exists($$OPENSCAD_LIBRARIES_DIR/include/eigen3) { - EIGEN3_INCLUDEPATH = $$OPENSCAD_LIBRARIES_DIR/include/eigen3 - } - } - } - - # Optionally specify location of Eigen3 using the - # EIGEN3DIR env. variable - isEmpty(EIGEN3_INCLUDEPATH) { - EIGEN3_DIR = $$(EIGEN3DIR) - !isEmpty(EIGEN3_DIR) { - EIGEN3_INCLUDEPATH = $$EIGEN3_DIR - message("EIGEN3 location: $$EIGEN3_INCLUDEPATH") - } - } - - isEmpty(EIGEN3_INCLUDEPATH) { - freebsd-g++: EIGEN3_INCLUDEPATH = /usr/local/include/eigen3 - macx: EIGEN3_INCLUDEPATH = /opt/local/include/eigen3 - linux*|hurd*: EIGEN3_INCLUDEPATH = /usr/include/eigen3 - netbsd*: EIGEN3_INCLUDEPATH = /usr/pkg/include/eigen3 - } - - # EIGEN3 being under 'include/eigen3' needs special prepending - QMAKE_INCDIR_QT = $$EIGEN3_INCLUDEPATH $$QMAKE_INCDIR_QT - - # disable Eigen SIMD optimizations for platforms where it breaks compilation - !macx { - !freebsd-g++ { - QMAKE_CXXFLAGS += -DEIGEN_DONT_ALIGN - } - } -} diff --git a/openscad.pro b/openscad.pro index a76383c..6532c79 100644 --- a/openscad.pro +++ b/openscad.pro @@ -124,12 +124,7 @@ macx:CONFIG += mdi CONFIG += cgal CONFIG += opencsg CONFIG += boost -#macx { -unix { - CONFIG += eigen3 -} else { - CONFIG += eigen2 -} +CONFIG += eigen #Uncomment the following line to enable QCodeEdit #CONFIG += qcodeedit diff --git a/scripts/linux-build-dependencies.sh b/scripts/linux-build-dependencies.sh index 6f31d5d..01e08be 100755 --- a/scripts/linux-build-dependencies.sh +++ b/scripts/linux-build-dependencies.sh @@ -246,17 +246,20 @@ build_eigen() echo "Building eigen" $version "..." cd $BASEDIR/src rm -rf eigen-$version - ## Directory name for v2.0.17 - rm -rf eigen-eigen-b23437e61a07 - rm -rf eigen-eigen-43d9075b23ef # 3.1.1 + EIGENDIR="none" + if [ $version = "2.0.17" ]; then EIGENDIR=eigen-eigen-b23437e61a07; fi + if [ $version = "3.1.1" ]; then EIGENDIR=eigen-eigen-43d9075b23ef; fi + if [ $EIGENDIR = "none" ]; then + echo Unknown eigen version. Please edit script. + exit 1 + fi + rm -rf ./$EIGENDIR if [ ! -f eigen-$version.tar.bz2 ]; then curl -LO http://bitbucket.org/eigen/eigen/get/$version.tar.bz2 mv $version.tar.bz2 eigen-$version.tar.bz2 fi tar xjf eigen-$version.tar.bz2 - ## File name for v2.0.17 - ln -s eigen-eigen-b23437e61a07 eigen-$version - ln -s eigen-eigen-43d9075b23ef eigen-$version # 3.1.1 + ln -s ./$EIGENDIR eigen-$version cd eigen-$version mkdir build cd build @@ -323,8 +326,8 @@ fi # edit version numbers here as needed. # -build_eigen 2.0.17 -#build_eigen 3.1.1 +#build_eigen 2.0.17 +build_eigen 3.1.1 #build_gmp 5.0.5 #build_mpfr 3.1.1 #build_boost 1.47.0 diff --git a/src/linalg.h b/src/linalg.h index eb3d22d..7f12a2e 100644 --- a/src/linalg.h +++ b/src/linalg.h @@ -12,10 +12,10 @@ typedef Eigen::AlignedBox BoundingBox; using Eigen::Matrix3f; using Eigen::Matrix3d; using Eigen::Matrix4d; -#if EIGEN_WORLD_VERSION>=3 +#if EIGEN_WORLD_VERSION >= 3 #define Transform3d Eigen::Affine3d #else -using Eigen::Transform3d +using Eigen::Transform3d; #endif BoundingBox operator*(const Transform3d &m, const BoundingBox &box); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index db9433f..7df8885 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -159,15 +159,43 @@ set(CMAKE_INCLUDE_DIRECTORIES_BEFORE OFF) # Eigen +# First try to find Eigen3. If it's not there, fallback to Eigen2 -set( EIGEN_VERSION 3 ) -if( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" ) - set( EIGEN_VERSION 3 ) +# Eigen3 + +if (NOT $ENV{EIGEN3DIR} STREQUAL "") + set(EIGEN3_DIR "$ENV{EIGEN3DIR}") +elseif (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "") + set(EIGEN3_DIR "$ENV{OPENSCAD_LIBRARIES}") endif() +if (NOT EIGEN3_INCLUDE_DIR) + if (EIGEN3_DIR) + set(EIGEN3_FIND_HINTS "${EIGEN3_DIR}/include/eigen3") + endif() + if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") + set(EIGEN3_FIND_PATHS /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") + else() + message(STATUS "Eigen3 found in " ${EIGEN3_INCLUDE_DIR}) + inclusion(EIGEN3_DIR EIGEN3_INCLUDE_DIR) + endif() +endif() + + # Eigen2 -if( ${EIGEN_VERSION} EQUAL 2) +if (NOT EIGEN3_INCLUDE_DIR) # Turn off Eigen SIMD optimization if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") @@ -205,44 +233,7 @@ if (NOT EIGEN2_INCLUDE_DIR) endif() inclusion(EIGEN2_DIR EIGEN2_INCLUDE_DIR) -endif() # EIGEN_VERSION 2 - - -# Eigen3 - -if( ${EIGEN_VERSION} EQUAL 3) - -if (NOT $ENV{EIGEN3DIR} STREQUAL "") - set(EIGEN3_DIR "$ENV{EIGEN3DIR}") -elseif (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "") - set(EIGEN3_DIR "$ENV{OPENSCAD_LIBRARIES}") -endif() - -if (NOT EIGEN3_INCLUDE_DIR) - if (EIGEN3_DIR) - set(EIGEN3_FIND_HINTS "${EIGEN3_DIR}/include/eigen3") - endif() - if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") - set(EIGEN3_FIND_PATHS /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(FATAL_ERROR "Eigen3 not found") - else() - message(STATUS "Eigen3 found in " ${EIGEN3_INCLUDE_DIR}) - endif() -endif() -inclusion(EIGEN3_DIR EIGEN3_INCLUDE_DIR) - -endif() # EIGEN_VERSION 3 - +endif() # if (NOT EIGEN3_INCLUDE_DIR) # OpenCSG if (NOT $ENV{OPENCSGDIR} STREQUAL "") -- cgit v0.10.1 From 1e0ce9e46b9b17344f1b3e6cce3aed44d93885cd Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 19 Aug 2012 00:19:25 +0200 Subject: alter Mac OSX dependencies build script to get eigen version 3.1.1 This still allows the building of eigen, 2.0.17 just change the version number at the bottom of the file. Eigen3 requires an 'out of source' build. diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh index f7b6b18..f009fce 100755 --- a/scripts/macosx-build-dependencies.sh +++ b/scripts/macosx-build-dependencies.sh @@ -265,20 +265,29 @@ build_eigen() echo "Building eigen" $version "..." cd $BASEDIR/src rm -rf eigen-$version - ## Directory name for v2.0.17 - rm -rf eigen-eigen-b23437e61a07 + + EIGENDIR="none" + if [ $version = "2.0.17" ]; then EIGENDIR=eigen-eigen-b23437e61a07; fi + if [ $version = "3.1.1" ]; then EIGENDIR=eigen-eigen-43d9075b23ef; fi + if [ $EIGENDIR = "none" ]; then + echo Unknown eigen version. Please edit script. + exit 1 + fi + rm -rf ./$EIGENDIR + if [ ! -f eigen-$version.tar.bz2 ]; then curl -LO http://bitbucket.org/eigen/eigen/get/$version.tar.bz2 mv $version.tar.bz2 eigen-$version.tar.bz2 fi tar xjf eigen-$version.tar.bz2 - ## File name for v2.0.17 - ln -s eigen-eigen-b23437e61a07 eigen-$version + ln -s ./$EIGENDIR eigen-$version cd eigen-$version + mkdir build + cd build if $OPTION_32BIT; then EIGEN_EXTRA_FLAGS=";i386" fi - cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DEIGEN_BUILD_LIB=ON -DBUILD_SHARED_LIBS=FALSE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="x86_64$EIGEN_EXTRA_FLAGS" + cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DEIGEN_BUILD_LIB=ON -DBUILD_SHARED_LIBS=FALSE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="x86_64$EIGEN_EXTRA_FLAGS" .. make -j4 make install } @@ -297,7 +306,7 @@ done echo "Using basedir:" $BASEDIR mkdir -p $SRCDIR $DEPLOYDIR -build_eigen 2.0.17 +build_eigen 3.1.1 build_gmp 5.0.5 build_mpfr 3.1.0 build_boost 1.47.0 -- cgit v0.10.1 From 526ed73ec20c222ab64824c95eae36da3bbf2e57 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 18 Aug 2012 17:30:47 -0500 Subject: restore commented-out build commands diff --git a/scripts/linux-build-dependencies.sh b/scripts/linux-build-dependencies.sh index 01e08be..8bdba4c 100755 --- a/scripts/linux-build-dependencies.sh +++ b/scripts/linux-build-dependencies.sh @@ -326,14 +326,13 @@ fi # edit version numbers here as needed. # -#build_eigen 2.0.17 build_eigen 3.1.1 -#build_gmp 5.0.5 -#build_mpfr 3.1.1 -#build_boost 1.47.0 +build_gmp 5.0.5 +build_mpfr 3.1.1 +build_boost 1.50.0 # NB! For CGAL, also update the actual download URL in the function -#build_cgal 4.0.2 -#build_glew 1.7.0 -#build_opencsg 1.3.2 +build_cgal 4.0.2 +build_glew 1.7.0 +build_opencsg 1.3.2 echo "OpenSCAD dependencies built and installed to " $BASEDIR -- cgit v0.10.1 From e7ebf47d9b3afe36a1c68619ca6be78fa153aad1 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 18 Aug 2012 17:50:45 -0500 Subject: fix bug in build script for boost diff --git a/scripts/linux-build-dependencies.sh b/scripts/linux-build-dependencies.sh index 8bdba4c..154545f 100755 --- a/scripts/linux-build-dependencies.sh +++ b/scripts/linux-build-dependencies.sh @@ -124,7 +124,7 @@ build_boost() # We only need certain portions of boost ./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,system,regex if [ $CXX ]; then - if [ $CXX = "clang" ]; then + if [ $CXX = "clang++" ]; then ./b2 -j$NUMCPU toolset=clang install # ./b2 -j$NUMCPU toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" install fi @@ -326,9 +326,9 @@ fi # edit version numbers here as needed. # -build_eigen 3.1.1 -build_gmp 5.0.5 -build_mpfr 3.1.1 +#build_eigen 3.1.1 +#build_gmp 5.0.5 +#build_mpfr 3.1.1 build_boost 1.50.0 # NB! For CGAL, also update the actual download URL in the function build_cgal 4.0.2 -- cgit v0.10.1 From 7a2f91e51de625716f4b852f83468c3aa22f0aac Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 18 Aug 2012 21:16:34 -0500 Subject: update eigen version in README. dont use alignment in dxfdata vector. diff --git a/README.md b/README.md index d91da32..1f9fb53 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ Follow the instructions for the platform you're compiling on below. * [boost (1.35 - 1.47)](http://www.boost.org/) * [OpenCSG (1.3.2)](http://www.opencsg.org/) * [GLEW (1.6 ->)](http://glew.sourceforge.net/) -* [Eigen2 (2.0.13->)](http://eigen.tuxfamily.org/) +* [Eigen (2.0.13->3.1.1)](http://eigen.tuxfamily.org/) * [GCC C++ Compiler (4.2 ->)](http://gcc.gnu.org/) * [Bison (2.4)](http://www.gnu.org/software/bison/) * [Flex (2.5.35)](http://flex.sourceforge.net/) diff --git a/src/dxfdata.h b/src/dxfdata.h index 80a23f6..64853dc 100644 --- a/src/dxfdata.h +++ b/src/dxfdata.h @@ -30,8 +30,6 @@ public: #ifdef __APPLE__ std::vector > points; -#elif EIGEN_WORLD_VERSION == 3 - std::vector > points; #else std::vector points; #endif -- cgit v0.10.1 From aa2c67d24925a8b9465d5a908662091b705cf7cc Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 18 Aug 2012 21:35:12 -0500 Subject: make EIGEN_DONT_ALIGN flag work. also remove warnings when using clang. diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7df8885..4942259 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -67,6 +67,17 @@ if(WIN32 AND CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -frounding-math") endif() +# Clang compiler + +if(CMAKE_CXX_COMPILER MATCHES ".*clang.*") + # disable enormous amount of warnings about CGAL + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++11-extensions") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare") +endif() + # # Build test apps # @@ -159,6 +170,14 @@ set(CMAKE_INCLUDE_DIRECTORIES_BEFORE OFF) # Eigen + +# Turn off Eigen SIMD optimization +if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_ALIGN") + endif() +endif() + # First try to find Eigen3. If it's not there, fallback to Eigen2 # Eigen3 @@ -197,13 +216,6 @@ endif() if (NOT EIGEN3_INCLUDE_DIR) -# Turn off Eigen SIMD optimization -if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_ALIGN") - endif() -endif() - if (NOT $ENV{EIGEN2DIR} STREQUAL "") set(EIGEN2_DIR "$ENV{EIGEN2DIR}") elseif (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "") -- cgit v0.10.1 From d656f556b85fb25903d5f18c6a9557d6ed0e6f7d Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 18 Aug 2012 23:02:39 -0500 Subject: debugging failed test: throwntogethertest polygons diff --git a/src/ThrownTogetherRenderer.cc b/src/ThrownTogetherRenderer.cc index 146d2e1..b22c6a5 100644 --- a/src/ThrownTogetherRenderer.cc +++ b/src/ThrownTogetherRenderer.cc @@ -30,7 +30,8 @@ #include "system-gl.h" -#include +//#include +#include ThrownTogetherRenderer::ThrownTogetherRenderer(CSGChain *root_chain, CSGChain *highlights_chain, @@ -62,7 +63,8 @@ void ThrownTogetherRenderer::renderCSGChain(CSGChain *chain, bool highlight, bool fberror) const { glDepthFunc(GL_LEQUAL); - boost::unordered_map,int> polySetVisitMark; + //boost::unordered_map,int> polySetVisitMark; + std::map,int> polySetVisitMark; for (size_t i = 0; i < chain->polysets.size(); i++) { if (polySetVisitMark[std::make_pair(chain->polysets[i].get(), &chain->matrices[i])]++ > 0) continue; diff --git a/src/dxfdata.cc b/src/dxfdata.cc index 4258a4c..080e780 100644 --- a/src/dxfdata.cc +++ b/src/dxfdata.cc @@ -85,7 +85,8 @@ DxfData::DxfData(double fn, double fs, double fa, Grid2d< std::vector > grid(GRID_COARSE); std::vector lines; // Global lines - boost::unordered_map< std::string, std::vector > blockdata; // Lines in blocks + //boost::unordered_map< std::string, std::vector > blockdata; // Lines in blocks + std::map< std::string, std::vector > blockdata; // Lines in blocks bool in_entities_section = false; bool in_blocks_section = false; @@ -123,7 +124,8 @@ DxfData::DxfData(double fn, double fs, double fa, for (int j = 0; j < 2; j++) coords[i][j] = 0; - typedef boost::unordered_map EntityList; + //typedef boost::unordered_map EntityList; + typedef std::map EntityList; EntityList unsupported_entities_list; // diff --git a/src/dxfdim.cc b/src/dxfdim.cc index dfe8c13..6f1b0ab 100644 --- a/src/dxfdim.cc +++ b/src/dxfdim.cc @@ -36,9 +36,11 @@ #include #include - -boost::unordered_map dxf_dim_cache; -boost::unordered_map dxf_cross_cache; +//boost::unordered_map dxf_dim_cache; +//boost::unordered_map dxf_cross_cache; +#include +std::map dxf_dim_cache; +std::map dxf_cross_cache; namespace fs = boost::filesystem; Value builtin_dxf_dim(const Context *ctx, const std::vector &argnames, const std::vector &args) diff --git a/src/dxfdim.h b/src/dxfdim.h index bd42109..5dc0ae0 100644 --- a/src/dxfdim.h +++ b/src/dxfdim.h @@ -1,10 +1,13 @@ #ifndef DXFDIM_H_ #define DXFDIM_H_ -#include +//#include +#include #include "value.h" -extern boost::unordered_map dxf_dim_cache; -extern boost::unordered_map dxf_cross_cache; +//extern boost::unordered_map dxf_dim_cache; +//extern boost::unordered_map dxf_cross_cache; +extern std::map dxf_dim_cache; +extern std::map dxf_cross_cache; #endif diff --git a/src/dxftess-cgal.cc b/src/dxftess-cgal.cc index f221e3a..d19ef61 100644 --- a/src/dxftess-cgal.cc +++ b/src/dxftess-cgal.cc @@ -30,7 +30,8 @@ typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; typedef CDT::Vertex_handle Vertex_handle; typedef CDT::Point CDTPoint; -#include +//#include +#include template class DummyCriteria { public: @@ -71,8 +72,10 @@ struct point_info_t typedef std::pair edge_t; void mark_inner_outer(std::vector &tri, Grid2d &point_info, - boost::unordered_map &edge_to_triangle, - boost::unordered_map &edge_to_path, int idx, bool inner) + std::map &edge_to_triangle, + std::map &edge_to_path, int idx, bool inner) +// boost::unordered_map &edge_to_triangle, +// boost::unordered_map &edge_to_path, int idx, bool inner) { if (tri[idx].is_marked) return; @@ -107,8 +110,10 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool /* do_tr std::vector tri; Grid2d point_info(GRID_FINE); - boost::unordered_map edge_to_triangle; - boost::unordered_map edge_to_path; +// boost::unordered_map edge_to_triangle; +// boost::unordered_map edge_to_path; + std::map edge_to_triangle; + std::map edge_to_path; CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION); try { diff --git a/src/handle_dep.cc b/src/handle_dep.cc index 2d6f3ff..0bebb70 100644 --- a/src/handle_dep.cc +++ b/src/handle_dep.cc @@ -8,8 +8,10 @@ #include namespace fs = boost::filesystem; #include "boosty.h" +#include -boost::unordered_set dependencies; +//boost::unordered_set dependencies; +std::set dependencies; const char *make_command = NULL; void handle_dep(const std::string &filename) diff --git a/src/surface.cc b/src/surface.cc index 2fa3717..eb6561e 100644 --- a/src/surface.cc +++ b/src/surface.cc @@ -42,6 +42,7 @@ #include #include using namespace boost::assign; // bring 'operator+=()' into scope +#include #include namespace fs = boost::filesystem; @@ -110,7 +111,8 @@ PolySet *SurfaceNode::evaluate_polyset(class PolySetEvaluator *) const PolySet *p = new PolySet(); int lines = 0, columns = 0; - boost::unordered_map,double> data; + //boost::unordered_map,double> data; + std::map,double> data; double min_val = 0; typedef boost::tokenizer > tokenizer; diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc index acc7c31..0ab9c0a 100644 --- a/tests/csgtestcore.cc +++ b/tests/csgtestcore.cc @@ -357,6 +357,13 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) Vector3d camerapos = center - radius*1.8*cameradir; csgInfo.glview->setCamera(camerapos, center); +#include + if (csgInfo.background_chain) + std::cout << csgInfo.background_chain->dump( true ) << "\n"; + if (csgInfo.root_chain) + std::cout << csgInfo.root_chain->dump( true ) << "\n"; + if (csgInfo.highlights_chain) + std::cout << csgInfo.highlights_chain->dump( true ) << "\n"; OpenCSGRenderer opencsgRenderer(csgInfo.root_chain, csgInfo.highlights_chain, csgInfo.background_chain, csgInfo.glview->shaderinfo); ThrownTogetherRenderer thrownTogetherRenderer(csgInfo.root_chain, csgInfo.highlights_chain, csgInfo.background_chain); -- cgit v0.10.1 From 8f17a48e2c76e0a7a35032ff87df7b89cdcb8772 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 18 Aug 2012 23:12:53 -0500 Subject: more debug diff --git a/src/ThrownTogetherRenderer.cc b/src/ThrownTogetherRenderer.cc index b22c6a5..21f3ae7 100644 --- a/src/ThrownTogetherRenderer.cc +++ b/src/ThrownTogetherRenderer.cc @@ -32,6 +32,8 @@ //#include #include +#include +using std::cout; ThrownTogetherRenderer::ThrownTogetherRenderer(CSGChain *root_chain, CSGChain *highlights_chain, @@ -70,6 +72,8 @@ void ThrownTogetherRenderer::renderCSGChain(CSGChain *chain, bool highlight, continue; const Transform3d &m = chain->matrices[i]; const Color4f &c = chain->colors[i]; + cout << "m\n" << m.matrix() << "\n"; + cout << "color\n" << c << "\n"; glPushMatrix(); glMultMatrixd(m.data()); PolySet::csgmode_e csgmode = chain->types[i] == CSGTerm::TYPE_DIFFERENCE ? PolySet::CSGMODE_DIFFERENCE : PolySet::CSGMODE_NORMAL; -- cgit v0.10.1 From 4ef470be1f147cb33d75117716ec83c84328da25 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 19 Aug 2012 07:13:41 -0500 Subject: Revert "more debug" This reverts commit 8f17a48e2c76e0a7a35032ff87df7b89cdcb8772. diff --git a/src/ThrownTogetherRenderer.cc b/src/ThrownTogetherRenderer.cc index 21f3ae7..b22c6a5 100644 --- a/src/ThrownTogetherRenderer.cc +++ b/src/ThrownTogetherRenderer.cc @@ -32,8 +32,6 @@ //#include #include -#include -using std::cout; ThrownTogetherRenderer::ThrownTogetherRenderer(CSGChain *root_chain, CSGChain *highlights_chain, @@ -72,8 +70,6 @@ void ThrownTogetherRenderer::renderCSGChain(CSGChain *chain, bool highlight, continue; const Transform3d &m = chain->matrices[i]; const Color4f &c = chain->colors[i]; - cout << "m\n" << m.matrix() << "\n"; - cout << "color\n" << c << "\n"; glPushMatrix(); glMultMatrixd(m.data()); PolySet::csgmode_e csgmode = chain->types[i] == CSGTerm::TYPE_DIFFERENCE ? PolySet::CSGMODE_DIFFERENCE : PolySet::CSGMODE_NORMAL; -- cgit v0.10.1 From 94de600995a142bb0643b70f7717be3650072644 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 19 Aug 2012 07:13:49 -0500 Subject: Revert "Revert "more debug"" This reverts commit 4ef470be1f147cb33d75117716ec83c84328da25. diff --git a/src/ThrownTogetherRenderer.cc b/src/ThrownTogetherRenderer.cc index b22c6a5..21f3ae7 100644 --- a/src/ThrownTogetherRenderer.cc +++ b/src/ThrownTogetherRenderer.cc @@ -32,6 +32,8 @@ //#include #include +#include +using std::cout; ThrownTogetherRenderer::ThrownTogetherRenderer(CSGChain *root_chain, CSGChain *highlights_chain, @@ -70,6 +72,8 @@ void ThrownTogetherRenderer::renderCSGChain(CSGChain *chain, bool highlight, continue; const Transform3d &m = chain->matrices[i]; const Color4f &c = chain->colors[i]; + cout << "m\n" << m.matrix() << "\n"; + cout << "color\n" << c << "\n"; glPushMatrix(); glMultMatrixd(m.data()); PolySet::csgmode_e csgmode = chain->types[i] == CSGTerm::TYPE_DIFFERENCE ? PolySet::CSGMODE_DIFFERENCE : PolySet::CSGMODE_NORMAL; -- cgit v0.10.1 From 5bba950304a9df2ed6b9a3429aed5c6e1959b46b Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 19 Aug 2012 07:13:57 -0500 Subject: Revert "Revert "Revert "more debug""" This reverts commit 94de600995a142bb0643b70f7717be3650072644. diff --git a/src/ThrownTogetherRenderer.cc b/src/ThrownTogetherRenderer.cc index 21f3ae7..b22c6a5 100644 --- a/src/ThrownTogetherRenderer.cc +++ b/src/ThrownTogetherRenderer.cc @@ -32,8 +32,6 @@ //#include #include -#include -using std::cout; ThrownTogetherRenderer::ThrownTogetherRenderer(CSGChain *root_chain, CSGChain *highlights_chain, @@ -72,8 +70,6 @@ void ThrownTogetherRenderer::renderCSGChain(CSGChain *chain, bool highlight, continue; const Transform3d &m = chain->matrices[i]; const Color4f &c = chain->colors[i]; - cout << "m\n" << m.matrix() << "\n"; - cout << "color\n" << c << "\n"; glPushMatrix(); glMultMatrixd(m.data()); PolySet::csgmode_e csgmode = chain->types[i] == CSGTerm::TYPE_DIFFERENCE ? PolySet::CSGMODE_DIFFERENCE : PolySet::CSGMODE_NORMAL; -- cgit v0.10.1 From 17e9fe2ea9f339acfcee9df111b2301000e11b18 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 19 Aug 2012 07:17:06 -0500 Subject: cleaning up for pull request diff --git a/scripts/linux-build-dependencies.sh b/scripts/linux-build-dependencies.sh index 154545f..a5e2bcc 100755 --- a/scripts/linux-build-dependencies.sh +++ b/scripts/linux-build-dependencies.sh @@ -326,9 +326,9 @@ fi # edit version numbers here as needed. # -#build_eigen 3.1.1 -#build_gmp 5.0.5 -#build_mpfr 3.1.1 +build_eigen 3.1.1 +build_gmp 5.0.5 +build_mpfr 3.1.1 build_boost 1.50.0 # NB! For CGAL, also update the actual download URL in the function build_cgal 4.0.2 -- cgit v0.10.1 From 702525f69c0c9b7dbeb9f07efd4d9acaf9ead65d Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 19 Aug 2012 07:31:23 -0500 Subject: cleanup for pull request diff --git a/src/ThrownTogetherRenderer.cc b/src/ThrownTogetherRenderer.cc index b22c6a5..146d2e1 100644 --- a/src/ThrownTogetherRenderer.cc +++ b/src/ThrownTogetherRenderer.cc @@ -30,8 +30,7 @@ #include "system-gl.h" -//#include -#include +#include ThrownTogetherRenderer::ThrownTogetherRenderer(CSGChain *root_chain, CSGChain *highlights_chain, @@ -63,8 +62,7 @@ void ThrownTogetherRenderer::renderCSGChain(CSGChain *chain, bool highlight, bool fberror) const { glDepthFunc(GL_LEQUAL); - //boost::unordered_map,int> polySetVisitMark; - std::map,int> polySetVisitMark; + boost::unordered_map,int> polySetVisitMark; for (size_t i = 0; i < chain->polysets.size(); i++) { if (polySetVisitMark[std::make_pair(chain->polysets[i].get(), &chain->matrices[i])]++ > 0) continue; diff --git a/src/dxfdata.cc b/src/dxfdata.cc index 080e780..0e18dd0 100644 --- a/src/dxfdata.cc +++ b/src/dxfdata.cc @@ -39,7 +39,6 @@ #include #include #include -#include #include #include "value.h" @@ -85,8 +84,7 @@ DxfData::DxfData(double fn, double fs, double fa, Grid2d< std::vector > grid(GRID_COARSE); std::vector lines; // Global lines - //boost::unordered_map< std::string, std::vector > blockdata; // Lines in blocks - std::map< std::string, std::vector > blockdata; // Lines in blocks + boost::unordered_map< std::string, std::vector > blockdata; // Lines in blocks bool in_entities_section = false; bool in_blocks_section = false; @@ -124,8 +122,7 @@ DxfData::DxfData(double fn, double fs, double fa, for (int j = 0; j < 2; j++) coords[i][j] = 0; - //typedef boost::unordered_map EntityList; - typedef std::map EntityList; + typedef boost::unordered_map EntityList; EntityList unsupported_entities_list; // diff --git a/src/dxfdim.cc b/src/dxfdim.cc index 6f1b0ab..872637b 100644 --- a/src/dxfdim.cc +++ b/src/dxfdim.cc @@ -36,11 +36,8 @@ #include #include -//boost::unordered_map dxf_dim_cache; -//boost::unordered_map dxf_cross_cache; -#include -std::map dxf_dim_cache; -std::map dxf_cross_cache; +boost::unordered_map dxf_dim_cache; +boost::unordered_map dxf_cross_cache; namespace fs = boost::filesystem; Value builtin_dxf_dim(const Context *ctx, const std::vector &argnames, const std::vector &args) @@ -186,7 +183,6 @@ Value builtin_dxf_cross(const Context *ctx, const std::vector &argn return dxf_cross_cache[key] = Value(ret); } } - PRINTB("WARNING: Can't find cross in '%s', layer '%s'!", filename % layername); return Value(); } diff --git a/src/dxfdim.h b/src/dxfdim.h index 5dc0ae0..bd42109 100644 --- a/src/dxfdim.h +++ b/src/dxfdim.h @@ -1,13 +1,10 @@ #ifndef DXFDIM_H_ #define DXFDIM_H_ -//#include -#include +#include #include "value.h" -//extern boost::unordered_map dxf_dim_cache; -//extern boost::unordered_map dxf_cross_cache; -extern std::map dxf_dim_cache; -extern std::map dxf_cross_cache; +extern boost::unordered_map dxf_dim_cache; +extern boost::unordered_map dxf_cross_cache; #endif diff --git a/src/dxftess-cgal.cc b/src/dxftess-cgal.cc index d19ef61..fb5bf50 100644 --- a/src/dxftess-cgal.cc +++ b/src/dxftess-cgal.cc @@ -30,8 +30,7 @@ typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; typedef CDT::Vertex_handle Vertex_handle; typedef CDT::Point CDTPoint; -//#include -#include +#include template class DummyCriteria { public: @@ -72,10 +71,8 @@ struct point_info_t typedef std::pair edge_t; void mark_inner_outer(std::vector &tri, Grid2d &point_info, - std::map &edge_to_triangle, - std::map &edge_to_path, int idx, bool inner) -// boost::unordered_map &edge_to_triangle, -// boost::unordered_map &edge_to_path, int idx, bool inner) + boost::unordered_map &edge_to_triangle, + boost::unordered_map &edge_to_path, int idx, bool inner) { if (tri[idx].is_marked) return; diff --git a/src/handle_dep.cc b/src/handle_dep.cc index 0bebb70..2d6f3ff 100644 --- a/src/handle_dep.cc +++ b/src/handle_dep.cc @@ -8,10 +8,8 @@ #include namespace fs = boost::filesystem; #include "boosty.h" -#include -//boost::unordered_set dependencies; -std::set dependencies; +boost::unordered_set dependencies; const char *make_command = NULL; void handle_dep(const std::string &filename) diff --git a/src/surface.cc b/src/surface.cc index eb6561e..2fa3717 100644 --- a/src/surface.cc +++ b/src/surface.cc @@ -42,7 +42,6 @@ #include #include using namespace boost::assign; // bring 'operator+=()' into scope -#include #include namespace fs = boost::filesystem; @@ -111,8 +110,7 @@ PolySet *SurfaceNode::evaluate_polyset(class PolySetEvaluator *) const PolySet *p = new PolySet(); int lines = 0, columns = 0; - //boost::unordered_map,double> data; - std::map,double> data; + boost::unordered_map,double> data; double min_val = 0; typedef boost::tokenizer > tokenizer; diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc index 0ab9c0a..acc7c31 100644 --- a/tests/csgtestcore.cc +++ b/tests/csgtestcore.cc @@ -357,13 +357,6 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) Vector3d camerapos = center - radius*1.8*cameradir; csgInfo.glview->setCamera(camerapos, center); -#include - if (csgInfo.background_chain) - std::cout << csgInfo.background_chain->dump( true ) << "\n"; - if (csgInfo.root_chain) - std::cout << csgInfo.root_chain->dump( true ) << "\n"; - if (csgInfo.highlights_chain) - std::cout << csgInfo.highlights_chain->dump( true ) << "\n"; OpenCSGRenderer opencsgRenderer(csgInfo.root_chain, csgInfo.highlights_chain, csgInfo.background_chain, csgInfo.glview->shaderinfo); ThrownTogetherRenderer thrownTogetherRenderer(csgInfo.root_chain, csgInfo.highlights_chain, csgInfo.background_chain); -- cgit v0.10.1 From a9045315baac2e8bd24428668cfa88f116984af7 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 19 Aug 2012 07:58:30 -0500 Subject: rewrite Eigen detection in CMakelists. cleanup files for pull request. diff --git a/eigen.pri b/eigen.pri index 4d9ab90..6f11a53 100644 --- a/eigen.pri +++ b/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 } diff --git a/scripts/linux-build-dependencies.sh b/scripts/linux-build-dependencies.sh index a5e2bcc..be678d3 100755 --- a/scripts/linux-build-dependencies.sh +++ b/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 diff --git a/src/dxfdata.cc b/src/dxfdata.cc index 0e18dd0..4258a4c 100644 --- a/src/dxfdata.cc +++ b/src/dxfdata.cc @@ -39,6 +39,7 @@ #include #include #include +#include #include #include "value.h" diff --git a/src/dxfdim.cc b/src/dxfdim.cc index 872637b..1ed37fa 100644 --- a/src/dxfdim.cc +++ b/src/dxfdim.cc @@ -183,7 +183,9 @@ Value builtin_dxf_cross(const Context *ctx, const std::vector &argn return dxf_cross_cache[key] = Value(ret); } } + PRINTB("WARNING: Can't find cross in '%s', layer '%s'!", filename % layername); + return Value(); } diff --git a/src/dxftess-cgal.cc b/src/dxftess-cgal.cc index fb5bf50..f221e3a 100644 --- a/src/dxftess-cgal.cc +++ b/src/dxftess-cgal.cc @@ -107,10 +107,8 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool /* do_tr std::vector tri; Grid2d point_info(GRID_FINE); -// boost::unordered_map edge_to_triangle; -// boost::unordered_map edge_to_path; - std::map edge_to_triangle; - std::map edge_to_path; + boost::unordered_map edge_to_triangle; + boost::unordered_map edge_to_path; CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION); try { diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4942259..63e265f 100644 --- a/tests/CMakeLists.txt +++ b/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 "") -- cgit v0.10.1 From 5d31f56d9313dcaa8f2304819b7d54ff9aaaf01a Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 19 Aug 2012 08:10:33 -0500 Subject: look for EIGENDIR env var. (also look for EIGEN2DIR for backwards compatability) diff --git a/common.pri b/common.pri index d852885..71aa510 100644 --- a/common.pri +++ b/common.pri @@ -9,6 +9,5 @@ include(bison.pri) include(cgal.pri) include(opencsg.pri) include(glew.pri) -include(boost.pri) include(eigen.pri) - +include(boost.pri) diff --git a/doc/testing.txt b/doc/testing.txt index 8ab1cee..bbd7c18 100644 --- a/doc/testing.txt +++ b/doc/testing.txt @@ -85,7 +85,7 @@ Some versions of Xvfb may fail, however. 1. Trouble finding libraries on unix - To help CMAKE find eigen2, OpenCSG, CGAL, Boost, and GLEW, you can use + To help CMAKE find eigen, OpenCSG, CGAL, Boost, and GLEW, you can use environment variables, just like for the main qmake & openscad.pro. Examples: OPENSCAD_LIBRARIES=$HOME cmake . @@ -93,7 +93,7 @@ Some versions of Xvfb may fail, however. Valid variables are as follows: - BOOSTDIR, CGALDIR, EIGEN2DIR, GLEWDIR, OPENCSGDIR, OPENSCAD_LIBRARIES + BOOSTDIR, CGALDIR, EIGENDIR, GLEWDIR, OPENCSGDIR, OPENSCAD_LIBRARIES When running, this might help find your locally built libraries (assuming you installed into $HOME) diff --git a/eigen.pri b/eigen.pri index 6f11a53..8037b6f 100644 --- a/eigen.pri +++ b/eigen.pri @@ -2,18 +2,18 @@ # which eigen to use: # # Priority -# 3. EIGEN3DIR / EIGEN2DIR if set +# 0. EIGENDIR if set (also EIGEN2DIR for backwards compatability) # 1. OPENSCAD_LIBRARIES eigen3 # 2. OPENSCAD_LIBRARIES eigen2 -# 4. system's standard include paths for eigen3 -# 5. system's standard include paths for eigen2 +# 3. system's standard include paths for eigen3 +# 4. system's standard include paths for eigen2 eigen { # read environment variables OPENSCAD_LIBRARIES_DIR = $$(OPENSCAD_LIBRARIES) EIGEN2_DIR = $$(EIGEN2DIR) -EIGEN3_DIR = $$(EIGEN3DIR) +EIGEN_DIR = $$(EIGENDIR) CONFIG(mingw-cross-env) { EIGEN_INCLUDEPATH = mingw-cross-env/include/eigen2 @@ -36,17 +36,14 @@ CONFIG(mingw-cross-env) { # Optionally specify location of Eigen using the -# EIGEN3DIR env. variable -!isEmpty(EIGEN3_DIR) { - EIGEN_INCLUDEPATH = $$EIGEN3_DIR - message("EIGEN3 location: $$EIGEN3_INCLUDEPATH") -} - -# Optionally specify location of Eigen using the -# EIGEN2DIR env. variable +# EIGENDIR env. variable (EIGEN2 for backwards compatability) !isEmpty(EIGEN2_DIR) { EIGEN_INCLUDEPATH = $$EIGEN2_DIR - message("EIGEN2 location: $$EIGEN2_INCLUDEPATH") + message("User set EIGEN location: $$EIGEN2_INCLUDEPATH") +} +!isEmpty(EIGEN_DIR) { + EIGEN_INCLUDEPATH = $$EIGEN_DIR + message("User set EIGEN location: $$EIGEN_INCLUDEPATH") } isEmpty(EIGEN_INCLUDEPATH) { diff --git a/openscad.pro b/openscad.pro index 6532c79..024b788 100644 --- a/openscad.pro +++ b/openscad.pro @@ -3,8 +3,7 @@ # MPFRDIR # BOOSTDIR # CGALDIR -# EIGEN2DIR -# EIGEN3DIR +# EIGENDIR # GLEWDIR # OPENCSGDIR # OPENSCAD_LIBRARIES diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 63e265f..a268df1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -179,18 +179,19 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") endif() # Priority -# 3. EIGEN3DIR / EIGEN2DIR if set +# 3. EIGENDIR if set (EIGEN2DIR for backwards compatability) # 1. OPENSCAD_LIBRARIES eigen3 # 2. OPENSCAD_LIBRARIES eigen2 # 4. system's standard include paths for eigen3 # 5. system's standard include paths for eigen2 -set(EIGEN3_DIR "$ENV{EIGEN3DIR}") set(EIGEN2_DIR "$ENV{EIGEN2DIR}") +set(EIGEN_DIR "$ENV{EIGENDIR}") set(OPENSCAD_LIBDIR "$ENV{OPENSCAD_LIBRARIES}") -if (EIGEN3_DIR) - find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS "${EIGEN3_DIR}/include/eigen3" "${EIGEN3_DIR}") +if (EIGEN_DIR) + set(EIGEN_HINTS "${EIGEN_DIR}/include/eigen3" "${EIGEN_DIR}/include/eigen2" "${EIGEN_DIR}") + find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS "${EIGEN_HINTS}") endif() if (EIGEN2_DIR) find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS "${EIGEN2_DIR}/include/eigen2" "${EIGEN2_DIR}") -- cgit v0.10.1 From fc945bfdc4598d509b6f7d1cf6d13a401fd01aa2 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 19 Aug 2012 08:27:49 -0500 Subject: fix small bugs in eigen build scripts diff --git a/eigen.pri b/eigen.pri index 8037b6f..b7fe366 100644 --- a/eigen.pri +++ b/eigen.pri @@ -39,7 +39,7 @@ CONFIG(mingw-cross-env) { # EIGENDIR env. variable (EIGEN2 for backwards compatability) !isEmpty(EIGEN2_DIR) { EIGEN_INCLUDEPATH = $$EIGEN2_DIR - message("User set EIGEN location: $$EIGEN2_INCLUDEPATH") + message("User set EIGEN location: $$EIGEN_INCLUDEPATH") } !isEmpty(EIGEN_DIR) { EIGEN_INCLUDEPATH = $$EIGEN_DIR diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a268df1..fc8480a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -188,13 +188,12 @@ endif() set(EIGEN2_DIR "$ENV{EIGEN2DIR}") set(EIGEN_DIR "$ENV{EIGENDIR}") set(OPENSCAD_LIBDIR "$ENV{OPENSCAD_LIBRARIES}") - if (EIGEN_DIR) - set(EIGEN_HINTS "${EIGEN_DIR}/include/eigen3" "${EIGEN_DIR}/include/eigen2" "${EIGEN_DIR}") - find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS "${EIGEN_HINTS}") + set(EIGHINT ${EIGEN_DIR}/include/eigen3 ${EIGEN_DIR}/include/eigen2 ${EIGEN_DIR}) + find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS ${EIGHINT}) endif() if (EIGEN2_DIR) - find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS "${EIGEN2_DIR}/include/eigen2" "${EIGEN2_DIR}") + find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS ${EIGEN2_DIR}/include/eigen2 ${EIGEN2_DIR}) endif() if (NOT EIGEN_INCLUDE_DIR) -- cgit v0.10.1 From 765f1a98dc124e1913b53ea8467908b8b8bda032 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 19 Aug 2012 08:29:22 -0500 Subject: cleanup diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fc8480a..9a23380 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -188,6 +188,7 @@ endif() set(EIGEN2_DIR "$ENV{EIGEN2DIR}") set(EIGEN_DIR "$ENV{EIGENDIR}") set(OPENSCAD_LIBDIR "$ENV{OPENSCAD_LIBRARIES}") + if (EIGEN_DIR) set(EIGHINT ${EIGEN_DIR}/include/eigen3 ${EIGEN_DIR}/include/eigen2 ${EIGEN_DIR}) find_path(EIGEN_INCLUDE_DIR Eigen/Core HINTS ${EIGHINT}) -- cgit v0.10.1