summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--boost.pri6
-rwxr-xr-xscripts/macosx-build-dependencies.sh3
-rw-r--r--src/context.cc7
-rw-r--r--src/dxfdim.cc17
-rw-r--r--src/handle_dep.cc13
-rw-r--r--tests/CMakeLists.txt2
6 files changed, 23 insertions, 25 deletions
diff --git a/boost.pri b/boost.pri
index d93b738..97beb7f 100644
--- a/boost.pri
+++ b/boost.pri
@@ -15,14 +15,14 @@ boost {
DEFINES += BOOST_STATIC
DEFINES += BOOST_THREAD_USE_LIB
DEFINES += Boost_USE_STATIC_LIBS
- LIBS += -lboost_thread_win32-mt -lboost_program_options-mt
+ LIBS += -lboost_thread_win32-mt -lboost_program_options-mt -lboost_filesystem-mt -lboost_system-mt
} else {
win32 {
- LIBS += -llibboost_thread-vc90-mt-s-1_46_1 -llibboost_program_options-vc90-mt-s-1_46_1
+ LIBS += -llibboost_thread-vc90-mt-s-1_46_1 -llibboost_program_options-vc90-mt-s-1_46_1 -llibboost_filesystem-vc90-mt-s-1_46_1 -llibboost_system-vc90-mt-s-1_46_1
} else {
# some platforms have only '-mt' versions. uncomment if needed.
# LIBS += -lboost_thread-mt -lboost_program_options-mt
- LIBS += -lboost_thread -lboost_program_options
+ LIBS += -lboost_thread -lboost_program_options -lboost_filesystem -lboost_system
}
}
}
diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh
index e69d594..903c7de 100755
--- a/scripts/macosx-build-dependencies.sh
+++ b/scripts/macosx-build-dependencies.sh
@@ -140,12 +140,13 @@ build_boost()
tar xjf boost_$bversion.tar.bz2
cd boost_$bversion
# We only need the thread and program_options libraries
- ./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem
+ ./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,system
./bjam cflags="-mmacosx-version-min=10.5 -arch i386 -arch x86_64" linkflags="-mmacosx-version-min=10.5 -arch i386 -arch x86_64"
./bjam install
install_name_tool -id $DEPLOYDIR/lib/libboost_thread.dylib $DEPLOYDIR/lib/libboost_thread.dylib
install_name_tool -id $DEPLOYDIR/lib/libboost_program_options.dylib $DEPLOYDIR/lib/libboost_program_options.dylib
install_name_tool -id $DEPLOYDIR/lib/libboost_filesystem.dylib $DEPLOYDIR/lib/libboost_filesystem.dylib
+ install_name_tool -id $DEPLOYDIR/lib/libboost_system.dylib $DEPLOYDIR/lib/libboost_system.dylib
}
build_cgal()
diff --git a/src/context.cc b/src/context.cc
index bd97f8f..176bf8d 100644
--- a/src/context.cc
+++ b/src/context.cc
@@ -30,9 +30,9 @@
#include "module.h"
#include "builtin.h"
#include "printutils.h"
-#include <QFileInfo>
-#include <QDir>
#include <boost/foreach.hpp>
+#include <boost/filesystem.hpp>
+using namespace boost::filesystem;
std::vector<const Context*> Context::ctx_stack;
@@ -175,8 +175,7 @@ AbstractNode *Context::evaluate_module(const ModuleInstantiation &inst) const
std::string Context::getAbsolutePath(const std::string &filename) const
{
if (!filename.empty()) {
- return QFileInfo(QDir(QString::fromStdString(this->document_path)),
- QString::fromStdString(filename)).absoluteFilePath().toStdString();
+ return absolute(path(this->document_path) / filename).native();
}
else {
return filename;
diff --git a/src/dxfdim.cc b/src/dxfdim.cc
index c696226..44b5d73 100644
--- a/src/dxfdim.cc
+++ b/src/dxfdim.cc
@@ -33,10 +33,11 @@
#include "context.h"
#include "mathc99.h"
-#include <QDateTime>
-#include <QFileInfo>
#include <sstream>
+#include <boost/filesystem.hpp>
+using namespace boost::filesystem;
+
boost::unordered_map<std::string,Value> dxf_dim_cache;
boost::unordered_map<std::string,Value> dxf_cross_cache;
@@ -62,12 +63,10 @@ Value builtin_dxf_dim(const Context *ctx, const std::vector<std::string> &argnam
name = args[i].text;
}
- QFileInfo fileInfo(QString::fromStdString(filename));
-
std::stringstream keystream;
keystream << filename << "|" << layername << "|" << name << "|" << xorigin
- << "|" << yorigin <<"|" << scale << "|" << fileInfo.lastModified().toTime_t()
- << "|" << fileInfo.size();
+ << "|" << yorigin <<"|" << scale << "|" << last_write_time(filename)
+ << "|" << 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;
@@ -144,12 +143,10 @@ Value builtin_dxf_cross(const Context *ctx, const std::vector<std::string> &argn
args[i].getnum(scale);
}
- QFileInfo fileInfo(QString::fromStdString(filename));
-
std::stringstream keystream;
keystream << filename << "|" << layername << "|" << xorigin << "|" << yorigin
- << "|" << scale << "|" << fileInfo.lastModified().toTime_t()
- << "|" << fileInfo.size();
+ << "|" << scale << "|" << last_write_time(filename)
+ << "|" << file_size(filename);
std::string key = keystream.str();
if (dxf_cross_cache.find(key) != dxf_cross_cache.end())
diff --git a/src/handle_dep.cc b/src/handle_dep.cc
index d4380f5..99a0df7 100644
--- a/src/handle_dep.cc
+++ b/src/handle_dep.cc
@@ -2,24 +2,25 @@
#include <string>
#include <sstream>
#include <QString>
-#include <QDir>
-#include <QSet>
#include <stdlib.h> // for system()
#include <boost/unordered_set.hpp>
#include <boost/foreach.hpp>
+#include <boost/filesystem.hpp>
+using namespace boost::filesystem;
boost::unordered_set<std::string> dependencies;
const char *make_command = NULL;
void handle_dep(const std::string &filename)
{
- if (filename[0] == '/')
+ path filepath(filename);
+ if (filepath.is_absolute()) {
dependencies.insert(filename);
+ }
else {
- QString dep = QDir::currentPath() + QString("/") + QString::fromStdString(filename);
- dependencies.insert(dep.toStdString());
+ dependencies.insert((current_path() / filepath).native());
}
- if (!QFile(QString::fromStdString(filename)).exists() && make_command) {
+ if (!exists(filepath) && make_command) {
std::stringstream buf;
buf << make_command << " '" << QString::fromStdString(filename).replace("'", "'\\''").toUtf8().data() << "'";
system(buf.str().c_str()); // FIXME: Handle error
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 29f8b25..df9598e 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -79,7 +79,7 @@ if(BOOST_ROOT)
#set(Boost_DEBUG TRUE)
set(Boost_NO_SYSTEM_PATHS TRUE)
set(Boost_ADDITIONAL_VERSIONS "1.47.0")
- find_package( Boost 1.35.0 COMPONENTS thread program_options )
+ find_package( Boost 1.35.0 COMPONENTS thread program_options filesystem system )
if(Boost_FOUND)
message(STATUS "Boost includes found: " ${Boost_INCLUDE_DIRS})
message(STATUS "Boost libraries found:")
contact: Jan Huwald // Impressum