Skip to content
Browse files

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
  • Loading branch information...
1 parent 9f6819e commit 10c7607541e502f2d0ff7c2c49fd70809704c039 @donbright donbright committed
Showing with 57 additions and 11 deletions.
  1. +3 −6 src/dxfdim.cc
  2. +4 −4 src/handle_dep.cc
  3. +1 −1 src/import.cc
  4. +49 −0 tests/CMakeLists.txt
View
9 src/dxfdim.cc
@@ -72,7 +72,6 @@ Value builtin_dxf_dim(const Context *ctx, const std::vector<std::string> &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<std::string> &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<std::string> &argnames, const std::vector<Value> &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<std::string> &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<std::string> &argn
}
PRINTB("WARNING: Can't find cross in '%s', layer '%s'!", filename % layername);
-*/
return Value();
}
View
8 src/handle_dep.cc
@@ -6,7 +6,7 @@
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
#include <boost/filesystem.hpp>
-using namespace boost::filesystem;
+namespace fs = boost::filesystem;
#include "boosty.h"
boost::unordered_set<std::string> 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
View
2 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;
View
49 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}")

0 comments on commit 10c7607

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