From f242a7a6934effdb292c0fedafa954bafc615cc3 Mon Sep 17 00:00:00 2001 From: don bright Date: Thu, 21 Mar 2013 04:29:54 +0100 Subject: backport to boost 1.37. improve dependency build for older lib versions including the requirement of symlink to $DEPLOYDIR/include/boost if boost is so old that it uses version numbers in the path name diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index 784a191..bfc830f 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -264,6 +264,12 @@ build_boost() echo boost build failed exit 1 fi + if [ "`ls $DEPLOYDIR/include/ | grep boost.[0-9]`" ]; then + if [ ! -e $DEPLOYDIR/include/boost ]; then + echo "boost is old, make a symlink to $DEPLOYDIR/include/boost & rerun" + exit 1 + fi + fi } build_cgal() @@ -276,17 +282,26 @@ build_cgal() echo "Building CGAL" $version "..." cd $BASEDIR/src rm -rf CGAL-$version - if [ ! -f CGAL-$version.tar.* ]; then - # 4.1 - curl --insecure -O https://gforge.inria.fr/frs/download.php/31640/CGAL-$version.tar.bz2 - # 4.0.2 curl --insecure -O https://gforge.inria.fr/frs/download.php/31174/CGAL-$version.tar.bz2 - # 4.0 curl --insecure -O https://gforge.inria.fr/frs/download.php/30387/CGAL-$version.tar.gz #4.0 - # 3.9 curl --insecure -O https://gforge.inria.fr/frs/download.php/29125/CGAL-$version.tar.gz #3.9 - # 3.8 curl --insecure -O https://gforge.inria.fr/frs/download.php/28500/CGAL-$version.tar.gz - # 3.7 curl --insecure -O https://gforge.inria.fr/frs/download.php/27641/CGAL-$version.tar.gz - fi - tar xf CGAL-$version.tar.bz2 + ver4_1="curl --insecure -O https://gforge.inria.fr/frs/download.php/31640/CGAL-4.1.tar.bz2" + ver4_0_2="curl --insecure -O https://gforge.inria.fr/frs/download.php/31174/CGAL-4.0.2.tar.bz2" + ver4_0="curl --insecure -O https://gforge.inria.fr/frs/download.php/30387/CGAL-4.0.tar.gz" + ver3_9="curl --insecure -O https://gforge.inria.fr/frs/download.php/29125/CGAL-3.9.tar.gz" + ver3_8="curl --insecure -O https://gforge.inria.fr/frs/download.php/28500/CGAL-3.8.tar.gz" + ver3_7="curl --insecure -O https://gforge.inria.fr/frs/download.php/27641/CGAL-3.7.tar.gz" + vernull="echo already downloaded..skipping" + download_cmd=ver`echo $version | sed s/"\."/"_"/` + if [ -e CGAL-$version.tar.gz ]; then download_cmd=vernull; fi + if [ -e CGAL-$version.tar.bz2 ]; then download_cmd=vernull; fi + `eval echo "$"$download_cmd` + if [ -e CGAL-$version.tar.gz ]; then tar xf CGAL-$version.tar.gz; fi + if [ -e CGAL-$version.tar.bz2 ]; then tar xf CGAL-$version.tar.bz2; fi cd CGAL-$version + + # older cmakes have buggy FindBoost that can result in + # finding the system libraries but OPENSCAD_LIBRARIES include paths + FINDBOOST_CMAKE=$OPENSCAD_SCRIPTDIR/../tests/FindBoost.cmake + cp $FINDBOOST_CMAKE ./cmake/modules/ + mkdir bin cd bin rm -rf ./* @@ -295,10 +310,13 @@ build_cgal() else CGAL_BUILDTYPE="Debug" fi + + DEBUGBOOSTFIND=0 # for debugging FindBoost.cmake (not for debugging boost) + Boost_NO_SYSTEM_PATHS=1 if [ "`echo $2 | grep use-sys-libs`" ]; then - cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DCMAKE_BUILD_TYPE=$CGAL_BUILDTYPE .. + cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DCMAKE_BUILD_TYPE=$CGAL_BUILDTYPE -DBoost_DEBUG=$DEBUGBOOSTFIND .. else - cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.so -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.so -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.so -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBOOST_ROOT=$DEPLOYDIR -DBoost_USE_MULTITHREADED=false -DCMAKE_BUILD_TYPE=$CGAL_BUILD_TYPE .. + cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.so -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.so -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.so -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBOOST_LIBRARYDIR=$DEPLOYDIR/lib -DBOOST_INCLUDEDIR=$DEPLOYDIR/include -DCMAKE_BUILD_TYPE=$CGAL_BUILD_TYPE -DBoost_DEBUG=$DEBUGBOOSTFIND -DBoost_NO_SYSTEM_PATHS=1 .. fi make -j$NUMCPU make install @@ -459,7 +477,11 @@ build_eigen() # the 'dirname' command installed if [ "`command -v dirname`" ]; then + RUNDIR=$PWD OPENSCAD_SCRIPTDIR=`dirname $0` + cd $OPENSCAD_SCRIPTDIR + OPENSCAD_SCRIPTDIR=$PWD + cd $RUNDIR else if [ ! -f openscad.pro ]; then echo "Must be run from the OpenSCAD source root directory (dont have 'dirname')" diff --git a/src/boosty.h b/src/boosty.h index 8b0c93e..82c765b 100644 --- a/src/boosty.h +++ b/src/boosty.h @@ -26,6 +26,7 @@ #include #include #include +#include namespace fs = boost::filesystem; #include "printutils.h" @@ -97,29 +98,33 @@ inline fs::path canonical( fs::path p ) inline fs::path canonical( fs::path p, fs::path p2 ) { - // dotpath: win32/mac builds will be using newer versions of boost - // so we can treat this as though it is unix only - const fs::path dot_path("."); - const fs::path dot_dot_path(".."); +#if defined (__WIN32__) || defined(__APPLE__) +#error you should be using a newer version of boost on win/mac +#endif + // based on the code in boost fs::path result; - if (p=="") + if (p=="") p=p2; + std::string result_s; + std::vector resultv, pieces; + std::vector::iterator pi; + std::string tmps = boosty::stringy( p ); + boost::split( pieces, tmps, boost::is_any_of("/") ); + for ( pi = pieces.begin(); pi != pieces.end(); ++pi ) + { + if (*pi == "..") + resultv.erase( resultv.end() ); + else + resultv.push_back( *pi ); + } + for ( pi = resultv.begin(); pi != resultv.end(); ++pi ) { - p=p2; + if ((*pi).length()>0) result_s = result_s + "/" + *pi; } - for (fs::path::iterator itr = p.begin(); itr != p.end(); itr++) + result = fs::path( result_s ); + if (fs::is_symlink(result)) { - if (*itr == dot_path) continue; - if (*itr == dot_dot_path) - { - result.remove_filename(); - continue; - } - result /= *itr; - if (fs::is_symlink(result)) - { - PRINT("WARNING: canonical() wrapper can't do symlinks. rebuild openscad with boost >=1.48"); - PRINT("WARNING: or don't use symbolic links"); - } + PRINT("WARNING: canonical() wrapper can't do symlinks. rebuild openscad with boost >=1.48"); + PRINT("WARNING: or don't use symbolic links"); } return result; } diff --git a/src/dxftess-glu.cc b/src/dxftess-glu.cc index 941dbed..3f87729 100644 --- a/src/dxftess-glu.cc +++ b/src/dxftess-glu.cc @@ -185,6 +185,17 @@ static bool point_on_line(double *p1, double *p2, double *p3) return true; } +typedef std::pair pair_ii; +inline void do_emplace( boost::unordered_multimap &tri_by_atan2, int ai, const pair_ii &indexes) +{ +#if BOOST_VERSION >= 104800 + tri_by_atan2.emplace(ai, indexes); +#else + std::pair< int, pair_ii > tmp( ai, indexes ); + tri_by_atan2.insert( tmp ); +#endif +} + /*! up: true if the polygon is facing in the normal direction (i.e. normal = [0,0,1]) rot: CLOCKWISE rotation around positive Z axis @@ -280,7 +291,7 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool do_trian for (int j = 0; j < 3; j++) { int ai = (int)round(atan2(fabs(tess_tri[i].p[(j+1)%3][0] - tess_tri[i].p[j][0]), fabs(tess_tri[i].p[(j+1)%3][1] - tess_tri[i].p[j][1])) / 0.001); - tri_by_atan2.emplace(ai, std::pair(i, j)); + do_emplace( tri_by_atan2, ai, std::pair(i, j) ); } while (added_triangles) { @@ -321,13 +332,13 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool do_trian for (int m = 0; m < 2; m++) { int ai = (int)round(atan2(fabs(tess_tri.back().p[(m+1)%3][0] - tess_tri.back().p[m][0]), fabs(tess_tri.back().p[(m+1)%3][1] - tess_tri.back().p[m][1])) / 0.001 ); - tri_by_atan2.emplace(ai, std::pair(tess_tri.size()-1, m)); + do_emplace(tri_by_atan2, ai, std::pair(tess_tri.size()-1, m)); } tess_tri[i].p[(k+1)%3] = tess_tri[j].p[l]; for (int m = 0; m < 2; m++) { int ai = (int)round(atan2(fabs(tess_tri[i].p[(m+1)%3][0] - tess_tri[i].p[m][0]), fabs(tess_tri[i].p[(m+1)%3][1] - tess_tri[i].p[m][1])) / 0.001 ); - tri_by_atan2.emplace(ai, std::pair(i, m)); + do_emplace(tri_by_atan2, ai, std::pair(i, m)); } added_triangles = true; } -- cgit v0.10.1 From ff050c37921e4fb20095dab97bb6b08c7ca68432 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Sun, 14 Apr 2013 01:07:39 -0500 Subject: add curl and imagemagick to get-dependency script for linux diff --git a/scripts/uni-get-dependencies.sh b/scripts/uni-get-dependencies.sh index 98170de..e2fdaa7 100755 --- a/scripts/uni-get-dependencies.sh +++ b/scripts/uni-get-dependencies.sh @@ -7,7 +7,8 @@ get_fedora_deps() { sudo yum install qt-devel bison flex eigen2-devel python-paramiko \ - boost-devel mpfr-devel gmp-devel glew-devel CGAL-devel gcc pkgconfig git libXmu-devel + boost-devel mpfr-devel gmp-devel glew-devel CGAL-devel gcc pkgconfig \ + git libXmu-devel curl imagemagick } get_qomo_deps() @@ -19,7 +20,7 @@ get_altlinux_deps() { for i in boost-devel boost-filesystem-devel gcc4.5 gcc4.5-c++ boost-program_options-devel \ boost-thread-devel boost-system-devel boost-regex-devel eigen2 libmpfr libgmp libgmp_cxx-devel qt4-devel libcgal-devel git-core \ - libglew-devel flex bison; do sudo apt-get install $i; done + libglew-devel flex bison curl imagemagick; do sudo apt-get install $i; done } get_freebsd_deps() @@ -27,19 +28,19 @@ get_freebsd_deps() pkg_add -r bison boost-libs cmake git bash eigen2 flex gmake gmp mpfr \ xorg libGLU libXmu libXi xorg-vfbserver glew \ qt4-corelib qt4-gui qt4-moc qt4-opengl qt4-qmake qt4-rcc qt4-uic \ - opencsg cgal + opencsg cgal curl imagemagick } get_netbsd_deps() { sudo pkgin install bison boost cmake git bash eigen flex gmake gmp mpfr \ - qt4 glew cgal opencsg modular-xorg python27 py27-paramiko + qt4 glew cgal opencsg modular-xorg python27 py27-paramiko curl imagemagick } get_opensuse_deps() { sudo zypper install libeigen2-devel mpfr-devel gmp-devel boost-devel \ - libqt4-devel glew-devel cmake git bison flex cgal-devel opencsg-devel + libqt4-devel glew-devel cmake git bison flex cgal-devel opencsg-devel curl } get_mageia_deps() @@ -56,7 +57,7 @@ get_debian_deps() libxmu-dev cmake bison flex git-core libboost-all-dev \ libXi-dev libmpfr-dev libboost-dev libglew-dev libeigen2-dev \ libeigen3-dev libcgal-dev libopencsg-dev libgmp3-dev libgmp-dev \ - python-paramiko ; do + python-paramiko curl imagemagick; do sudo apt-get -y install $pkg; done } -- cgit v0.10.1 From c5bdc40c26728dbcaa1bfb7f00e82b7448f32d62 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Sun, 14 Apr 2013 01:11:09 -0500 Subject: fix bug in cmake file cgal-flags when using clang diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fff537a..55b6924 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -354,7 +354,7 @@ if("${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}" VERSION_LESS 3.6) endif() inclusion(CGAL_DIR CGAL_INCLUDE_DIRS) -if(CMAKE_CXX_COMPILER MATCHES ".*clang.*") +if(CMAKE_CXX_COMPILER MATCHES ".*clang.*" AND NOT STREQUAL ${CGAL_CXX_FLAGS_INIT} "" ) string(REPLACE "-frounding-math" "" CGAL_CXX_FLAGS_INIT ${CGAL_CXX_FLAGS_INIT}) string(REPLACE "--param=ssp-buffer-size=4" "" CGAL_CXX_FLAGS_INIT ${CGAL_CXX_FLAGS_INIT}) endif() -- cgit v0.10.1 From c42dcfc614995863aaaf5197a298b8de486d1c1e Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 17 Apr 2013 17:27:49 -0400 Subject: Added missing highlighting of some special variables diff --git a/src/highlighter.cc b/src/highlighter.cc index 391e3a5..bf80bb4 100644 --- a/src/highlighter.cc +++ b/src/highlighter.cc @@ -151,7 +151,7 @@ Highlighter::Highlighter(QTextDocument *parent) tokentypes["import"] << "include" << "use" << "import_stl" << "import" << "import_dxf" << "dxf_dim" << "dxf_cross"; typeformats["import"].setForeground(Qt::darkYellow); - tokentypes["special"] << "$children" << "child" << "$fn" << "$fa" << "$fb"; + tokentypes["special"] << "$children" << "child" << "$fn" << "$fa" << "$fs" << "$t" << "$vpt" << "$vpr"; typeformats["special"].setForeground(Qt::darkGreen); tokentypes["extrude"] << "linear_extrude" << "rotate_extrude"; -- cgit v0.10.1 From 5cee6b58dd1589848518a628a79c582a7320a92e Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Thu, 18 Apr 2013 18:26:39 -0400 Subject: Test old parameter names for import diff --git a/testdata/scad/templates/import_dxf-tests-template.scad b/testdata/scad/templates/import_dxf-tests-template.scad index f10dd06..91eca7a 100644 --- a/testdata/scad/templates/import_dxf-tests-template.scad +++ b/testdata/scad/templates/import_dxf-tests-template.scad @@ -4,7 +4,7 @@ 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([0,200,0]) import(filename="../../dxf/multiple-layers.dxf", layername="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="@CMAKE_SOURCE_DIR@/../testdata/dxf/polygons.dxf"); -- cgit v0.10.1