summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2012-08-18 20:44:46 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2012-08-18 20:44:46 (GMT)
commit10c7607541e502f2d0ff7c2c49fd70809704c039 (patch)
tree668b8ff9ff4604e753d32ad29decb82f36a63313
parent9f6819e68501de16563aeaaadd65dfc915092169 (diff)
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
-rw-r--r--src/dxfdim.cc9
-rw-r--r--src/handle_dep.cc8
-rw-r--r--src/import.cc2
-rw-r--r--tests/CMakeLists.txt49
4 files changed, 57 insertions, 11 deletions
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<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();
}
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 <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
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}")
contact: Jan Huwald // Impressum