summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/uni-build-dependencies.sh46
-rw-r--r--src/boosty.h43
-rw-r--r--src/dxftess-glu.cc17
3 files changed, 72 insertions, 34 deletions
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 <string>
#include <boost/version.hpp>
#include <boost/filesystem.hpp>
+#include <boost/algorithm/string.hpp>
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<std::string> resultv, pieces;
+ std::vector<std::string>::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<int,int> pair_ii;
+inline void do_emplace( boost::unordered_multimap<int, pair_ii> &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<int,int>(i, j));
+ do_emplace( tri_by_atan2, ai, std::pair<int,int>(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<int,int>(tess_tri.size()-1, m));
+ do_emplace(tri_by_atan2, ai, std::pair<int,int>(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<int,int>(i, m));
+ do_emplace(tri_by_atan2, ai, std::pair<int,int>(i, m));
}
added_triangles = true;
}
contact: Jan Huwald // Impressum