From f97f09ab0e960e8636493b5fbbe39b819e60025c Mon Sep 17 00:00:00 2001 From: Brad Pitcher Date: Tue, 19 Jun 2012 08:39:06 -0700 Subject: name the file with the correct architecture diff --git a/scripts/release-common.sh b/scripts/release-common.sh index 80c9795..94a8634 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -186,6 +186,6 @@ case $OS in strip openscad-$VERSION/lib/openscad/* cp scripts/installer-linux.sh openscad-$VERSION/install.sh chmod 755 -R openscad-$VERSION/ - tar cz openscad-$VERSION > openscad-$VERSION.x86-64.tar.gz + tar cz openscad-$VERSION > openscad-$VERSION.x86-$ARCH.tar.gz ;; esac -- cgit v0.10.1 From 32a0fcb892cbc8391ec3fcf545a88fafa83f083d Mon Sep 17 00:00:00 2001 From: Brad Pitcher Date: Tue, 19 Jun 2012 08:39:35 -0700 Subject: update linux snapshot links diff --git a/scripts/update-web.sh b/scripts/update-web.sh index 9036d9b..c611d28 100755 --- a/scripts/update-web.sh +++ b/scripts/update-web.sh @@ -11,6 +11,8 @@ fi if [[ $OSTYPE =~ "darwin" ]]; then OS=MACOSX +elif [[ $OSTYPE == "linux-gnu" ]]; then + OS=LINUX fi indexfile=../openscad.github.com/index.html @@ -21,6 +23,10 @@ if [ -f $indexfile ]; then file2=$2 sed -i .backup -e "s/^\(.*win-snapshot-zip.*\)\(OpenSCAD-.*\.zip\)\(.*\)\(OpenSCAD-.*zip\)\(.*$\)/\\1$file1\\3$file1\\5/" $indexfile sed -i .backup -e "s/^\(.*win-snapshot-exe.*\)\(OpenSCAD-.*-Installer\.exe\)\(.*\)\(OpenSCAD-.*-Installer.exe\)\(.*$\)/\\1$file2\\3$file2\\5/" $indexfile + elif [ $OS == LINUX ]; then + file2=$2 + sed -i .backup -e "s/^\(.*linux-snapshot-32.*\)\(openscad-.*-32\.tar\.gz\)\(.*\)\(openscad-.*-32\.tar\.gz\)\(.*$\)/\\1$file1\\3$file1\\5/" $indexfile + sed -i .backup -e "s/^\(.*linux-snapshot-64.*\)\(openscad-.*-64\.tar\.gz\)\(.*\)\(openscad-.*-64\.tar\.gz\)\(.*$\)/\\1$file2\\3$file2\\5/" $indexfile fi echo "Web page updated. Remember to commit and push openscad.github.com" else -- cgit v0.10.1 From 8e8f090fa48cc883b3197a6a1444841843e4cbc3 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 23 Jun 2012 23:05:06 +0200 Subject: cosmetics diff --git a/tests/dumptest.cc b/tests/dumptest.cc index f923a64..c1fe55b 100644 --- a/tests/dumptest.cc +++ b/tests/dumptest.cc @@ -84,7 +84,7 @@ int main(int argc, char **argv) QCoreApplication app(argc, argv); fs::path original_path = fs::current_path(); - currentdir = boosty::stringy( fs::current_path() ); + currentdir = boosty::stringy(fs::current_path()); parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); -- cgit v0.10.1 From 0e6b80015504b36363c5545744b6627554c4d10b Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 23 Jun 2012 23:05:46 +0200 Subject: Output filenames relative to document path when exporting .csg files from the command-line. Fixes #128 diff --git a/src/openscad.cc b/src/openscad.cc index 7fe054f..61ac162 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -294,6 +294,7 @@ int main(int argc, char **argv) PRINTB("Can't open file \"%s\" for export", csg_output_file); } else { + fs::current_path(fparent); // Force exported filenames to be relative to document path fstream << tree.getString(*root_node) << "\n"; fstream.close(); } -- cgit v0.10.1 From 22c5f37424e42b69442ef6b020b650c0e685a8c3 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sun, 24 Jun 2012 16:29:28 +0200 Subject: Search for libraries from a list of paths. Preparations for issue #125 diff --git a/src/lexer.l b/src/lexer.l index 188046f..f939330 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -118,7 +118,7 @@ use[ \t\r\n>]*"<" { BEGIN(cond_use); } else { usepath = sourcepath() / filename; if (!fs::exists(usepath)) { - usepath = boosty::absolute(fs::path(get_librarydir()) / filename); + usepath = locate_file(filename); } } /* Only accept regular files which exists */ @@ -214,7 +214,7 @@ void includefile() fs::path finfo = dirinfo / filename; if (!exists(finfo)) { - finfo = fs::path(get_librarydir()) / filepath / filename; + finfo = locate_file((fs::path(filepath) / filename).string()); } filepath.clear(); diff --git a/src/parsersettings.cc b/src/parsersettings.cc index a3a02b7..53b34f4 100644 --- a/src/parsersettings.cc +++ b/src/parsersettings.cc @@ -1,27 +1,38 @@ #include "parsersettings.h" #include +#include +#include "boosty.h" #include // Needed for Q_ defines - move the offending code somewhere else -using namespace boost::filesystem; -#include "boosty.h" +namespace fs = boost::filesystem; -std::string librarydir; +std::vector librarypath; -void set_librarydir(const std::string &libdir) +void add_librarydir(const std::string &libdir) { - librarydir = libdir; + librarypath.push_back(libdir); } -const std::string &get_librarydir() +/*! + Searces for the given file in library paths and returns the full path if found. + Returns an empty path if file cannot be found. +*/ +std::string locate_file(const std::string &filename) { - return librarydir; + BOOST_FOREACH(const std::string &dir, librarypath) { + fs::path usepath = fs::path(dir) / filename; + if (fs::exists(usepath)) return usepath.string(); + } + return std::string(); } void parser_init(const std::string &applicationpath) { + // FIXME: Append paths from OPENSCADPATH before adding built-in paths + std::string librarydir; - path libdir(applicationpath); - path tmpdir; + fs::path libdir(applicationpath); + fs::path tmpdir; #ifdef Q_WS_MAC libdir /= "../Resources"; // Libraries can be bundled if (!is_directory(libdir / "libraries")) libdir /= "../../.."; @@ -37,5 +48,5 @@ void parser_init(const std::string &applicationpath) if (is_directory(tmpdir = libdir / "libraries")) { librarydir = boosty::stringy( tmpdir ); } - set_librarydir(librarydir); + if (!librarydir.empty()) add_librarydir(librarydir); } diff --git a/src/parsersettings.h b/src/parsersettings.h index a5dc939..007aa9c 100644 --- a/src/parsersettings.h +++ b/src/parsersettings.h @@ -6,7 +6,7 @@ extern int parser_error_pos; void parser_init(const std::string &applicationpath); -void set_librarydir(const std::string &libdir); -const std::string &get_librarydir(); +void add_librarydir(const std::string &libdir); +std::string locate_file(const std::string &filename); #endif diff --git a/testdata/scad/features/import_dxf-tests.scad b/testdata/scad/features/import_dxf-tests.scad deleted file mode 100644 index 50a5416..0000000 --- a/testdata/scad/features/import_dxf-tests.scad +++ /dev/null @@ -1,10 +0,0 @@ -import(); -translate([-210,0,0]) import(file="../../dxf/polygons.dxf"); -translate([-210,0,0]) import(file="../../dxf/polygons.dxf", origin=[0,110]); -translate([-210,0,0]) import(file="../../dxf/polygons.dxf", origin=[110,110], scale=0.5); -import(file="../../dxf/multiple-layers.dxf"); -translate([-200,200,0]) import(file="../../dxf/multiple-layers.dxf", layer="0"); -translate([0,200,0]) import(file="../../dxf/multiple-layers.dxf", layer="0"); -translate([200,200,0]) import(file="../../dxf/multiple-layers.dxf", layer="noname"); -translate([0,200,0]) import(file="../../dxf/multiple-layers.dxf", layer="Layer with a pretty long name including \\ \"special\" /'\\\\ characters"); -translate([200,0,0]) import(file="/Users/kintel/code/OpenSCAD/openscad/tests/../testdata/dxf/polygons.dxf"); diff --git a/testdata/scad/features/import_stl-tests.scad b/testdata/scad/features/import_stl-tests.scad deleted file mode 100644 index af42e8d..0000000 --- a/testdata/scad/features/import_stl-tests.scad +++ /dev/null @@ -1,4 +0,0 @@ -import_stl("import.stl"); -translate([2,0,0]) import("import.stl"); -translate([4,0,0]) import("import_bin.stl"); -translate([0,2,0]) import("/Users/kintel/code/OpenSCAD/openscad/tests/../testdata/scad/features/import.stl"); diff --git a/tests/cgalcachetest.cc b/tests/cgalcachetest.cc index 18e9efa..46e0e9a 100644 --- a/tests/cgalcachetest.cc +++ b/tests/cgalcachetest.cc @@ -139,7 +139,7 @@ int main(int argc, char **argv) currentdir = boosty::stringy( fs::current_path() ); parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); Context root_ctx; register_builtin(root_ctx); diff --git a/tests/cgalpngtest.cc b/tests/cgalpngtest.cc index 7c9684a..08e539e 100644 --- a/tests/cgalpngtest.cc +++ b/tests/cgalpngtest.cc @@ -112,7 +112,7 @@ int main(int argc, char **argv) currentdir = boosty::stringy( fs::current_path() ); parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); Context root_ctx; register_builtin(root_ctx); diff --git a/tests/cgalstlsanitytest.cc b/tests/cgalstlsanitytest.cc index d0d0077..92b4ac1 100644 --- a/tests/cgalstlsanitytest.cc +++ b/tests/cgalstlsanitytest.cc @@ -98,7 +98,7 @@ int main(int argc, char **argv) currentdir = boosty::stringy( fs::current_path() ); parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); Context root_ctx; register_builtin(root_ctx); diff --git a/tests/cgaltest.cc b/tests/cgaltest.cc index 98617a3..e4761db 100644 --- a/tests/cgaltest.cc +++ b/tests/cgaltest.cc @@ -91,7 +91,7 @@ int main(int argc, char **argv) currentdir = boosty::stringy( fs::current_path() ); parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); Context root_ctx; register_builtin(root_ctx); diff --git a/tests/csgtermtest.cc b/tests/csgtermtest.cc index 1bd2468..e793c4a 100644 --- a/tests/csgtermtest.cc +++ b/tests/csgtermtest.cc @@ -77,7 +77,7 @@ int main(int argc, char **argv) currentdir = boosty::stringy( fs::current_path() ); parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); Context root_ctx; register_builtin(root_ctx); diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc index cb96940..02cf73c 100644 --- a/tests/csgtestcore.cc +++ b/tests/csgtestcore.cc @@ -258,7 +258,7 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) std::string currentdir = boosty::stringy( fs::current_path() ); parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); Context root_ctx; register_builtin(root_ctx); diff --git a/tests/csgtexttest.cc b/tests/csgtexttest.cc index 6e18f20..e050232 100644 --- a/tests/csgtexttest.cc +++ b/tests/csgtexttest.cc @@ -81,7 +81,7 @@ int main(int argc, char **argv) currentdir = boosty::stringy( fs::current_path() ); parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); Context root_ctx; register_builtin(root_ctx); diff --git a/tests/dumptest.cc b/tests/dumptest.cc index c1fe55b..6851fb1 100644 --- a/tests/dumptest.cc +++ b/tests/dumptest.cc @@ -87,7 +87,7 @@ int main(int argc, char **argv) currentdir = boosty::stringy(fs::current_path()); parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); Context root_ctx; register_builtin(root_ctx); diff --git a/tests/echotest.cc b/tests/echotest.cc index d731ee3..bf2f4a4 100644 --- a/tests/echotest.cc +++ b/tests/echotest.cc @@ -89,7 +89,7 @@ int main(int argc, char **argv) currentdir = boosty::stringy( fs::current_path() ); parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); Context root_ctx; register_builtin(root_ctx); diff --git a/tests/modulecachetest.cc b/tests/modulecachetest.cc index 2ef7a6c..0028114 100644 --- a/tests/modulecachetest.cc +++ b/tests/modulecachetest.cc @@ -77,7 +77,7 @@ int main(int argc, char **argv) currentdir = boosty::stringy( fs::current_path() ); parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); Context root_ctx; register_builtin(root_ctx); -- cgit v0.10.1 From 431a24b4973069c86728f28efa62930354f92f6d Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 30 Jun 2012 23:42:51 +0300 Subject: Update master diff --git a/README.md b/README.md index 13fba4d..b1a618d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # What is OpenSCAD? +[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=openscad&url=http://openscad.org&title=OpenSCAD&language=&tags=github&category=software) OpenSCAD is a software for creating solid 3D CAD objects. It is free software and available for Linux/UNIX, MS Windows and Mac OS X. -- cgit v0.10.1 From 54067c635d1a6de4509930ed9d8593f5373f2ba1 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sun, 1 Jul 2012 02:08:45 +0200 Subject: Fixed normalization bug: node limit wasn't checked properly and some cases triggered exponential expansion of nodes during normalization. Fixes #127 diff --git a/src/csgtermnormalizer.cc b/src/csgtermnormalizer.cc index 6600758..e2474e9 100644 --- a/src/csgtermnormalizer.cc +++ b/src/csgtermnormalizer.cc @@ -5,25 +5,29 @@ /*! NB! for e.g. empty intersections, this can normalize a tree to nothing and return NULL. */ -shared_ptr CSGTermNormalizer::normalize(const shared_ptr &root, - size_t limit) +shared_ptr CSGTermNormalizer::normalize(const shared_ptr &root) { shared_ptr temp = root; while (1) { + this->rootnode = temp; + this->nodecount = 0; shared_ptr n = normalizePass(temp); if (!n) return n; // If normalized to nothing if (temp == n) break; temp = n; - unsigned int num = count(temp); -#ifdef DEBUG - PRINTB("Normalize count: %d\n", num); -#endif - if (num > limit) { - PRINTB("WARNING: Normalized tree is growing past %d elements. Aborting normalization.\n", limit); - return root; + if (this->nodecount > this->limit) { + PRINTB("WARNING: Normalized tree is growing past %d elements. Aborting normalization.\n", this->limit); + // Clean up any partially evaluated terms + shared_ptr newroot = root, tmproot; + while (newroot != tmproot) { + tmproot = newroot; + newroot = collapse_null_terms(tmproot); + } + return newroot; } } + this->rootnode.reset(); return temp; } @@ -42,7 +46,11 @@ shared_ptr CSGTermNormalizer::normalizePass(shared_ptr term) } do { - while (term && normalize_tail(term)) { } + while (term && match_and_replace(term)) { } + this->nodecount++; + if (nodecount > this->limit) { + return shared_ptr(); + } if (!term || term->type == CSGTerm::TYPE_PRIMITIVE) return term; if (term->left) term->left = normalizePass(term->left); } while (term->type != CSGTerm::TYPE_UNION && @@ -51,6 +59,11 @@ shared_ptr CSGTermNormalizer::normalizePass(shared_ptr term) term->right = normalizePass(term->right); // FIXME: Do we need to take into account any transformation of item here? + return collapse_null_terms(term); +} + +shared_ptr CSGTermNormalizer::collapse_null_terms(const shared_ptr &term) +{ if (!term->right) { if (term->type == CSGTerm::TYPE_UNION || term->type == CSGTerm::TYPE_DIFFERENCE) return term->left; else return term->right; @@ -59,13 +72,14 @@ shared_ptr CSGTermNormalizer::normalizePass(shared_ptr term) if (term->type == CSGTerm::TYPE_UNION) return term->right; else return term->left; } - return term; } -bool CSGTermNormalizer::normalize_tail(shared_ptr &term) +bool CSGTermNormalizer::match_and_replace(shared_ptr &term) { - if (term->type == CSGTerm::TYPE_UNION || term->type == CSGTerm::TYPE_PRIMITIVE) return false; + if (term->type == CSGTerm::TYPE_UNION || term->type == CSGTerm::TYPE_PRIMITIVE) { + return false; + } // Part A: The 'x . (y . z)' expressions @@ -149,8 +163,9 @@ bool CSGTermNormalizer::normalize_tail(shared_ptr &term) return false; } +// Counts all non-leaf nodes unsigned int CSGTermNormalizer::count(const shared_ptr &term) const { if (!term) return 0; - return term->type == CSGTerm::TYPE_PRIMITIVE ? 1 : 0 + count(term->left) + count(term->right); + return term->type == CSGTerm::TYPE_PRIMITIVE ? 0 : 1 + count(term->left) + count(term->right); } diff --git a/src/csgtermnormalizer.h b/src/csgtermnormalizer.h index e5a2eca..c331f11 100644 --- a/src/csgtermnormalizer.h +++ b/src/csgtermnormalizer.h @@ -6,15 +6,20 @@ class CSGTermNormalizer { public: - CSGTermNormalizer() {} + CSGTermNormalizer(size_t limit) : limit(limit) {} ~CSGTermNormalizer() {} - shared_ptr normalize(const shared_ptr &term, size_t limit); + shared_ptr normalize(const shared_ptr &term); private: shared_ptr normalizePass(shared_ptr term) ; - bool normalize_tail(shared_ptr &term); + bool match_and_replace(shared_ptr &term); + shared_ptr collapse_null_terms(const shared_ptr &term); unsigned int count(const shared_ptr &term) const; + + size_t limit; + size_t nodecount; + shared_ptr rootnode; }; #endif diff --git a/src/mainwin.cc b/src/mainwin.cc index 087cb30..08fbec5 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -719,9 +719,9 @@ void MainWindow::compileCSG(bool procevents) if (procevents) QApplication::processEvents(); - CSGTermNormalizer normalizer; size_t normalizelimit = 2 * Preferences::inst()->getValue("advanced/openCSGLimit").toUInt(); - this->root_norm_term = normalizer.normalize(this->root_raw_term, normalizelimit); + CSGTermNormalizer normalizer(normalizelimit); + this->root_norm_term = normalizer.normalize(this->root_raw_term); if (this->root_norm_term) { this->root_chain = new CSGChain(); this->root_chain->import(this->root_norm_term); @@ -741,7 +741,7 @@ void MainWindow::compileCSG(bool procevents) highlights_chain = new CSGChain(); for (unsigned int i = 0; i < highlight_terms.size(); i++) { - highlight_terms[i] = normalizer.normalize(highlight_terms[i], normalizelimit); + highlight_terms[i] = normalizer.normalize(highlight_terms[i]); highlights_chain->import(highlight_terms[i]); } } @@ -754,7 +754,7 @@ void MainWindow::compileCSG(bool procevents) background_chain = new CSGChain(); for (unsigned int i = 0; i < background_terms.size(); i++) { - background_terms[i] = normalizer.normalize(background_terms[i], normalizelimit); + background_terms[i] = normalizer.normalize(background_terms[i]); background_chain->import(background_terms[i]); } } diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc index 02cf73c..acc7c31 100644 --- a/tests/csgtestcore.cc +++ b/tests/csgtestcore.cc @@ -302,8 +302,8 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) } // CSG normalization - CSGTermNormalizer normalizer; - csgInfo.root_norm_term = normalizer.normalize(root_raw_term, 5000); + CSGTermNormalizer normalizer(5000); + csgInfo.root_norm_term = normalizer.normalize(root_raw_term); if (csgInfo.root_norm_term) { csgInfo.root_chain = new CSGChain(); csgInfo.root_chain->import(csgInfo.root_norm_term); @@ -319,7 +319,7 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) csgInfo.highlights_chain = new CSGChain(); for (unsigned int i = 0; i < csgInfo.highlight_terms.size(); i++) { - csgInfo.highlight_terms[i] = normalizer.normalize(csgInfo.highlight_terms[i], 5000); + csgInfo.highlight_terms[i] = normalizer.normalize(csgInfo.highlight_terms[i]); csgInfo.highlights_chain->import(csgInfo.highlight_terms[i]); } } @@ -329,7 +329,7 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) csgInfo.background_chain = new CSGChain(); for (unsigned int i = 0; i < csgInfo.background_terms.size(); i++) { - csgInfo.background_terms[i] = normalizer.normalize(csgInfo.background_terms[i], 5000); + csgInfo.background_terms[i] = normalizer.normalize(csgInfo.background_terms[i]); csgInfo.background_chain->import(csgInfo.background_terms[i]); } } -- cgit v0.10.1 From cc9fd5b33e42ea5d6f41c8ff649b2a014fa16450 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 1 Jul 2012 17:07:39 +0200 Subject: Add link to Wikibooks manual for 'not 2-manifold' error on export. diff --git a/src/mainwin.cc b/src/mainwin.cc index 08fbec5..22bc498 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -1359,7 +1359,7 @@ void MainWindow::actionExportSTLorOFF(bool) } if (!this->root_N->p3->is_simple()) { - PRINT("Object isn't a valid 2-manifold! Modify your design.."); + PRINT("Object isn't a valid 2-manifold! Modify your design. See http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/STL_Import_and_Export"); clearCurrentOutput(); return; } -- cgit v0.10.1 From 491caa15ada3e51fd252aaa74de31178f01ff5ad Mon Sep 17 00:00:00 2001 From: don bright Date: Wed, 4 Jul 2012 04:34:00 +0200 Subject: auto-detect curl + cmake. link libs properly. use 'openscad_deps' subdir diff --git a/scripts/linux-build-dependencies.sh b/scripts/linux-build-dependencies.sh index 9097850..7727c4e 100755 --- a/scripts/linux-build-dependencies.sh +++ b/scripts/linux-build-dependencies.sh @@ -15,11 +15,11 @@ # -- you can uncomment 'build_cmake' at the bottom # -BASEDIR=$HOME +BASEDIR=$HOME/openscad_deps OPENSCADDIR=$PWD SRCDIR=$BASEDIR/src DEPLOYDIR=$BASEDIR -NUMCPU=2 # paralell builds for some libraries +NUMCPU=4 # paralell builds for some libraries printUsage() { @@ -87,12 +87,10 @@ build_mpfr() cd $BASEDIR/src rm -rf mpfr-$version if [ ! -f mpfr-$version.tar.bz2 ]; then - curl -O http://www.mpfr.org/mpfr-current/mpfr-$version.tar.bz2 + curl -O http://www.mpfr.org/mpfr-$version/mpfr-$version.tar.bz2 fi tar xjf mpfr-$version.tar.bz2 cd mpfr-$version - curl -O http://www.mpfr.org/mpfr-current/allpatches - patch -N -Z -p1 < allpatches mkdir build cd build ../configure --prefix=$DEPLOYDIR --with-gmp=$DEPLOYDIR @@ -208,19 +206,33 @@ echo "Using srcdir:" $SRCDIR echo "Number of CPUs for parallel builds:" $NUMCPU mkdir -p $SRCDIR $DEPLOYDIR -#build_curl 7.26.0 +export PATH=$BASEDIR/bin:$PATH +export LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64:$LD_LIBRARY_PATH +export LD_RUN_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64:$LD_RUN_PATH +echo "PATH modified" +echo "LD_LIBRARY_PATH modified" +echo "LD_RUN_PATH modified" + +if [ ! "`command -v curl`" ]; then + build_curl 7.26.0 +fi + # NB! For cmake, also update the actual download URL in the function -#build_cmake 2.8.8 +if [ ! "`command -v cmake`" ]; then + build_cmake 2.8.8 +fi + build_eigen 2.0.17 build_gmp 5.0.5 -build_mpfr 3.1.0 +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 build_glew 1.7.0 build_opencsg 1.3.2 -echo "Now do this:" +echo "OpenSCAD dependencies built in " $BASEDIR +echo "To build OpenSCAD, copy/paste these lines to your shell prompt: " echo "export LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64" echo "GLEWDIR=$DEPLOYDIR OPENSCAD_LIBRARIES=$DEPLOYDIR qmake-qt4" echo "make -j$NUMCPU" -- cgit v0.10.1 From 9a05c66e1ccbdf44ad5c1bf333faff204b629619 Mon Sep 17 00:00:00 2001 From: don bright Date: Wed, 4 Jul 2012 06:33:04 +0200 Subject: document linux source build. add env variable script for linux src builds diff --git a/README.md b/README.md index b1a618d..1196621 100644 --- a/README.md +++ b/README.md @@ -79,10 +79,10 @@ To build OpenSCAD, you need some libraries and tools. The version numbers in brackets specify the versions which have been used for development. Other versions may or may not work as well. -If you're using Ubuntu, you can install these libraries from -aptitude. If you're using Mac, there is a build script that compiles -the libraries from source. Follow the instructions for the platform -you're compiling on below. +If you're using a newer version of Ubuntu, you can install these +libraries from aptitude. If you're using Mac, or an older Linux, there +are build scripts that download and compile the libraries from source. +Follow the instructions for the platform you're compiling on below. * [Qt4 (4.4 - 4.7)](http://www.qt.nokia.com/) * [CGAL (3.6 - 3.9)](http://www.cgal.org/) @@ -117,15 +117,25 @@ compilation process. After that, follow the Compilation instructions below. -### Building for Ubuntu +### Building for older Linux or without root access -If you have done this and want to contribute, fork the repo and -contribute docs on how to build for windows! +First, make sure that you have compiler tools (build-essential on ubuntu). +Then after you've cloned this git repository, run the script that sets up the +environment variables. + + source ./scripts/setenv-linbuild.sh + +Then run the script to download & compile all the prerequisite libraries above: + + ./scripts/linux-build-dependencies.sh + +After that, follow the Compilation instructions below. ### Building for Windows -If you have done this and want to contribute, fork the repo and -contribute docs on how to build for windows! +OpenSCAD for Windows is usually cross-compiled from Linux. If you wish to +attempt an MSVC build, please see this site: +http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_on_Windows ### Compilation diff --git a/scripts/linux-build-dependencies.sh b/scripts/linux-build-dependencies.sh index 7727c4e..a789e9d 100755 --- a/scripts/linux-build-dependencies.sh +++ b/scripts/linux-build-dependencies.sh @@ -7,12 +7,9 @@ # Usage: linux-build-dependencies.sh # # Prerequisites: -# - curl -# -- you can uncomment 'build_curl' at the bottom -# -- and add $BASEDIR/bin to your PATH, i.e. in .bash_profile +# - wget # - Qt4 -# - cmake 2.8 -# -- you can uncomment 'build_cmake' at the bottom +# - cmake 2.8 ( force build_cmake at bottom if yours is too old ) # BASEDIR=$HOME/openscad_deps @@ -209,9 +206,9 @@ mkdir -p $SRCDIR $DEPLOYDIR export PATH=$BASEDIR/bin:$PATH export LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64:$LD_LIBRARY_PATH export LD_RUN_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64:$LD_RUN_PATH -echo "PATH modified" -echo "LD_LIBRARY_PATH modified" -echo "LD_RUN_PATH modified" +echo "PATH modified temporarily" +echo "LD_LIBRARY_PATH modified temporarily" +echo "LD_RUN_PATH modified temporarily" if [ ! "`command -v curl`" ]; then build_curl 7.26.0 @@ -232,8 +229,3 @@ build_glew 1.7.0 build_opencsg 1.3.2 echo "OpenSCAD dependencies built in " $BASEDIR -echo "To build OpenSCAD, copy/paste these lines to your shell prompt: " -echo "export LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64" -echo "GLEWDIR=$DEPLOYDIR OPENSCAD_LIBRARIES=$DEPLOYDIR qmake-qt4" -echo "make -j$NUMCPU" - diff --git a/scripts/setenv-linbuild.sh b/scripts/setenv-linbuild.sh new file mode 100644 index 0000000..a61b55a --- /dev/null +++ b/scripts/setenv-linbuild.sh @@ -0,0 +1,16 @@ +# BASEDIR and DEPLOYDIR must be the same as in linux-build-dependencies.sh +BASEDIR=$HOME/openscad_deps +DEPLOYDIR=$BASEDIR + +PATH=$BASEDIR/bin:$PATH +LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64 +LD_RUN_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64 +OPENSCAD_LIBRARIES=$DEPLOYDIR +GLEWDIR=$DEPLOYDIR + +echo PATH modified +echo LD_LIBRARY_PATH modified +echo LD_RUN_PATH modified +echo OPENSCAD_LIBRARIES modified +echo GLEWDIR modified + -- cgit v0.10.1 From 984f7dc3f916232375ec7efe3b240e4c286a4c3c Mon Sep 17 00:00:00 2001 From: don bright Date: Wed, 4 Jul 2012 06:56:17 +0200 Subject: Add ubuntu package list for aptitude. Add pointer to wikibooks site diff --git a/README.md b/README.md index 1196621..8533e0d 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,15 @@ compilation process. After that, follow the Compilation instructions below. +### Building for newer Ubunutu + +sudo apt-get install libqt4-dev libqt4-opengl-dev libxmu-dev cmake \ + libglew1.5-dev bison flex libeigen2-dev git-core libboost-all-dev \ + libXi-dev libcgal-dev libglut3-dev libopencsg-dev libopencsg1 + +Check your library versions against the list above. After that, follow +the Compilation instructions below. + ### Building for older Linux or without root access First, make sure that you have compiler tools (build-essential on ubuntu). @@ -148,3 +157,5 @@ Then run make. Finally you might run 'make install' as root or simply copy the If you had problems compiling from source, raise a new issue in the [issue tracker on the github page](https://github.com/openscad/openscad/issues). +The four subsections of this site can also be helpful: +http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_OpenSCAD_from_Sources -- cgit v0.10.1 From bbef180a218aa59f03ea7bcf389ff3d1a357907d Mon Sep 17 00:00:00 2001 From: don bright Date: Tue, 3 Jul 2012 22:27:31 -0700 Subject: kludge-fix for broken Makefiles for opencsg + glew on Fedora 64bit diff --git a/scripts/linux-build-dependencies.sh b/scripts/linux-build-dependencies.sh index a789e9d..286399b 100755 --- a/scripts/linux-build-dependencies.sh +++ b/scripts/linux-build-dependencies.sh @@ -16,7 +16,7 @@ BASEDIR=$HOME/openscad_deps OPENSCADDIR=$PWD SRCDIR=$BASEDIR/src DEPLOYDIR=$BASEDIR -NUMCPU=4 # paralell builds for some libraries +NUMCPU=2 # paralell builds for some libraries printUsage() { @@ -145,6 +145,10 @@ build_glew() tar xzf glew-$version.tgz cd glew-$version mkdir -p $DEPLOYDIR/lib/pkgconfig + + # uncomment this kludge for Fedora 64bit + # sed -i s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ config/Makefile.linux + GLEW_DEST=$DEPLOYDIR make -j$NUMCPU GLEW_DEST=$DEPLOYDIR make install } @@ -161,6 +165,10 @@ build_opencsg() tar xzf OpenCSG-$version.tar.gz cd OpenCSG-$version sed -i s/example// opencsg.pro # examples might be broken without GLUT + + # uncomment this kludge for Fedora 64bit + # sed -i s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ src/Makefile + qmake-qt4 make install -v lib/* $DEPLOYDIR/lib -- cgit v0.10.1 From 5b805ed5869d1f2b0bc3a9c18d565b4780a2d163 Mon Sep 17 00:00:00 2001 From: don bright Date: Tue, 3 Jul 2012 22:31:22 -0700 Subject: wget or curl required. if curl isnt there, wget will fetch + build it diff --git a/scripts/linux-build-dependencies.sh b/scripts/linux-build-dependencies.sh index 286399b..aef58b9 100755 --- a/scripts/linux-build-dependencies.sh +++ b/scripts/linux-build-dependencies.sh @@ -7,7 +7,7 @@ # Usage: linux-build-dependencies.sh # # Prerequisites: -# - wget +# - wget or curl # - Qt4 # - cmake 2.8 ( force build_cmake at bottom if yours is too old ) # -- cgit v0.10.1 From def43ad3169d4dfbbcc42de41ab405af35f7ec23 Mon Sep 17 00:00:00 2001 From: don bright Date: Tue, 3 Jul 2012 22:53:37 -0700 Subject: improve script reporting and functionality (export) diff --git a/scripts/setenv-linbuild.sh b/scripts/setenv-linbuild.sh index a61b55a..d9aeea8 100644 --- a/scripts/setenv-linbuild.sh +++ b/scripts/setenv-linbuild.sh @@ -2,12 +2,14 @@ BASEDIR=$HOME/openscad_deps DEPLOYDIR=$BASEDIR -PATH=$BASEDIR/bin:$PATH -LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64 -LD_RUN_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64 -OPENSCAD_LIBRARIES=$DEPLOYDIR -GLEWDIR=$DEPLOYDIR +export PATH=$BASEDIR/bin:$PATH +export LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64 +export LD_RUN_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64 +export OPENSCAD_LIBRARIES=$DEPLOYDIR +export GLEWDIR=$DEPLOYDIR +echo BASEDIR: $BASEDIR +echo DEPLOYDIR: $DEPLOYDIR echo PATH modified echo LD_LIBRARY_PATH modified echo LD_RUN_PATH modified -- cgit v0.10.1 From 9b0f148d2d71ae0d975912e1b405650a45f6b042 Mon Sep 17 00:00:00 2001 From: don bright Date: Wed, 4 Jul 2012 08:03:38 +0200 Subject: documentation for purpose of file diff --git a/scripts/setenv-linbuild.sh b/scripts/setenv-linbuild.sh index a61b55a..8e3d76d 100644 --- a/scripts/setenv-linbuild.sh +++ b/scripts/setenv-linbuild.sh @@ -1,3 +1,8 @@ +# setup env variables for building OpenSCAD against custom built +# dependency libraries from linux-build-dependencies.sh + +# run this file with 'source setenv-linbuild.sh' + # BASEDIR and DEPLOYDIR must be the same as in linux-build-dependencies.sh BASEDIR=$HOME/openscad_deps DEPLOYDIR=$BASEDIR -- cgit v0.10.1