diff options
-rw-r--r-- | openscad.pro.user | 9 | ||||
-rwxr-xr-x | scripts/macosx-build-dependencies.sh | 165 | ||||
-rw-r--r-- | src/PolySetCGALEvaluator.cc | 2 | ||||
-rw-r--r-- | src/dxfdata.cc | 8 | ||||
-rw-r--r-- | src/expr.cc | 4 | ||||
-rw-r--r-- | src/primitives.cc | 2 |
6 files changed, 136 insertions, 54 deletions
diff --git a/openscad.pro.user b/openscad.pro.user index 4bce49a..e53f571 100644 --- a/openscad.pro.user +++ b/openscad.pro.user @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE QtCreatorProject> -<!-- Written by Qt Creator 2.4.1, 2012-02-06T09:01:56. --> +<!-- Written by Qt Creator 2.4.1, 2012-02-09T21:15:55. --> <qtcreator> <data> <variable>ProjectExplorer.Project.ActiveTarget</variable> @@ -150,14 +150,17 @@ <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"> <value type="QString">OPENSCAD_LIBRARIES=$$PWD/../libraries/install</value> + <value type="QString">CCACHE_BASEDIR=$$PWD/..</value> + <value type="QString">PATH=/opt/local/libexec/ccache:/usr/bin:/Users/clothbot/QtSDK/Desktop/Qt/474/gcc/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin</value> + <value type="QString">EIGEN2DIR=$$PWD/../libraries/install/include/eigen2</value> </valuelist> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 4.7.4 for GCC (Qt SDK) Debug</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> - <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/Users/clothbot/Projects/github/clothbot/openscad-build-desktop</value> + <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/Users/clothbot/Projects/github/clothbot/openscad</value> <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">3</value> - <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> + <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value> </valuemap> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">INVALID</value> diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh index 5dabede..fada8c4 100755 --- a/scripts/macosx-build-dependencies.sh +++ b/scripts/macosx-build-dependencies.sh @@ -1,15 +1,16 @@ #!/bin/sh -e # # This script builds all library dependencies of OpenSCAD for Mac OS X. -# The libraries will be build in 32- and 64-bit mode and backwards compatible with -# 10.5 "Leopard". +# The libraries will be build in 64-bit (and optionally 32-bit mode) mode +# and backwards compatible with 10.5 "Leopard". # -# Usage: -# - Edit the BASEDIR variable. This is where libraries will be built and installed -# - Edit the OPENSCADDIR variable. This is where patches are fetched from +# This script must be run from the OpenSCAD source root directory +# +# Usage: macosx-build-dependencies.sh [-6] +# -6 Build only 64-bit binaries # # Prerequisites: -# - MacPorts: curl eigen +# - MacPorts: curl # - Qt4 # # FIXME: @@ -21,38 +22,57 @@ BASEDIR=$PWD/../libraries OPENSCADDIR=$PWD SRCDIR=$BASEDIR/src DEPLOYDIR=$BASEDIR/install +MAC_OSX_VERSION_MIN=10.5 +OPTION_32BIT=true + +printUsage() +{ + echo "Usage: $0 [-6]" + echo + echo " -6 Build only 64-bit binaries" +} # Hack warning: gmplib is built separately in 32-bit and 64-bit mode -# and then merged afterwards. gmplib's header files are dependant on +# and then merged afterwards. gmplib's header files are dependent on # the CPU architecture on which configure was run and will be patched accordingly. build_gmp() { version=$1 echo "Building gmp" $version "..." cd $BASEDIR/src - rm -rf gmp* - curl -O ftp://ftp.gmplib.org/pub/gmp-$version/gmp-$version.tar.bz2 + rm -rf gmp-$version + if [ ! -f gmp-$version.tar.bz2 ]; then + curl -O ftp://ftp.gmplib.org/pub/gmp-$version/gmp-$version.tar.bz2 + fi tar xjf gmp-$version.tar.bz2 cd gmp-$version - # 32-bit version - mkdir build-i386 - cd build-i386 - ../configure --prefix=$DEPLOYDIR/i386 "CFLAGS=-mmacosx-version-min=10.5 -arch i386" LDFLAGS="-mmacosx-version-min=10.5 -arch i386" ABI=32 --enable-cxx - make install - cd .. + if $OPTION_32BIT; then + mkdir build-i386 + cd build-i386 + ../configure --prefix=$DEPLOYDIR/i386 "CFLAGS=-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386" LDFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386" ABI=32 --enable-cxx + make install + cd .. + fi + # 64-bit version mkdir build-x86_64 cd build-x86_64 - ../configure --prefix=$DEPLOYDIR/x86_64 "CFLAGS=-mmacosx-version-min=10.5 -arch x86_64" LDFLAGS="-mmacosx-version-min=10.5 -arch x86_64" ABI=64 --enable-cxx + ../configure --prefix=$DEPLOYDIR/x86_64 "CFLAGS=-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64" LDFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64" ABI=64 --enable-cxx make install # merge cd $DEPLOYDIR mkdir -p lib - lipo -create i386/lib/libgmp.dylib x86_64/lib/libgmp.dylib -output lib/libgmp.dylib + if $OPTION_32BIT; then + lipo -create i386/lib/libgmp.dylib x86_64/lib/libgmp.dylib -output lib/libgmp.dylib + else + cp x86_64/lib/libgmp.dylib lib/libgmp.dylib + fi install_name_tool -id $DEPLOYDIR/lib/libgmp.dylib lib/libgmp.dylib - cp lib/libgmp.dylib i386/lib/ - cp lib/libgmp.dylib x86_64/lib/ + if $OPTION_32BIT; then + cp lib/libgmp.dylib i386/lib/ + cp lib/libgmp.dylib x86_64/lib/ + fi mkdir -p include cp x86_64/include/gmp.h include/ cp x86_64/include/gmpxx.h include/ @@ -101,27 +121,34 @@ build_mpfr() version=$1 echo "Building mpfr" $version "..." cd $BASEDIR/src - rm -rf mpfr* - curl -O http://www.mpfr.org/mpfr-current/mpfr-$version.tar.bz2 + rm -rf mpfr-$version + if [ ! -f mpfr-$version.tar.bz2 ]; then + curl -O http://www.mpfr.org/mpfr-current/mpfr-$version.tar.bz2 + fi tar xjf mpfr-$version.tar.bz2 cd mpfr-$version - # 32-bit version - mkdir build-i386 - cd build-i386 - ../configure --prefix=$DEPLOYDIR/i386 --with-gmp=$DEPLOYDIR/i386 CFLAGS="-mmacosx-version-min=10.5 -arch i386" LDFLAGS="-mmacosx-version-min=10.5 -arch i386" - make install - cd .. + if $OPTION_32BIT; then + mkdir build-i386 + cd build-i386 + ../configure --prefix=$DEPLOYDIR/i386 --with-gmp=$DEPLOYDIR/i386 CFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386" LDFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386" + make install + cd .. + fi # 64-bit version mkdir build-x86_64 cd build-x86_64 - ../configure --prefix=$DEPLOYDIR/x86_64 --with-gmp=$DEPLOYDIR/x86_64 CFLAGS="-mmacosx-version-min=10.5 -arch x86_64" LDFLAGS="-mmacosx-version-min=10.5 -arch x86_64" + ../configure --prefix=$DEPLOYDIR/x86_64 --with-gmp=$DEPLOYDIR/x86_64 CFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64" LDFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64" make install # merge cd $DEPLOYDIR - lipo -create i386/lib/libmpfr.dylib x86_64/lib/libmpfr.dylib -output lib/libmpfr.dylib + if $OPTION_32BIT; then + lipo -create i386/lib/libmpfr.dylib x86_64/lib/libmpfr.dylib -output lib/libmpfr.dylib + else + cp x86_64/lib/libmpfr.dylib lib/libmpfr.dylib + fi install_name_tool -id $DEPLOYDIR/lib/libmpfr.dylib lib/libmpfr.dylib mkdir -p include cp x86_64/include/mpfr.h include/ @@ -135,13 +162,18 @@ build_boost() bversion=`echo $version | tr "." "_"` echo "Building boost" $version "..." cd $BASEDIR/src - rm -rf boost* - curl -LO http://downloads.sourceforge.net/project/boost/boost/$version/boost_$bversion.tar.bz2 + rm -rf boost_$bversion + if [ ! -f boost_$bversion.tar.bz2 ]; then + curl -LO http://downloads.sourceforge.net/project/boost/boost/$version/boost_$bversion.tar.bz2 + fi 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,system,regex - ./bjam cflags="-mmacosx-version-min=10.5 -arch i386 -arch x86_64" linkflags="-mmacosx-version-min=10.5 -arch i386 -arch x86_64" + if $OPTION_32BIT; then + BOOST_EXTRA_FLAGS="-arch i386" + fi + ./bjam cflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64 $BOOST_EXTRA_FLAGS" linkflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64 $BOOST_EXTRA_FLAGS" ./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 @@ -158,14 +190,19 @@ build_cgal() version=$1 echo "Building CGAL" $version "..." cd $BASEDIR/src - rm -rf CGAL* - curl -O https://gforge.inria.fr/frs/download.php/29125/CGAL-$version.tar.gz -# curl -O https://gforge.inria.fr/frs/download.php/28500/CGAL-$version.tar.gz -# curl -O https://gforge.inria.fr/frs/download.php/27641/CGAL-$version.tar.gz + rm -rf CGAL-$version + if [ ! -f CGAL-$version.tar.gz ]; then + curl -O https://gforge.inria.fr/frs/download.php/29125/CGAL-$version.tar.gz + # curl -O https://gforge.inria.fr/frs/download.php/28500/CGAL-$version.tar.gz + # curl -O https://gforge.inria.fr/frs/download.php/27641/CGAL-$version.tar.gz + fi tar xzf CGAL-$version.tar.gz cd CGAL-$version + if $OPTION_32BIT; then + CGAL_EXTRA_FLAGS=";i386" + fi # We build a static lib. Not really necessary, but it's well tested. - cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.dylib -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.dylib -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBUILD_SHARED_LIBS=FALSE -DCMAKE_OSX_DEPLOYMENT_TARGET="10.5" -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" -DBOOST_ROOT=$DEPLOYDIR + cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.dylib -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.dylib -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBUILD_SHARED_LIBS=FALSE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="x86_64$CGAL_EXTRA_FLAGS" -DBOOST_ROOT=$DEPLOYDIR make -j4 make install } @@ -175,14 +212,19 @@ build_glew() version=$1 echo "Building GLEW" $version "..." cd $BASEDIR/src - rm -rf glew-* - curl -LO http://downloads.sourceforge.net/project/glew/glew/$version/glew-$version.tgz + rm -rf glew-$version + if [ ! -f glew-$version.tgz ]; then + curl -LO http://downloads.sourceforge.net/project/glew/glew/$version/glew-$version.tgz + fi tar xzf glew-$version.tgz cd glew-$version mkdir -p $DEPLOYDIR/lib/pkgconfig # To avoid running strip on a fat archive as this is not supported by strip sed -i bak -e "s/\$(STRIP) -x lib\/\$(LIB.STATIC)//" Makefile - make GLEW_DEST=$DEPLOYDIR CFLAGS.EXTRA="-no-cpp-precomp -dynamic -fno-common -mmacosx-version-min=10.5 -arch i386 -arch x86_64" LDFLAGS.EXTRA="-mmacosx-version-min=10.5 -arch i386 -arch x86_64" install + if $OPTION_32BIT; then + GLEW_EXTRA_FLAGS="-arch i386" + fi + make GLEW_DEST=$DEPLOYDIR CFLAGS.EXTRA="-no-cpp-precomp -dynamic -fno-common -mmacosx-version-min=$MAC_OSX_VERSION_MIN $GLEW_EXTRA_FLAGS -arch x86_64" LDFLAGS.EXTRA="-mmacosx-version-min=$MAC_OSX_VERSION_MIN $GLEW_EXTRA_FLAGS -arch x86_64" install } build_opencsg() @@ -191,11 +233,40 @@ build_opencsg() echo "Building OpenCSG" $version "..." cd $BASEDIR/src rm -rf OpenCSG-$version - curl -O http://www.opencsg.org/OpenCSG-$version.tar.gz + if [ ! -f OpenCSG-$version.tar.gz ]; then + curl -O http://www.opencsg.org/OpenCSG-$version.tar.gz + fi tar xzf OpenCSG-$version.tar.gz cd OpenCSG-$version patch -p1 < $OPENSCADDIR/patches/OpenCSG-$version-MacOSX-port.patch - OPENSCAD_LIBRARIES=$DEPLOYDIR qmake -r CONFIG+="x86 x86_64" + if $OPTION_32BIT; then + OPENCSG_EXTRA_FLAGS="x86" + fi + OPENSCAD_LIBRARIES=$DEPLOYDIR qmake -r CONFIG+="x86_64 $OPENCSG_EXTRA_FLAGS" + make install +} + +build_eigen() +{ + version=$1 + echo "Building eigen" $version "..." + cd $BASEDIR/src + rm -rf eigen-$version + ## Directory name for v2.0.17 + rm -rf eigen-eigen-b23437e61a07 + if [ ! -f eigen-$version.tar.bz2 ]; then + curl -LO http://bitbucket.org/eigen/eigen/get/$version.tar.bz2 + mv $version.tar.bz2 eigen-$version.tar.bz2 + fi + tar xjf eigen-$version.tar.bz2 + ## File name for v2.0.17 + ln -s eigen-eigen-b23437e61a07 eigen-$version + cd eigen-$version + if $OPTION_32BIT; then + EIGEN_EXTRA_FLAGS=";i386" + fi + cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DEIGEN_BUILD_LIB=ON -DBUILD_SHARED_LIBS=FALSE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="x86_64$EIGEN_EXTRA_FLAGS" + make -j4 make install } @@ -204,9 +275,17 @@ if [ ! -f $OPENSCADDIR/openscad.pro ]; then exit 0 fi +while getopts '6' c +do + case $c in + 6) OPTION_32BIT=false + esac +done + echo "Using basedir:" $BASEDIR mkdir -p $SRCDIR $DEPLOYDIR -build_gmp 5.0.3 +build_eigen 2.0.17 +build_gmp 5.0.4 build_mpfr 3.1.0 build_boost 1.47.0 # NB! For CGAL, also update the actual download URL in the function diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc index c1bdea4..81ae31e 100644 --- a/src/PolySetCGALEvaluator.cc +++ b/src/PolySetCGALEvaluator.cc @@ -108,7 +108,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node) // in the XY plane, causing the resulting 2D polygon to be self-intersection // and cause a crash in CGALEvaluator::PolyReducer. The right solution is to // filter these polygons here. kintel 20120203. - Grid2d<int> conversion_grid(GRID_COARSE); + Grid2d<unsigned int> conversion_grid(GRID_COARSE); for (size_t i = 0; i < ps3->polygons.size(); i++) { for (size_t j = 0; j < ps3->polygons[i].size(); j++) { double x = ps3->polygons[i][j][0]; diff --git a/src/dxfdata.cc b/src/dxfdata.cc index 52493ac..2b84f7e 100644 --- a/src/dxfdata.cc +++ b/src/dxfdata.cc @@ -518,7 +518,7 @@ void DxfData::fixup_path_direction() break; this->paths[i].is_inner = true; double min_x = this->points[this->paths[i].indices[0]][0]; - int min_x_point = 0; + size_t min_x_point = 0; for (size_t j = 1; j < this->paths[i].indices.size(); j++) { if (this->points[this->paths[i].indices[j]][0] < min_x) { min_x = this->points[this->paths[i].indices[j]][0]; @@ -526,9 +526,9 @@ void DxfData::fixup_path_direction() } } // rotate points if the path is in non-standard rotation - int b = min_x_point; - int a = b == 0 ? this->paths[i].indices.size() - 2 : b - 1; - int c = b == this->paths[i].indices.size() - 1 ? 1 : b + 1; + size_t b = min_x_point; + size_t a = b == 0 ? this->paths[i].indices.size() - 2 : b - 1; + size_t c = b == this->paths[i].indices.size() - 1 ? 1 : b + 1; double ax = this->points[this->paths[i].indices[a]][0] - this->points[this->paths[i].indices[b]][0]; double ay = this->points[this->paths[i].indices[a]][1] - this->points[this->paths[i].indices[b]][1]; double cx = this->points[this->paths[i].indices[c]][0] - this->points[this->paths[i].indices[b]][0]; diff --git a/src/expr.cc b/src/expr.cc index 66a0d11..671553c 100644 --- a/src/expr.cc +++ b/src/expr.cc @@ -86,8 +86,8 @@ Value Expression::evaluate(const Context *context) const return *v1.vec[i]; } if (v1.type == Value::STRING && v2.type == Value::NUMBER) { - int i = int(v2.num); - if (i >= 0 && i < v1.text.size()) + unsigned int i = int(v2.num); + if (i < v1.text.size()) return Value(v1.text.substr(i, 1)); } return Value(); diff --git a/src/primitives.cc b/src/primitives.cc index feaa1a4..ce52550 100644 --- a/src/primitives.cc +++ b/src/primitives.cc @@ -530,7 +530,7 @@ sphere_next_r2: { dd.paths.push_back(DxfData::Path()); for (size_t j=0; j<this->paths.vec[i]->vec.size(); j++) { - int idx = this->paths.vec[i]->vec[j]->num; + unsigned int idx = this->paths.vec[i]->vec[j]->num; if (idx < dd.points.size()) { dd.paths.back().indices.push_back(idx); } |