From 45e4c1012336a0b5149aa4b34763cbe0d344ba15 Mon Sep 17 00:00:00 2001 From: Brad Pitcher Date: Sun, 5 Feb 2012 05:14:35 +0800 Subject: Fix linux releases diff --git a/scripts/chrpath_linux.c b/scripts/chrpath_linux.c index 685913c..28e3a5e 100644 --- a/scripts/chrpath_linux.c +++ b/scripts/chrpath_linux.c @@ -107,9 +107,6 @@ /* Define to the version of this package. */ #define PACKAGE_VERSION ""0.13"" -/* The size of a `void *', as computed by sizeof. */ -#define SIZEOF_VOID_P 4 - /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 diff --git a/scripts/installer-linux.sh b/scripts/installer-linux.sh new file mode 100755 index 0000000..8b3fc6d --- /dev/null +++ b/scripts/installer-linux.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# change to the install source directory +cd "$( dirname "$( type -p $0 )" )" + +if ! [ -f bin/openscad -a -d lib/openscad -a -d examples -a -d libraries ]; then + echo "Error: Can't change to install source directory!" >&2 + exit 1 +fi + +echo "This will install openscad. Please enter the install prefix" +echo "or press Ctrl-C to abort the install process:" +read -p "[/usr/local]: " prefix + +if [ "$prefix" = "" ]; then + prefix="/usr/local" +fi + +if [ ! -d "$prefix" ]; then + echo; echo "Install prefix \`$prefix' does not exist. Press ENTER to continue" + echo "or press Ctrl-C to abort the install process:" + read -p "press enter to continue> " +fi + +mkdir -p "$prefix"/{bin,lib/openscad,share/openscad/examples,share/openscad/libraries} + +if ! [ -w "$prefix"/bin/ -a -w "$prefix"/lib/openscad -a -w "$prefix"/share/openscad ]; then + echo "You does not seam to have write permissions for prefix \`$prefix'!" >&2 + echo "Maybe you should have run this install script using \`sudo'?" >&2 + exit 1 +fi + +echo "Copying application wrappers..." +cp -rv bin/. "$prefix"/bin/ + +echo "Copying application..." +cp -rv lib/. "$prefix"/lib/ + +echo "Copying examples..." +cp -rv examples/. "$prefix"/share/openscad/examples/ + +echo "Copying libraries..." +cp -rv libraries/. "$prefix"/share/openscad/libraries/ + +echo "Installation finished. Have a nice day." diff --git a/scripts/openscad-linux b/scripts/openscad-linux new file mode 100755 index 0000000..1246199 --- /dev/null +++ b/scripts/openscad-linux @@ -0,0 +1,8 @@ +#!/bin/bash + +cd "$( dirname "$( type -p $0 )" )" +libdir=$PWD/../lib/openscad/ +cd "$OLDPWD" + +export LD_LIBRARY_PATH="$libdir${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" +exec $libdir/openscad "$@" diff --git a/scripts/release-common.sh b/scripts/release-common.sh index 72ae29c..80c9795 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # This script creates a binary release of OpenSCAD. # This should work under Mac OS X, Windows (msys), and Linux cross-compiling @@ -24,10 +24,20 @@ printUsage() echo " Example: $0 -v 2010.01 } -if [[ $OSTYPE =~ "darwin" ]]; then +if [[ "$OSTYPE" =~ "darwin" ]]; then OS=MACOSX elif [[ $OSTYPE == "msys" ]]; then OS=WIN +elif [[ $OSTYPE == "linux-gnu" ]]; then + OS=LINUX + if [[ `uname -m` == "x86_64" ]]; then + ARCH=64 + else + ARCH=32 + fi + echo "Detected ARCH: $ARCH" +elif [[ $OSTYPE == "mingw-cross-env" ]]; then + OS=LINXWIN fi echo "Detected OS: $OS" @@ -47,7 +57,7 @@ fi echo "Building openscad-$VERSION $CONFIGURATION..." case $OS in - MACOSX) + LINUX|MACOSX) CONFIG=deploy TARGET= ;; @@ -83,7 +93,7 @@ case $OS in rm -rf OpenSCAD.app ;; WIN) - #if the following files are missing their tried removal stops the build process on msys + #if the following files are missing their tried removal stops the build process on msys touch -t 200012121010 parser_yacc.h parser_yacc.cpp lexer_lex.cpp ;; esac @@ -158,4 +168,24 @@ case $OS in echo "Binary created: OpenSCAD-$VERSION.zip" echo "Installer created: OpenSCAD-$VERSION-Installer.exe" ;; + LINUX) + # Do stuff from release-linux.sh + mkdir openscad-$VERSION/bin + mkdir -p openscad-$VERSION/lib/openscad + cp scripts/openscad-linux openscad-$VERSION/bin/openscad + cp openscad openscad-$VERSION/lib/openscad/ + if [[ $ARCH == 64 ]]; then + gcc -o chrpath_linux -DSIZEOF_VOID_P=8 scripts/chrpath_linux.c + else + gcc -o chrpath_linux -DSIZEOF_VOID_P=4 scripts/chrpath_linux.c + fi + ./chrpath_linux -d openscad-$VERSION/lib/openscad/openscad + ldd openscad | sed -re 's,.* => ,,; s,[\t ].*,,;' -e '/Qt|boost/ { p; d; };' \ + -e '/lib(icu.*|stdc.*|audio|CGAL|GLEW|opencsg|png|gmp|gmpxx|mpfr)\.so/ { p; d; };' \ + -e 'd;' | xargs cp -vt openscad-$VERSION/lib/openscad/ + 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 + ;; esac diff --git a/scripts/release-linux.sh b/scripts/release-linux.sh deleted file mode 100755 index e1eb001..0000000 --- a/scripts/release-linux.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash -# WARNING: This script might only work with the authors setup... - -VERSION=`date "+%Y.%m.%d"` -#VERSION=2011.12 - -set -ex - -# svnclean - -qmake-qt4 VERSION=$VERSION QMAKE_CXXFLAGS_RELEASE="-O3 -march=pentium" -make - -rm -rf release -mkdir -p release/{bin,lib/openscad,examples,libraries} - -cat > release/bin/openscad << "EOT" -#!/bin/bash - -cd "$( dirname "$( type -p $0 )" )" -libdir=$PWD/../lib/openscad/ -cd "$OLDPWD" - -export LD_LIBRARY_PATH="$libdir${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" -exec $libdir/openscad "$@" -EOT - -cp openscad release/lib/openscad/ -gcc -o chrpath_linux scripts/chrpath_linux.c -./chrpath_linux -d release/lib/openscad/openscad - -ldd openscad | sed -re 's,.* => ,,; s,[\t ].*,,;' -e '/Qt|boost/ { p; d; };' \ - -e '/lib(audio|CGAL|GLEW|opencsg|png|gmp|gmpxx|mpfr)\.so/ { p; d; };' \ - -e 'd;' | xargs cp -vt release/lib/openscad/ -strip release/lib/openscad/* - -cat > release/install.sh << "EOT" -#!/bin/bash - -# change to the install source directory -cd "$( dirname "$( type -p $0 )" )" - -if ! [ -f bin/openscad -a -d lib/openscad -a -d examples -a -d libraries ]; then - echo "Error: Can't change to install source directory!" >&2 - exit 1 -fi - -echo "This will install openscad. Please enter the install prefix" -echo "or press Ctrl-C to abort the install process:" -read -p "[/usr/local]: " prefix - -if [ "$prefix" = "" ]; then - prefix="/usr/local" -fi - -if [ ! -d "$prefix" ]; then - echo; echo "Install prefix \`$prefix' does not exist. Press ENTER to continue" - echo "or press Ctrl-C to abort the install process:" - read -p "press enter to continue> " -fi - -mkdir -p "$prefix"/{bin,lib/openscad,share/openscad/examples,share/openscad/libraries} - -if ! [ -w "$prefix"/bin/ -a -w "$prefix"/lib/openscad -a -w "$prefix"/share/openscad ]; then - echo "You does not seam to have write permissions for prefix \`$prefix'!" >&2 - echo "Maybe you should have run this install script using \`sudo'?" >&2 - exit 1 -fi - -echo "Copying application wrappers..." -cp -rv bin/. "$prefix"/bin/ - -echo "Copying application..." -cp -rv lib/. "$prefix"/lib/ - -echo "Copying examples..." -cp -rv examples/. "$prefix"/share/openscad/examples/ - -echo "Copying libraries..." -cp -rv libraries/. "$prefix"/share/openscad/libraries/ - -echo "Installation finished. Have a nice day." -EOT - -chmod 755 -R release/ - -cp examples/* release/examples/ -chmod 644 -R release/examples/* - -cp -R libraries/* release/libraries/ -chmod -R u=rwx,go=r,+X release/libraries/* -rm -rf `find release/libraries -name ".git"` -- cgit v0.10.1 From 99633dd0da51d5797599101343c1513647b890cc Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Wed, 8 Feb 2012 15:07:55 -0500 Subject: Conditionally download bundles if they don't exist. Saves having to re-download the bundles every time, assuming downloaded successfully the (N-1)th time. diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh index 4bcafd3..34f9215 100755 --- a/scripts/macosx-build-dependencies.sh +++ b/scripts/macosx-build-dependencies.sh @@ -30,8 +30,10 @@ 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 @@ -101,8 +103,10 @@ 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 @@ -135,8 +139,10 @@ 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 @@ -158,10 +164,12 @@ 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 # We build a static lib. Not really necessary, but it's well tested. @@ -175,8 +183,10 @@ build_glew() version=$1 echo "Building GLEW" $version "..." cd $BASEDIR/src - rm -r 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 @@ -191,7 +201,9 @@ 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 @@ -199,6 +211,11 @@ build_opencsg() make install } +if [ ! -f $OPENSCADDIR/openscad.pro ]; then + echo "Must be run from the OpenSCAD source root directory" + exit 0 +fi + echo "Using basedir:" $BASEDIR mkdir -p $SRCDIR $DEPLOYDIR build_gmp 5.0.3 -- cgit v0.10.1 From fa5a012c7c66bec74d3903ee4462107c37407f33 Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Thu, 9 Feb 2012 10:40:10 -0500 Subject: Adding CCACHE_BASEDIR & PATH update. Explicitly added CC_CACHE_BASEDIR and prepended /opt/local/libexec/ccache to PATH as per setenv_mjau.sh settings. diff --git a/openscad.pro.user b/openscad.pro.user index 4bce49a..c96e00a 100644 --- a/openscad.pro.user +++ b/openscad.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget @@ -150,6 +150,8 @@ false OPENSCAD_LIBRARIES=$$PWD/../libraries/install + CCACHE_BASEDIR=$$PWD/.. + PATH=/opt/local/libexec/ccache:/usr/bin:/Users/clothbot/QtSDK/Desktop/Qt/474/gcc/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin Desktop Qt 4.7.4 for GCC (Qt SDK) Debug -- cgit v0.10.1 From c653a961dd8c19cd4ed4c0ebbb5a1df59693f332 Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Thu, 9 Feb 2012 21:19:27 -0500 Subject: Parametrized version-min and added eigen2. - Made "macosx-version-min" set via MAC_OSX_VERSION_MIN variable. - Added build-deps for eigen2 - Added EIGEN2DIR to openscad.pro.user - Unchecked "Use Shadow Build" to build OpenSCAD.app in project directory. diff --git a/openscad.pro.user b/openscad.pro.user index c96e00a..e53f571 100644 --- a/openscad.pro.user +++ b/openscad.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget @@ -152,14 +152,15 @@ OPENSCAD_LIBRARIES=$$PWD/../libraries/install CCACHE_BASEDIR=$$PWD/.. PATH=/opt/local/libexec/ccache:/usr/bin:/Users/clothbot/QtSDK/Desktop/Qt/474/gcc/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin + EIGEN2DIR=$$PWD/../libraries/install/include/eigen2 Desktop Qt 4.7.4 for GCC (Qt SDK) Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - /Users/clothbot/Projects/github/clothbot/openscad-build-desktop + /Users/clothbot/Projects/github/clothbot/openscad 3 - true + false INVALID diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh index 34f9215..385d603 100755 --- a/scripts/macosx-build-dependencies.sh +++ b/scripts/macosx-build-dependencies.sh @@ -21,6 +21,7 @@ BASEDIR=$PWD/../libraries OPENSCADDIR=$PWD SRCDIR=$BASEDIR/src DEPLOYDIR=$BASEDIR/install +MAC_OSX_VERSION_MIN=10.7 # Hack warning: gmplib is built separately in 32-bit and 64-bit mode # and then merged afterwards. gmplib's header files are dependant on @@ -39,13 +40,13 @@ build_gmp() # 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 + ../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 .. # 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 @@ -113,14 +114,14 @@ build_mpfr() # 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" + ../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 .. # 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 @@ -147,7 +148,7 @@ build_boost() 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" + ./bjam cflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386 -arch x86_64" linkflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -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 @@ -173,7 +174,7 @@ build_cgal() tar xzf CGAL-$version.tar.gz cd CGAL-$version # 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="i386;x86_64" -DBOOST_ROOT=$DEPLOYDIR make -j4 make install } @@ -192,7 +193,7 @@ build_glew() 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 + make GLEW_DEST=$DEPLOYDIR CFLAGS.EXTRA="-no-cpp-precomp -dynamic -fno-common -mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386 -arch x86_64" LDFLAGS.EXTRA="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386 -arch x86_64" install } build_opencsg() @@ -211,13 +212,36 @@ build_opencsg() 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 + cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DEIGEN_BUILD_LIB=ON -DBUILD_SHARED_LIBS=FALSE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" + make -j4 + make install +} + if [ ! -f $OPENSCADDIR/openscad.pro ]; then echo "Must be run from the OpenSCAD source root directory" exit 0 fi echo "Using basedir:" $BASEDIR +rm -rf $DEPLOYDIR mkdir -p $SRCDIR $DEPLOYDIR +build_eigen 2.0.17 build_gmp 5.0.3 build_mpfr 3.1.0 build_boost 1.47.0 -- cgit v0.10.1 From e1134e06f43a090589d70f272293c518d89888a8 Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Sun, 12 Feb 2012 12:55:30 -0500 Subject: Build Deps for 64-bit only mac osx To work with QtSDK 4.7.4 and more current versions of Mac OS X. diff --git a/scripts/macosx-build-dependencies-64bit.sh b/scripts/macosx-build-dependencies-64bit.sh new file mode 100755 index 0000000..7d411de --- /dev/null +++ b/scripts/macosx-build-dependencies-64bit.sh @@ -0,0 +1,251 @@ +#!/bin/sh -e +# +# This script builds all library dependencies of OpenSCAD for Mac OS X. +# The libraries will be build in 64-bit mode and backwards compatible with +# 10.6 +# +# 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 +# +# Prerequisites: +# - MacPorts: curl eigen +# - Qt4 +# +# FIXME: +# o Verbose option +# o Port to other platforms? +# + +BASEDIR=$PWD/../libraries +OPENSCADDIR=$PWD +SRCDIR=$BASEDIR/src +DEPLOYDIR=$BASEDIR/install +MAC_OSX_VERSION_MIN=10.6 + +# Hack warning: gmplib is built separately in 32-bit and 64-bit mode +# and then merged afterwards. gmplib's header files are dependant 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-$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=$MAC_OSX_VERSION_MIN -arch i386" LDFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386" ABI=32 --enable-cxx + make install + cd .. + # 64-bit version + mkdir build-x86_64 + cd build-x86_64 + ../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 + install_name_tool -id $DEPLOYDIR/lib/libgmp.dylib lib/libgmp.dylib + cp lib/libgmp.dylib i386/lib/ + cp lib/libgmp.dylib x86_64/lib/ + mkdir -p include + cp x86_64/include/gmp.h include/ + cp x86_64/include/gmpxx.h include/ + + patch -p0 include/gmp.h << EOF +--- gmp.h.orig 2011-11-08 01:03:41.000000000 +0100 ++++ gmp.h 2011-11-08 01:06:21.000000000 +0100 +@@ -26,12 +26,28 @@ + #endif + + +-/* Instantiated by configure. */ +-#if ! defined (__GMP_WITHIN_CONFIGURE) ++#if defined(__i386__) ++#define __GMP_HAVE_HOST_CPU_FAMILY_power 0 ++#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 0 ++#define GMP_LIMB_BITS 32 ++#define GMP_NAIL_BITS 0 ++#elif defined(__x86_64__) + #define __GMP_HAVE_HOST_CPU_FAMILY_power 0 + #define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 0 + #define GMP_LIMB_BITS 64 + #define GMP_NAIL_BITS 0 ++#elif defined(__ppc__) ++#define __GMP_HAVE_HOST_CPU_FAMILY_power 0 ++#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 1 ++#define GMP_LIMB_BITS 32 ++#define GMP_NAIL_BITS 0 ++#elif defined(__powerpc64__) ++#define __GMP_HAVE_HOST_CPU_FAMILY_power 0 ++#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 1 ++#define GMP_LIMB_BITS 64 ++#define GMP_NAIL_BITS 0 ++#else ++#error Unsupported architecture + #endif + #define GMP_NUMB_BITS (GMP_LIMB_BITS - GMP_NAIL_BITS) + #define GMP_NUMB_MASK ((~ __GMP_CAST (mp_limb_t, 0)) >> GMP_NAIL_BITS) +EOF +} + +# As with gmplib, mpfr is built separately in 32-bit and 64-bit mode and then merged +# afterwards. +build_mpfr() +{ + version=$1 + echo "Building mpfr" $version "..." + 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 + 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=$MAC_OSX_VERSION_MIN -arch i386" LDFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386" + make install + cd .. + + # 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=$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 + install_name_tool -id $DEPLOYDIR/lib/libmpfr.dylib lib/libmpfr.dylib + mkdir -p include + cp x86_64/include/mpfr.h include/ + cp x86_64/include/mpf2mpfr.h include/ +} + + +build_boost() +{ + version=$1 + bversion=`echo $version | tr "." "_"` + echo "Building boost" $version "..." + cd $BASEDIR/src + 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=$MAC_OSX_VERSION_MIN -arch i386 -arch x86_64" linkflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -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 -change libboost_system.dylib $DEPLOYDIR/lib/libboost_system.dylib $DEPLOYDIR/lib/libboost_filesystem.dylib + install_name_tool -id $DEPLOYDIR/lib/libboost_system.dylib $DEPLOYDIR/lib/libboost_system.dylib + install_name_tool -id $DEPLOYDIR/lib/libboost_regex.dylib $DEPLOYDIR/lib/libboost_regex.dylib + + +} + +build_cgal() +{ + version=$1 + echo "Building CGAL" $version "..." + cd $BASEDIR/src + 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 + # 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="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" -DBOOST_ROOT=$DEPLOYDIR + make -j4 + make install +} + +build_glew() +{ + version=$1 + echo "Building GLEW" $version "..." + cd $BASEDIR/src + 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=$MAC_OSX_VERSION_MIN -arch i386 -arch x86_64" LDFLAGS.EXTRA="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386 -arch x86_64" install +} + +build_opencsg() +{ + version=$1 + echo "Building OpenCSG" $version "..." + cd $BASEDIR/src + rm -rf OpenCSG-$version + 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" + 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 + cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DEIGEN_BUILD_LIB=ON -DBUILD_SHARED_LIBS=FALSE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" + make -j4 + make install +} + +if [ ! -f $OPENSCADDIR/openscad.pro ]; then + echo "Must be run from the OpenSCAD source root directory" + exit 0 +fi + +echo "Using basedir:" $BASEDIR +rm -rf $DEPLOYDIR +mkdir -p $SRCDIR $DEPLOYDIR +build_eigen 2.0.17 +build_gmp 5.0.3 +build_mpfr 3.1.0 +build_boost 1.47.0 +# NB! For CGAL, also update the actual download URL in the function +build_cgal 3.9 +build_glew 1.7.0 +build_opencsg 1.3.2 -- cgit v0.10.1 From b633845e55c1733ecd9fa4a01606fd7bdafacc48 Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Mon, 13 Feb 2012 11:22:06 -0500 Subject: EIGEN2DIR and MAC_OSX_VERSION_MIN Defining EIGEN2DIR in setenv. Set MAC_OSX_VERSION_MIN=10.5. diff --git a/scripts/macosx-build-dependencies-64bit.sh b/scripts/macosx-build-dependencies-64bit.sh index 7d411de..e40c5ab 100755 --- a/scripts/macosx-build-dependencies-64bit.sh +++ b/scripts/macosx-build-dependencies-64bit.sh @@ -148,7 +148,7 @@ build_boost() 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=$MAC_OSX_VERSION_MIN -arch i386 -arch x86_64" linkflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386 -arch x86_64" + ./bjam cflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64" linkflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -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 @@ -174,7 +174,7 @@ build_cgal() tar xzf CGAL-$version.tar.gz cd CGAL-$version # 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="$MAC_OSX_VERSION_MIN" -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" -DBOOST_ROOT=$DEPLOYDIR make -j4 make install } @@ -193,7 +193,7 @@ build_glew() 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=$MAC_OSX_VERSION_MIN -arch i386 -arch x86_64" LDFLAGS.EXTRA="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386 -arch x86_64" install + make GLEW_DEST=$DEPLOYDIR CFLAGS.EXTRA="-no-cpp-precomp -dynamic -fno-common -mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64" LDFLAGS.EXTRA="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64" install } build_opencsg() @@ -208,7 +208,7 @@ build_opencsg() 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" + OPENSCAD_LIBRARIES=$DEPLOYDIR qmake -r CONFIG+="x86_64" make install } @@ -228,7 +228,7 @@ build_eigen() ## File name for v2.0.17 ln -s eigen-eigen-b23437e61a07 eigen-$version cd eigen-$version - cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DEIGEN_BUILD_LIB=ON -DBUILD_SHARED_LIBS=FALSE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" + 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" make -j4 make install } diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh index 385d603..a52f1fe 100755 --- a/scripts/macosx-build-dependencies.sh +++ b/scripts/macosx-build-dependencies.sh @@ -21,7 +21,7 @@ BASEDIR=$PWD/../libraries OPENSCADDIR=$PWD SRCDIR=$BASEDIR/src DEPLOYDIR=$BASEDIR/install -MAC_OSX_VERSION_MIN=10.7 +MAC_OSX_VERSION_MIN=10.5 # Hack warning: gmplib is built separately in 32-bit and 64-bit mode # and then merged afterwards. gmplib's header files are dependant on diff --git a/setenv_mjau.sh b/setenv_mjau.sh index 3b9fd92..c96f79d 100644 --- a/setenv_mjau.sh +++ b/setenv_mjau.sh @@ -5,6 +5,7 @@ export DYLD_LIBRARY_PATH=$OPENSCAD_LIBRARIES/lib #export CGALDIR=$PWD/../install/CGAL-3.6 #export QCODEEDITDIR=$PWD/../qcodeedit-2.2.3/install #export DYLD_LIBRARY_PATH=$OPENCSGDIR/lib:$QCODEEDITDIR/lib +export EIGEN2DIR=$OPENSCAD_LIBRARIES # ccache: export PATH=/opt/local/libexec/ccache:$PATH -- cgit v0.10.1 From d4efb54284f0781aee40cb660712fa15256676df Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Mon, 13 Feb 2012 11:23:18 -0500 Subject: Cleaned up unsigned int compiler warnings diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc index c1bdea4..7afb359 100644 --- a/src/PolySetCGALEvaluator.cc +++ b/src/PolySetCGALEvaluator.cc @@ -116,7 +116,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node) double z = ps3->polygons[i][j][2]; if (z != 0) goto next_ps3_polygon_cut_mode; - if (conversion_grid.align(x, y) == i+1) + if ((unsigned) conversion_grid.align(x, y) == i+1) goto next_ps3_polygon_cut_mode; conversion_grid.data(x, y) = i+1; } diff --git a/src/dxfdata.cc b/src/dxfdata.cc index 52493ac..65996d9 100644 --- a/src/dxfdata.cc +++ b/src/dxfdata.cc @@ -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; + unsigned int b = min_x_point; + unsigned int a = b == 0 ? this->paths[i].indices.size() - 2 : b - 1; + unsigned int 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; jpaths.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); } -- cgit v0.10.1 From 25f6593484951c32aaaf79da89d0b3acf352b0fe Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 14 Feb 2012 21:01:51 +0100 Subject: Fix bug including files from within an included file inside a folder. Reported by nop head. diff --git a/src/openscad.cc b/src/openscad.cc index 980e2af..11dad7c 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -275,8 +275,8 @@ int main(int argc, char **argv) fclose(fp); text << "\n" << commandline_commands; fs::path abspath = boosty::absolute( filename ); - std::string fname = boosty::stringy( abspath ); - root_module = parse(text.str().c_str(), fname.c_str(), false); + std::string fpath = boosty::stringy(abspath.parent_path()); + root_module = parse(text.str().c_str(), fpath.c_str(), false); if (!root_module) exit(1); } -- cgit v0.10.1 From a2109992e16246b4d72b316416b9e4bf0d75a288 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 15 Feb 2012 00:12:31 +0100 Subject: EIGEN2DIR not needed - build system uses OPENSCAD_LIBRARIES directly diff --git a/setenv_mjau.sh b/setenv_mjau.sh index c96f79d..3b9fd92 100644 --- a/setenv_mjau.sh +++ b/setenv_mjau.sh @@ -5,7 +5,6 @@ export DYLD_LIBRARY_PATH=$OPENSCAD_LIBRARIES/lib #export CGALDIR=$PWD/../install/CGAL-3.6 #export QCODEEDITDIR=$PWD/../qcodeedit-2.2.3/install #export DYLD_LIBRARY_PATH=$OPENCSGDIR/lib:$QCODEEDITDIR/lib -export EIGEN2DIR=$OPENSCAD_LIBRARIES # ccache: export PATH=/opt/local/libexec/ccache:$PATH -- cgit v0.10.1 From 8a5f6a4abde265bf7d9316d5aa5437b4eca24866 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 15 Feb 2012 00:13:07 +0100 Subject: Minor unsigned fixes diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc index 7afb359..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 conversion_grid(GRID_COARSE); + Grid2d 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]; @@ -116,7 +116,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node) double z = ps3->polygons[i][j][2]; if (z != 0) goto next_ps3_polygon_cut_mode; - if ((unsigned) conversion_grid.align(x, y) == i+1) + if (conversion_grid.align(x, y) == i+1) goto next_ps3_polygon_cut_mode; conversion_grid.data(x, y) = i+1; } diff --git a/src/dxfdata.cc b/src/dxfdata.cc index 65996d9..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 - unsigned int b = min_x_point; - unsigned int a = b == 0 ? this->paths[i].indices.size() - 2 : b - 1; - unsigned 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]; -- cgit v0.10.1 From a9e79409436d9037227dd73571b026c7ff0d4f62 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 15 Feb 2012 00:14:27 +0100 Subject: Merged the 64-bit only script back into the main script. Use the -6 option for 64-bit only diff --git a/scripts/macosx-build-dependencies-64bit.sh b/scripts/macosx-build-dependencies-64bit.sh deleted file mode 100755 index e40c5ab..0000000 --- a/scripts/macosx-build-dependencies-64bit.sh +++ /dev/null @@ -1,251 +0,0 @@ -#!/bin/sh -e -# -# This script builds all library dependencies of OpenSCAD for Mac OS X. -# The libraries will be build in 64-bit mode and backwards compatible with -# 10.6 -# -# 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 -# -# Prerequisites: -# - MacPorts: curl eigen -# - Qt4 -# -# FIXME: -# o Verbose option -# o Port to other platforms? -# - -BASEDIR=$PWD/../libraries -OPENSCADDIR=$PWD -SRCDIR=$BASEDIR/src -DEPLOYDIR=$BASEDIR/install -MAC_OSX_VERSION_MIN=10.6 - -# Hack warning: gmplib is built separately in 32-bit and 64-bit mode -# and then merged afterwards. gmplib's header files are dependant 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-$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=$MAC_OSX_VERSION_MIN -arch i386" LDFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386" ABI=32 --enable-cxx - make install - cd .. - # 64-bit version - mkdir build-x86_64 - cd build-x86_64 - ../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 - install_name_tool -id $DEPLOYDIR/lib/libgmp.dylib lib/libgmp.dylib - cp lib/libgmp.dylib i386/lib/ - cp lib/libgmp.dylib x86_64/lib/ - mkdir -p include - cp x86_64/include/gmp.h include/ - cp x86_64/include/gmpxx.h include/ - - patch -p0 include/gmp.h << EOF ---- gmp.h.orig 2011-11-08 01:03:41.000000000 +0100 -+++ gmp.h 2011-11-08 01:06:21.000000000 +0100 -@@ -26,12 +26,28 @@ - #endif - - --/* Instantiated by configure. */ --#if ! defined (__GMP_WITHIN_CONFIGURE) -+#if defined(__i386__) -+#define __GMP_HAVE_HOST_CPU_FAMILY_power 0 -+#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 0 -+#define GMP_LIMB_BITS 32 -+#define GMP_NAIL_BITS 0 -+#elif defined(__x86_64__) - #define __GMP_HAVE_HOST_CPU_FAMILY_power 0 - #define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 0 - #define GMP_LIMB_BITS 64 - #define GMP_NAIL_BITS 0 -+#elif defined(__ppc__) -+#define __GMP_HAVE_HOST_CPU_FAMILY_power 0 -+#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 1 -+#define GMP_LIMB_BITS 32 -+#define GMP_NAIL_BITS 0 -+#elif defined(__powerpc64__) -+#define __GMP_HAVE_HOST_CPU_FAMILY_power 0 -+#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 1 -+#define GMP_LIMB_BITS 64 -+#define GMP_NAIL_BITS 0 -+#else -+#error Unsupported architecture - #endif - #define GMP_NUMB_BITS (GMP_LIMB_BITS - GMP_NAIL_BITS) - #define GMP_NUMB_MASK ((~ __GMP_CAST (mp_limb_t, 0)) >> GMP_NAIL_BITS) -EOF -} - -# As with gmplib, mpfr is built separately in 32-bit and 64-bit mode and then merged -# afterwards. -build_mpfr() -{ - version=$1 - echo "Building mpfr" $version "..." - 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 - 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=$MAC_OSX_VERSION_MIN -arch i386" LDFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386" - make install - cd .. - - # 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=$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 - install_name_tool -id $DEPLOYDIR/lib/libmpfr.dylib lib/libmpfr.dylib - mkdir -p include - cp x86_64/include/mpfr.h include/ - cp x86_64/include/mpf2mpfr.h include/ -} - - -build_boost() -{ - version=$1 - bversion=`echo $version | tr "." "_"` - echo "Building boost" $version "..." - cd $BASEDIR/src - 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=$MAC_OSX_VERSION_MIN -arch x86_64" linkflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -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 -change libboost_system.dylib $DEPLOYDIR/lib/libboost_system.dylib $DEPLOYDIR/lib/libboost_filesystem.dylib - install_name_tool -id $DEPLOYDIR/lib/libboost_system.dylib $DEPLOYDIR/lib/libboost_system.dylib - install_name_tool -id $DEPLOYDIR/lib/libboost_regex.dylib $DEPLOYDIR/lib/libboost_regex.dylib - - -} - -build_cgal() -{ - version=$1 - echo "Building CGAL" $version "..." - cd $BASEDIR/src - 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 - # 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="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="x86_64" -DBOOST_ROOT=$DEPLOYDIR - make -j4 - make install -} - -build_glew() -{ - version=$1 - echo "Building GLEW" $version "..." - cd $BASEDIR/src - 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=$MAC_OSX_VERSION_MIN -arch x86_64" LDFLAGS.EXTRA="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64" install -} - -build_opencsg() -{ - version=$1 - echo "Building OpenCSG" $version "..." - cd $BASEDIR/src - rm -rf OpenCSG-$version - 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_64" - 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 - 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" - make -j4 - make install -} - -if [ ! -f $OPENSCADDIR/openscad.pro ]; then - echo "Must be run from the OpenSCAD source root directory" - exit 0 -fi - -echo "Using basedir:" $BASEDIR -rm -rf $DEPLOYDIR -mkdir -p $SRCDIR $DEPLOYDIR -build_eigen 2.0.17 -build_gmp 5.0.3 -build_mpfr 3.1.0 -build_boost 1.47.0 -# NB! For CGAL, also update the actual download URL in the function -build_cgal 3.9 -build_glew 1.7.0 -build_opencsg 1.3.2 diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh index a52f1fe..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: @@ -22,9 +23,17 @@ 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() { @@ -37,12 +46,14 @@ build_gmp() 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=$MAC_OSX_VERSION_MIN -arch i386" LDFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -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 @@ -52,10 +63,16 @@ build_gmp() # 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/ @@ -111,12 +128,13 @@ build_mpfr() 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=$MAC_OSX_VERSION_MIN -arch i386" LDFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -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 @@ -126,7 +144,11 @@ build_mpfr() # 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/ @@ -148,7 +170,10 @@ build_boost() 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=$MAC_OSX_VERSION_MIN -arch i386 -arch x86_64" linkflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -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 @@ -173,8 +198,11 @@ build_cgal() 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="$MAC_OSX_VERSION_MIN" -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 } @@ -193,7 +221,10 @@ build_glew() 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=$MAC_OSX_VERSION_MIN -arch i386 -arch x86_64" LDFLAGS.EXTRA="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -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() @@ -208,7 +239,10 @@ build_opencsg() 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 } @@ -228,7 +262,10 @@ build_eigen() ## File name for v2.0.17 ln -s eigen-eigen-b23437e61a07 eigen-$version cd eigen-$version - cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DEIGEN_BUILD_LIB=ON -DBUILD_SHARED_LIBS=FALSE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" + 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 } @@ -238,11 +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 -rm -rf $DEPLOYDIR mkdir -p $SRCDIR $DEPLOYDIR build_eigen 2.0.17 -build_gmp 5.0.3 +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 -- cgit v0.10.1 From 44ff85399011ea1bd3eb812ce97d312ccc4f32eb Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 15 Feb 2012 01:26:38 +0100 Subject: Renamed OpenGL Info to Library Info and added version info of other libraries there diff --git a/src/MainWindow.h b/src/MainWindow.h index 5546290..226689a 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -157,7 +157,7 @@ public slots: void helpAbout(); void helpHomepage(); void helpManual(); - void helpOpenGL(); + void helpLibrary(); void quit(); void actionReloadCompile(); void checkAutoReload(); diff --git a/src/MainWindow.ui b/src/MainWindow.ui index f89e0d4..13bb226 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -222,7 +222,7 @@ - + @@ -671,9 +671,9 @@ Export as CSG... - + - OpenGL info + Library info diff --git a/src/mainwin.cc b/src/mainwin.cc index 2fd75c9..9b24eea 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -323,7 +323,7 @@ MainWindow::MainWindow(const QString &filename) connect(this->helpActionAbout, SIGNAL(triggered()), this, SLOT(helpAbout())); connect(this->helpActionHomepage, SIGNAL(triggered()), this, SLOT(helpHomepage())); connect(this->helpActionManual, SIGNAL(triggered()), this, SLOT(helpManual())); - connect(this->helpActionOpenGLInfo, SIGNAL(triggered()), this, SLOT(helpOpenGL())); + connect(this->helpActionLibraryInfo, SIGNAL(triggered()), this, SLOT(helpLibrary())); setCurrentOutput(); @@ -1699,15 +1699,28 @@ MainWindow::helpManual() QDesktopServices::openUrl(QUrl("http://en.wikibooks.org/wiki/OpenSCAD_User_Manual")); } -void MainWindow::helpOpenGL() +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) +void MainWindow::helpLibrary() { + QString libinfo; + libinfo.sprintf("Boost version: %s\n" + "Eigen version: %d.%d.%d\n" + "CGAL version: %s\n" + "OpenCSG version: %s\n\n", + BOOST_LIB_VERSION, + EIGEN_WORLD_VERSION, EIGEN_MAJOR_VERSION, EIGEN_MINOR_VERSION, + TOSTRING(CGAL_VERSION), + OPENCSG_VERSION_STRING); + if (!this->openglbox) { this->openglbox = new QMessageBox(QMessageBox::Information, - "OpenGL Info", "Detailed OpenGL Info", + "OpenGL Info", "Detailed Library Info", QMessageBox::Ok, this); } - this->openglbox->setDetailedText(this->glview->getRendererInfo()); + + this->openglbox->setDetailedText(libinfo + this->glview->getRendererInfo()); this->openglbox->show(); } -- cgit v0.10.1 From b9d218e13760f21be5aa94c15631d63b29439e18 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 4 Feb 2012 01:43:53 +0100 Subject: Initial implementation of ModuleCache and dependency tracking of used modules diff --git a/doc/TODO.txt b/doc/TODO.txt index 60078e2..5bb66af 100644 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -256,8 +256,13 @@ o Caching - Test that caching is actually performed (speedup + same results) - Test the modifier characters correctly influence the cache (also when added/removed) + - Test the individual caches + - PolySetCache + - CGALCache + - nodecache + - ModuleCache o other tests - export - cmd-line tests - leaf nodes having children, e.g. cube() cylinder(); - - dependency tracking + - dependency tracking (use and include) diff --git a/openscad.pro b/openscad.pro index 100785b..453ab77 100644 --- a/openscad.pro +++ b/openscad.pro @@ -188,6 +188,7 @@ HEADERS += src/parsersettings.h \ src/traverser.h \ src/nodecache.h \ src/nodedumper.h \ + src/ModuleCache.h \ src/PolySetCache.h \ src/PolySetEvaluator.h \ src/CSGTermEvaluator.h \ @@ -230,6 +231,7 @@ SOURCES += src/mathc99.cc \ src/nodedumper.cc \ src/traverser.cc \ src/PolySetEvaluator.cc \ + src/ModuleCache.cc \ src/PolySetCache.cc \ src/Tree.cc \ \ diff --git a/src/MainWindow.h b/src/MainWindow.h index 226689a..a0353a9 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -30,7 +30,7 @@ public: QString autoReloadInfo; Context root_ctx; - AbstractModule *root_module; // Result of parsing + Module *root_module; // Result of parsing ModuleInstantiation root_inst; // Top level instance AbstractNode *absolute_root_node; // Result of tree evaluation AbstractNode *root_node; // Root if the root modifier (!) is used diff --git a/src/ModuleCache.cc b/src/ModuleCache.cc new file mode 100644 index 0000000..eaa7d33 --- /dev/null +++ b/src/ModuleCache.cc @@ -0,0 +1,87 @@ +#include "ModuleCache.h" +#include "module.h" +#include "printutils.h" +#include "boosty.h" +#include "openscad.h" + +#include +#include +#include + +ModuleCache *ModuleCache::inst = NULL; + +Module *ModuleCache::evaluate(const std::string &filename) +{ + Module *cached = NULL; + + struct stat st; + memset(&st, 0, sizeof(struct stat)); + stat(filename.c_str(), &st); + + std::stringstream idstream; + idstream << std::hex << st.st_mtime << "." << st.st_size; + std::string cache_id = idstream.str(); + + if (this->entries.find(filename) != this->entries.end() && + this->entries[filename].cache_id == cache_id) { +#ifdef DEBUG + PRINTB("Using cached library: %s (%s)", filename % cache_id); +#endif + PRINTB("%s", this->entries[filename].msg); + cached = &(*this->entries[filename].module); + } + + if (cached) { + cached->handleDependencies(); + return cached; + } + else { + if (this->entries.find(filename) != this->entries.end()) { + PRINTB("Recompiling cached library: %s (%s)", filename % cache_id); + } + else { + PRINTB("Compiling library '%s'.", filename); + } + } + + FILE *fp = fopen(filename.c_str(), "rt"); + if (!fp) { + fprintf(stderr, "WARNING: Can't open library file '%s'\n", filename.c_str()); + return NULL; + } + std::stringstream text; + char buffer[513]; + int ret; + while ((ret = fread(buffer, 1, 512, fp)) > 0) { + buffer[ret] = 0; + text << buffer; + } + fclose(fp); + + print_messages_push(); + + cache_entry e = { NULL, cache_id, std::string("WARNING: Library `") + filename + "' tries to recursively use itself!" }; + if (this->entries.find(filename) != this->entries.end()) + delete this->entries[filename].module; + this->entries[filename] = e; + + std::string pathname = boosty::stringy(fs::path(filename).parent_path()); + Module *lib_mod = dynamic_cast(parse(text.str().c_str(), pathname.c_str(), 0)); + + if (lib_mod) { + this->entries[filename].module = lib_mod; + this->entries[filename].msg = print_messages_stack.back(); + } else { + this->entries.erase(filename); + } + + print_messages_pop(); + + return lib_mod; +} + +void ModuleCache::clear() +{ + this->entries.clear(); +} + diff --git a/src/ModuleCache.h b/src/ModuleCache.h new file mode 100644 index 0000000..57ff2e7 --- /dev/null +++ b/src/ModuleCache.h @@ -0,0 +1,22 @@ +#include +#include + +class ModuleCache +{ +public: + static ModuleCache *instance() { if (!inst) inst = new ModuleCache; return inst; } + class Module *evaluate(const std::string &filename); + void clear(); + +private: + ModuleCache() {} + ~ModuleCache() {} + + static ModuleCache *inst; + + struct cache_entry { + class Module *module; + std::string cache_id, msg; + }; + boost::unordered_map entries; +}; diff --git a/src/context.cc b/src/context.cc index b9e685c..f96a45b 100644 --- a/src/context.cc +++ b/src/context.cc @@ -162,6 +162,7 @@ AbstractNode *Context::evaluate_module(const ModuleInstantiation &inst) const } if (this->usedlibs_p) { BOOST_FOREACH(const ModuleContainer::value_type &m, *this->usedlibs_p) { + assert(m.second); if (m.second->modules.find(inst.name()) != m.second->modules.end()) { Context ctx(this->parent, m.second); return m.second->modules[inst.name()]->evaluate(&ctx, &inst); diff --git a/src/lexer.l b/src/lexer.l index 5644ded..11f2aff 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -52,7 +52,7 @@ int lexerget_lineno(void); static void yyunput(int, char*) __attribute__((unused)); #endif extern const char *parser_input_buffer; -extern const char *parser_source_path; + extern std::string parser_source_path; #define YY_INPUT(buf,result,max_size) { \ if (yyin && yyin != stdin) { \ @@ -108,6 +108,7 @@ use[ \t\r\n>]*"<" { BEGIN(cond_use); } { [^\t\r\n>]+ { filename = yytext; } ">" { + PRINTB("USE: %s", filename); BEGIN(INITIAL); fs::path usepath; if (boosty::is_absolute(fs::path(filename))) { diff --git a/src/mainwin.cc b/src/mainwin.cc index 9b24eea..8eebf09 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -25,6 +25,7 @@ */ #include "PolySetCache.h" +#include "ModuleCache.h" #include "MainWindow.h" #include "openscad.h" // examplesdir #include "parsersettings.h" @@ -695,6 +696,8 @@ void MainWindow::compile(bool procevents) goto fail; } + this->root_module->handleDependencies(); + // Evaluate CSG tree PRINT("Compiling design (CSG Tree generation)..."); if (procevents) @@ -1449,7 +1452,7 @@ void MainWindow::actionFlushCaches() #endif dxf_dim_cache.clear(); dxf_cross_cache.clear(); - Module::clear_library_cache(); + ModuleCache::instance()->clear(); } void MainWindow::viewModeActionsUncheck() @@ -1797,7 +1800,7 @@ void MainWindow::consoleOutput(const std::string &msg, void *userdata) void MainWindow::setCurrentOutput() { - set_output_handler(&MainWindow::consoleOutput, this); +// set_output_handler(&MainWindow::consoleOutput, this); } void MainWindow::clearCurrentOutput() diff --git a/src/module.cc b/src/module.cc index 6641ff7..7ad2e33 100644 --- a/src/module.cc +++ b/src/module.cc @@ -25,11 +25,13 @@ */ #include "module.h" +#include "ModuleCache.h" #include "node.h" #include "context.h" #include "expression.h" #include "function.h" #include "printutils.h" + #include #include @@ -201,7 +203,18 @@ std::string Module::dump(const std::string &indent, const std::string &name) con return dump.str(); } -void Module::clear_library_cache() +void Module::handleDependencies() { - Module::libs_cache.clear(); + PRINTB_NOCACHE("Module::handleDependencies(): %p (%d libs %p)", this % this->usedlibs.size() % &this->usedlibs); + // Iterating manually since we want to modify the container while iterating + Module::ModuleContainer::iterator iter = this->usedlibs.begin(); + while (iter != this->usedlibs.end()) { + Module::ModuleContainer::iterator curr = iter++; + curr->second = ModuleCache::instance()->evaluate(curr->first); + PRINTB_NOCACHE(" %s: %p", curr->first % curr->second); + if (!curr->second) { + PRINTB_NOCACHE("WARNING: Failed to compile library '%s'.", curr->first); + this->usedlibs.erase(curr); + } + } } diff --git a/src/module.h b/src/module.h index 6c6529b..a490129 100644 --- a/src/module.h +++ b/src/module.h @@ -65,11 +65,9 @@ public: void addChild(ModuleInstantiation *ch) { this->children.push_back(ch); } - static Module *compile_library(const std::string &filename); - static void clear_library_cache(); - typedef boost::unordered_map ModuleContainer; ModuleContainer usedlibs; + void handleDependencies(); std::vector assignments_var; std::vector assignments_expr; @@ -87,11 +85,6 @@ public: protected: private: - struct libs_cache_ent { - Module *mod; - std::string cache_id, msg; - }; - static boost::unordered_map libs_cache; }; #endif diff --git a/src/openscad.cc b/src/openscad.cc index 11dad7c..39e3f4c 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -255,7 +255,7 @@ int main(int argc, char **argv) Context root_ctx; register_builtin(root_ctx); - AbstractModule *root_module; + Module *root_module; ModuleInstantiation root_inst; AbstractNode *root_node; @@ -278,6 +278,7 @@ int main(int argc, char **argv) std::string fpath = boosty::stringy(abspath.parent_path()); root_module = parse(text.str().c_str(), fpath.c_str(), false); if (!root_module) exit(1); + root_module->handleDependencies(); } fs::path fpath = boosty::absolute( fs::path(filename) ); diff --git a/src/openscad.h b/src/openscad.h index dab14cd..8b49ba2 100644 --- a/src/openscad.h +++ b/src/openscad.h @@ -27,7 +27,7 @@ #ifndef OPENSCAD_H #define OPENSCAD_H -extern class AbstractModule *parse(const char *text, const char *path, int debug); +extern class Module *parse(const char *text, const char *path, int debug); extern int get_fragments_from_r(double r, double fn, double fs, double fa); #include diff --git a/src/parser.y b/src/parser.y index 15a754b..85fee48 100644 --- a/src/parser.y +++ b/src/parser.y @@ -43,7 +43,7 @@ #include #include -using namespace boost::filesystem; +namespace fs = boost::filesystem; #include "boosty.h" int parser_error_pos = -1; @@ -56,7 +56,7 @@ int lexerlex_destroy(void); int lexerlex(void); std::vector module_stack; -Module *module; +Module *currmodule; class ArgContainer { public: @@ -133,7 +133,7 @@ public: input: /* empty */ | - TOK_USE { module->usedlibs[$1] = NULL; } input | + TOK_USE { currmodule->usedlibs[$1] = NULL; } input | statement input ; inner_input: @@ -145,37 +145,38 @@ statement: '{' inner_input '}' | module_instantiation { if ($1) { - module->addChild($1); + currmodule->addChild($1); } else { delete $1; } } | TOK_ID '=' expr ';' { bool add_new_assignment = true; - for (size_t i = 0; i < module->assignments_var.size(); i++) { - if (module->assignments_var[i] != $1) + for (size_t i = 0; i < currmodule->assignments_var.size(); i++) { + if (currmodule->assignments_var[i] != $1) continue; - delete module->assignments_expr[i]; - module->assignments_expr[i] = $3; + delete currmodule->assignments_expr[i]; + currmodule->assignments_expr[i] = $3; add_new_assignment = false; } if (add_new_assignment) { - module->assignments_var.push_back($1); - module->assignments_expr.push_back($3); + currmodule->assignments_var.push_back($1); + currmodule->assignments_expr.push_back($3); free($1); } } | TOK_MODULE TOK_ID '(' arguments_decl optional_commas ')' { - Module *p = module; - module_stack.push_back(module); - module = new Module(); - p->modules[$2] = module; - module->argnames = $4->argnames; - module->argexpr = $4->argexpr; + Module *p = currmodule; + module_stack.push_back(currmodule); + currmodule = new Module(); + PRINTB_NOCACHE("New module: %s %p", $2 % currmodule); + p->modules[$2] = currmodule; + currmodule->argnames = $4->argnames; + currmodule->argexpr = $4->argexpr; free($2); delete $4; } statement { - module = module_stack.back(); + currmodule = module_stack.back(); module_stack.pop_back(); } | TOK_FUNCTION TOK_ID '(' arguments_decl optional_commas ')' '=' expr { @@ -183,7 +184,7 @@ statement: func->argnames = $4->argnames; func->argexpr = $4->argexpr; func->expr = $8; - module->functions[$2] = func; + currmodule->functions[$2] = func; free($2); delete $4; } ';' ; @@ -560,101 +561,34 @@ void yyerror (char const *s) { // FIXME: We leak memory on parser errors... PRINTB("Parser error in line %d: %s\n", lexerget_lineno() % s); - module = NULL; + currmodule = NULL; } extern void lexerdestroy(); extern FILE *lexerin; extern const char *parser_input_buffer; const char *parser_input_buffer; -const char *parser_source_path; +std::string parser_source_path; -AbstractModule *parse(const char *text, const char *path, int debug) +Module *parse(const char *text, const char *path, int debug) { + PRINT_NOCACHE("New parser"); lexerin = NULL; parser_error_pos = -1; parser_input_buffer = text; - parser_source_path = path; + parser_source_path = std::string(path); module_stack.clear(); - module = new Module(); + Module *rootmodule = currmodule = new Module(); + PRINTB_NOCACHE("New module: %s %p", "root" % rootmodule); parserdebug = debug; parserparse(); lexerdestroy(); lexerlex_destroy(); - if (!module) - return NULL; - - // Iterating manually since we want to modify the container while iterating - Module::ModuleContainer::iterator iter = module->usedlibs.begin(); - while (iter != module->usedlibs.end()) { - Module::ModuleContainer::iterator curr = iter++; - curr->second = Module::compile_library(curr->first); - if (!curr->second) { - PRINTB("WARNING: Failed to compile library '%s'.", curr->first); - module->usedlibs.erase(curr); - } - } + if (!rootmodule) return NULL; parser_error_pos = -1; - return module; -} - -boost::unordered_map Module::libs_cache; - -Module *Module::compile_library(const std::string &filename) -{ - struct stat st; - memset(&st, 0, sizeof(struct stat)); - stat(filename.c_str(), &st); - - std::stringstream idstream; - idstream << std::hex << st.st_mtime << "." << st.st_size; - std::string cache_id = idstream.str(); - - if (libs_cache.find(filename) != libs_cache.end() && libs_cache[filename].cache_id == cache_id) { - PRINTB("%s", libs_cache[filename].msg); - return &(*libs_cache[filename].mod); - } - - FILE *fp = fopen(filename.c_str(), "rt"); - if (!fp) { - fprintf(stderr, "WARNING: Can't open library file '%s'\n", filename.c_str()); - return NULL; - } - std::stringstream text; - char buffer[513]; - int ret; - while ((ret = fread(buffer, 1, 512, fp)) > 0) { - buffer[ret] = 0; - text << buffer; - } - fclose(fp); - - print_messages_push(); - - PRINTB("Compiling library '%s'.", filename); - libs_cache_ent e = { NULL, cache_id, std::string("WARNING: Library `") + filename + "' tries to recursively use itself!" }; - if (libs_cache.find(filename) != libs_cache.end()) - delete libs_cache[filename].mod; - libs_cache[filename] = e; - - Module *backup_mod = module; - std::string pathname = boosty::stringy( fs::path(filename).parent_path() ); - Module *lib_mod = dynamic_cast(parse(text.str().c_str(), pathname.c_str(), 0)); - module = backup_mod; - - if (lib_mod) { - libs_cache[filename].mod = lib_mod; - libs_cache[filename].msg = print_messages_stack.back(); - } else { - libs_cache.erase(filename); - } - - print_messages_pop(); - - return lib_mod; + return rootmodule; } - diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b81ce8c..fa75776 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -309,6 +309,7 @@ set(CORE_SOURCES ../src/expr.cc ../src/func.cc ../src/module.cc + ../src/ModuleCache.cc ../src/node.cc ../src/context.cc ../src/csgterm.cc @@ -403,6 +404,12 @@ add_executable(dumptest dumptest.cc) target_link_libraries(dumptest tests-common tests-nocgal ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES}) # +# modulecachetest +# +add_executable(modulecachetest modulecachetest.cc) +target_link_libraries(modulecachetest tests-common tests-nocgal ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES}) + +# # csgtexttest # add_executable(csgtexttest csgtexttest.cc CSGTextRenderer.cc CSGTextCache.cc) diff --git a/tests/modulecachetest.cc b/tests/modulecachetest.cc new file mode 100644 index 0000000..ae872e2 --- /dev/null +++ b/tests/modulecachetest.cc @@ -0,0 +1,121 @@ +/* + * OpenSCAD (www.openscad.org) + * Copyright (C) 2009-2011 Clifford Wolf and + * Marius Kintel + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * As a special exception, you have permission to link this program + * with the CGAL library and distribute executables, as long as you + * follow the requirements of the GNU GPL in regard to all of the + * software in the executable aside from CGAL. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "tests-common.h" +#include "openscad.h" +#include "parsersettings.h" +#include "node.h" +#include "module.h" +#include "context.h" +#include "value.h" +#include "export.h" +#include "builtin.h" +#include "Tree.h" + +#include +#ifndef _MSC_VER +#include +#endif +#include +#include +#include +#include + +#include +namespace fs = boost::filesystem; +#include "boosty.h" + +std::string commandline_commands; +std::string currentdir; +QString examplesdir; + +using std::string; + +int main(int argc, char **argv) +{ +#ifdef _MSC_VER + _set_output_format(_TWO_DIGIT_EXPONENT); +#endif + if (argc != 3) { + fprintf(stderr, "Usage: %s \n", argv[0]); + exit(1); + } + + const char *filename = argv[1]; + const char *outfilename = argv[2]; + + int rc = 0; + + Builtins::instance()->initialize(); + + QCoreApplication app(argc, argv); + fs::path original_path = 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")); + + Context root_ctx; + register_builtin(root_ctx); + + AbstractModule *root_module; + ModuleInstantiation root_inst; + AbstractNode *root_node; + + root_module = parsefile(filename); + if (!root_module) { + fprintf(stderr, "Error: Unable to parse input file\n"); + exit(1); + } + + fs::current_path(fs::path(filename).parent_path()); + + AbstractNode::resetIndexCounter(); + root_node = root_module->evaluate(&root_ctx, &root_inst); + + delete root_node; + delete root_module; + + fs::current_path(original_path); + + fprintf(stderr, "Second parse\n"); + root_module = parsefile(filename); + if (!root_module) { + fprintf(stderr, "Error: Unable to parse second time\n"); + exit(1); + } + + AbstractNode::resetIndexCounter(); + root_node = root_module->evaluate(&root_ctx, &root_inst); + + delete root_node; + delete root_module; + + Builtins::instance(true); + + return rc; +} diff --git a/tests/tests-common.cc b/tests/tests-common.cc index 1694a74..5b0cc3b 100644 --- a/tests/tests-common.cc +++ b/tests/tests-common.cc @@ -7,9 +7,9 @@ #include #include -AbstractModule *parsefile(const char *filename) +Module *parsefile(const char *filename) { - AbstractModule *root_module = NULL; + Module *root_module = NULL; QFileInfo fileInfo(filename); handle_dep(filename); @@ -27,6 +27,9 @@ AbstractModule *parsefile(const char *filename) fclose(fp); text << "\n" << commandline_commands; root_module = parse(text.str().c_str(), fileInfo.absolutePath().toLocal8Bit(), false); + if (root_module) { + root_module->handleDependencies(); + } } return root_module; } diff --git a/tests/tests-common.h b/tests/tests-common.h index 92ebc78..0047562 100644 --- a/tests/tests-common.h +++ b/tests/tests-common.h @@ -1,6 +1,6 @@ #ifndef TESTS_COMMON_H_ #define TESTS_COMMON_H_ -class AbstractModule *parsefile(const char *filename); +class Module *parsefile(const char *filename); #endif -- cgit v0.10.1 From caa6272fe8e96aa713f4e4d243f78d8b271991bb Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 4 Feb 2012 02:40:46 +0100 Subject: Don't try to handle non-existing use'd libraries diff --git a/src/lexer.l b/src/lexer.l index 11f2aff..5e24e7f 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -120,9 +120,12 @@ use[ \t\r\n>]*"<" { BEGIN(cond_use); } usepath = boosty::absolute(fs::path(get_librarydir()) / filename); } } - handle_dep(usepath.string()); - parserlval.text = strdup(usepath.string().c_str()); - return TOK_USE; + /* Only accept regular files which exists */ + if (usepath.has_parent_path() && fs::exists(usepath)) { + handle_dep(usepath.string()); + parserlval.text = strdup(usepath.string().c_str()); + return TOK_USE; + } } } -- cgit v0.10.1 From 061c1575473c730c947bdc7a9d14812ac36265fa Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 4 Feb 2012 02:41:14 +0100 Subject: Recursively handle dependencies after parsing diff --git a/src/ModuleCache.cc b/src/ModuleCache.cc index eaa7d33..dd953c5 100644 --- a/src/ModuleCache.cc +++ b/src/ModuleCache.cc @@ -71,6 +71,7 @@ Module *ModuleCache::evaluate(const std::string &filename) if (lib_mod) { this->entries[filename].module = lib_mod; this->entries[filename].msg = print_messages_stack.back(); + lib_mod->handleDependencies(); } else { this->entries.erase(filename); } -- cgit v0.10.1 From eaeec7aa9ad7bc37af33607e1a8d236beccc9717 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 4 Feb 2012 02:41:43 +0100 Subject: Comment out some debug info to let tests pass diff --git a/src/module.cc b/src/module.cc index 7ad2e33..f049da1 100644 --- a/src/module.cc +++ b/src/module.cc @@ -205,7 +205,7 @@ std::string Module::dump(const std::string &indent, const std::string &name) con void Module::handleDependencies() { - PRINTB_NOCACHE("Module::handleDependencies(): %p (%d libs %p)", this % this->usedlibs.size() % &this->usedlibs); +// PRINTB_NOCACHE("Module::handleDependencies(): %p (%d libs %p)", this % this->usedlibs.size() % &this->usedlibs); // Iterating manually since we want to modify the container while iterating Module::ModuleContainer::iterator iter = this->usedlibs.begin(); while (iter != this->usedlibs.end()) { diff --git a/src/parser.y b/src/parser.y index 85fee48..2f4379a 100644 --- a/src/parser.y +++ b/src/parser.y @@ -572,7 +572,6 @@ std::string parser_source_path; Module *parse(const char *text, const char *path, int debug) { - PRINT_NOCACHE("New parser"); lexerin = NULL; parser_error_pos = -1; parser_input_buffer = text; @@ -580,7 +579,7 @@ Module *parse(const char *text, const char *path, int debug) module_stack.clear(); Module *rootmodule = currmodule = new Module(); - PRINTB_NOCACHE("New module: %s %p", "root" % rootmodule); + // PRINTB_NOCACHE("New module: %s %p", "root" % rootmodule); parserdebug = debug; parserparse(); -- cgit v0.10.1 From 3cd36f972edd62c63b6a831b6b8b944240c22e49 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 4 Feb 2012 02:50:36 +0100 Subject: expected file for updated projection-tests diff --git a/tests/regression/dumptest/projection-tests-expected.txt b/tests/regression/dumptest/projection-tests-expected.txt index 77fdbb4..9bc389e 100644 --- a/tests/regression/dumptest/projection-tests-expected.txt +++ b/tests/regression/dumptest/projection-tests-expected.txt @@ -35,4 +35,13 @@ } } } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -22], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 5, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + projection(cut = true, convexity = 0) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -5], [0, 0, 0, 1]]) { + cube(size = [10, 10, 10], center = true); + } + } + } + } -- cgit v0.10.1 From 06ad8b5150e898b4a2043baea0a8233ea7b4eafd Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 8 Feb 2012 18:00:13 +0100 Subject: Reenable console output diff --git a/src/mainwin.cc b/src/mainwin.cc index 8eebf09..f8e4480 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -1800,7 +1800,7 @@ void MainWindow::consoleOutput(const std::string &msg, void *userdata) void MainWindow::setCurrentOutput() { -// set_output_handler(&MainWindow::consoleOutput, this); + set_output_handler(&MainWindow::consoleOutput, this); } void MainWindow::clearCurrentOutput() -- cgit v0.10.1 From accb71b5463b8265b7540a0c310aa827d1d0838a Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Thu, 9 Feb 2012 01:44:08 +0100 Subject: Simplify file reading diff --git a/src/openscad.cc b/src/openscad.cc index 39e3f4c..f45f81a 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -260,30 +260,23 @@ int main(int argc, char **argv) AbstractNode *root_node; handle_dep(filename); - FILE *fp = fopen(filename, "rt"); - if (!fp) { - fprintf(stderr, "Can't open input file `%s'!\n", filename); + + std::ifstream ifs(filename); + if (!ifs.is_open()) { + fprintf(stderr, "Can't open input file '%s'!\n", filename); exit(1); - } else { - std::stringstream text; - char buffer[513]; - int ret; - while ((ret = fread(buffer, 1, 512, fp)) > 0) { - buffer[ret] = 0; - text << buffer; - } - fclose(fp); - text << "\n" << commandline_commands; - fs::path abspath = boosty::absolute( filename ); - std::string fpath = boosty::stringy(abspath.parent_path()); - root_module = parse(text.str().c_str(), fpath.c_str(), false); - if (!root_module) exit(1); - root_module->handleDependencies(); } + std::string text((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); + text += "\n" + commandline_commands; + fs::path abspath = boosty::absolute(filename); + std::string parentpath = boosty::stringy(abspath.parent_path()); + root_module = parse(text.c_str(), parentpath.c_str(), false); + if (!root_module) exit(1); + root_module->handleDependencies(); - fs::path fpath = boosty::absolute( fs::path(filename) ); + fs::path fpath = boosty::absolute(fs::path(filename)); fs::path fparent = fpath.parent_path(); - fs::current_path( fparent ); + fs::current_path(fparent); AbstractNode::resetIndexCounter(); root_node = root_module->evaluate(&root_ctx, &root_inst); -- cgit v0.10.1 From abcd702a6812abb77317d6fab4f3bdacc273b463 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Thu, 9 Feb 2012 01:44:29 +0100 Subject: Minor clarification, cleanup file reading diff --git a/src/ModuleCache.cc b/src/ModuleCache.cc index dd953c5..59424d4 100644 --- a/src/ModuleCache.cc +++ b/src/ModuleCache.cc @@ -5,6 +5,7 @@ #include "openscad.h" #include +#include #include #include @@ -12,8 +13,9 @@ ModuleCache *ModuleCache::inst = NULL; Module *ModuleCache::evaluate(const std::string &filename) { - Module *cached = NULL; + Module *lib_mod = NULL; + // Create cache ID struct stat st; memset(&st, 0, sizeof(struct stat)); stat(filename.c_str(), &st); @@ -22,61 +24,55 @@ Module *ModuleCache::evaluate(const std::string &filename) idstream << std::hex << st.st_mtime << "." << st.st_size; std::string cache_id = idstream.str(); + // Lookup in cache if (this->entries.find(filename) != this->entries.end() && this->entries[filename].cache_id == cache_id) { #ifdef DEBUG PRINTB("Using cached library: %s (%s)", filename % cache_id); #endif PRINTB("%s", this->entries[filename].msg); - cached = &(*this->entries[filename].module); + lib_mod = &(*this->entries[filename].module); } - - if (cached) { - cached->handleDependencies(); - return cached; - } - else { + + // If cache lookup failed (non-existing or old timestamp), compile module + if (!lib_mod) { +#ifdef DEBUG if (this->entries.find(filename) != this->entries.end()) { PRINTB("Recompiling cached library: %s (%s)", filename % cache_id); } else { PRINTB("Compiling library '%s'.", filename); } - } - - FILE *fp = fopen(filename.c_str(), "rt"); - if (!fp) { - fprintf(stderr, "WARNING: Can't open library file '%s'\n", filename.c_str()); - return NULL; - } - std::stringstream text; - char buffer[513]; - int ret; - while ((ret = fread(buffer, 1, 512, fp)) > 0) { - buffer[ret] = 0; - text << buffer; - } - fclose(fp); - - print_messages_push(); - - cache_entry e = { NULL, cache_id, std::string("WARNING: Library `") + filename + "' tries to recursively use itself!" }; - if (this->entries.find(filename) != this->entries.end()) - delete this->entries[filename].module; - this->entries[filename] = e; +#endif - std::string pathname = boosty::stringy(fs::path(filename).parent_path()); - Module *lib_mod = dynamic_cast(parse(text.str().c_str(), pathname.c_str(), 0)); + std::ifstream ifs(filename.c_str()); + if (!ifs.is_open()) { + PRINTB("WARNING: Can't open library file '%s'\n", filename); + return NULL; + } + std::string text((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); - if (lib_mod) { - this->entries[filename].module = lib_mod; - this->entries[filename].msg = print_messages_stack.back(); - lib_mod->handleDependencies(); - } else { - this->entries.erase(filename); + print_messages_push(); + + cache_entry e = { NULL, cache_id, std::string("WARNING: Library `") + filename + "' tries to recursively use itself!" }; + if (this->entries.find(filename) != this->entries.end()) + delete this->entries[filename].module; + this->entries[filename] = e; + + std::string pathname = boosty::stringy(fs::path(filename).parent_path()); + lib_mod = dynamic_cast(parse(text.c_str(), pathname.c_str(), 0)); + + if (lib_mod) { + this->entries[filename].module = lib_mod; + this->entries[filename].msg = print_messages_stack.back(); + } else { + this->entries.erase(filename); + } + + print_messages_pop(); } - print_messages_pop(); + if (lib_mod) lib_mod->handleDependencies(); return lib_mod; } -- cgit v0.10.1 From 7b9b798fdcc507a581735ceb3396a53d0ce71652 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 14 Feb 2012 01:30:39 +0100 Subject: Started on sanitizing compile handling in mainwindow diff --git a/src/MainWindow.h b/src/MainWindow.h index a0353a9..4110b45 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -27,7 +27,7 @@ public: double tval, fps, fsteps; QTimer *autoReloadTimer; - QString autoReloadInfo; + std::string autoReloadId; Context root_ctx; Module *root_module; // Result of parsing @@ -73,9 +73,12 @@ private slots: private: void openFile(const QString &filename); - void load(); + void refreshDocument(); AbstractNode *find_root_tag(AbstractNode *n); - void compile(bool procevents); + void updateTemporalVariables(); + bool fileChangedOnDisk(); + void compileTopLevelDocument(bool reload); + void compile(bool reload, bool procevents); void compileCSG(bool procevents); bool maybeSave(); bool checkModified(); diff --git a/src/ModuleCache.cc b/src/ModuleCache.cc index 59424d4..7a0fe51 100644 --- a/src/ModuleCache.cc +++ b/src/ModuleCache.cc @@ -1,14 +1,21 @@ #include "ModuleCache.h" #include "module.h" #include "printutils.h" -#include "boosty.h" #include "openscad.h" +#include "boosty.h" +#include +#include + #include #include #include #include +/*! + FIXME: Implement an LRU scheme to avoid having an ever-growing module cache +*/ + ModuleCache *ModuleCache::inst = NULL; Module *ModuleCache::evaluate(const std::string &filename) @@ -20,9 +27,7 @@ Module *ModuleCache::evaluate(const std::string &filename) memset(&st, 0, sizeof(struct stat)); stat(filename.c_str(), &st); - std::stringstream idstream; - idstream << std::hex << st.st_mtime << "." << st.st_size; - std::string cache_id = idstream.str(); + std::string cache_id = str(boost::format("%x.%x") % st.st_mtime % st.st_size); // Lookup in cache if (this->entries.find(filename) != this->entries.end() && diff --git a/src/mainwin.cc b/src/mainwin.cc index f8e4480..688d935 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -79,9 +79,7 @@ #include #include -#include -#include -using namespace boost::lambda; +#include #ifdef ENABLE_CGAL @@ -200,8 +198,8 @@ MainWindow::MainWindow(const QString &filename) autoReloadTimer->setSingleShot(false); connect(autoReloadTimer, SIGNAL(timeout()), this, SLOT(checkAutoReload())); - connect(e_tval, SIGNAL(textChanged(QString)), this, SLOT(actionCompile())); - connect(e_fps, SIGNAL(textChanged(QString)), this, SLOT(updatedFps())); + connect(this->e_tval, SIGNAL(textChanged(QString)), this, SLOT(actionCompile())); + connect(this->e_fps, SIGNAL(textChanged(QString)), this, SLOT(updatedFps())); animate_panel->hide(); @@ -489,7 +487,7 @@ MainWindow::openFile(const QString &new_filename) #endif setFileName(new_filename); - load(); + refreshDocument(); updateRecentFiles(); } @@ -545,11 +543,11 @@ void MainWindow::updateRecentFiles() void MainWindow::updatedFps() { bool fps_ok; - double fps = e_fps->text().toDouble(&fps_ok); + double fps = this->e_fps->text().toDouble(&fps_ok); animate_timer->stop(); if (fps_ok && fps > 0) { animate_timer->setSingleShot(false); - animate_timer->setInterval(int(1000 / e_fps->text().toDouble())); + animate_timer->setInterval(int(1000 / this->e_fps->text().toDouble())); animate_timer->start(); } } @@ -557,27 +555,28 @@ void MainWindow::updatedFps() void MainWindow::updateTVal() { bool fps_ok; - double fps = e_fps->text().toDouble(&fps_ok); + double fps = this->e_fps->text().toDouble(&fps_ok); if (fps_ok) { if (fps <= 0) { actionCompile(); } else { - double s = e_fsteps->text().toDouble(); - double t = e_tval->text().toDouble() + 1/s; + double s = this->e_fsteps->text().toDouble(); + double t = this->e_tval->text().toDouble() + 1/s; QString txt; txt.sprintf("%.5f", t >= 1.0 ? 0.0 : t); - e_tval->setText(txt); + this->e_tval->setText(txt); } } } -void MainWindow::load() +void MainWindow::refreshDocument() { setCurrentOutput(); if (!this->fileName.isEmpty()) { QFile file(this->fileName); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - PRINTB("Failed to open file: %s (%s)", this->fileName.toStdString() % file.errorString().toStdString()); + PRINTB("Failed to open file %s: %s", + this->fileName.toStdString() % file.errorString().toStdString()); } else { QString text = QTextStream(&file).readAll(); @@ -600,41 +599,26 @@ AbstractNode *MainWindow::find_root_tag(AbstractNode *n) /*! Parse and evaluate the design => this->root_node */ -void MainWindow::compile(bool procevents) +void MainWindow::compile(bool reload, bool procevents) { - PRINT("Parsing design (AST generation)..."); - if (procevents) - QApplication::processEvents(); + compileTopLevelDocument(reload); // Invalidate renderers before we kill the CSG tree this->glview->setRenderer(NULL); - if (this->opencsgRenderer) { - delete this->opencsgRenderer; - this->opencsgRenderer = NULL; - } - if (this->thrownTogetherRenderer) { - delete this->thrownTogetherRenderer; - this->thrownTogetherRenderer = NULL; - } + delete this->opencsgRenderer; + this->opencsgRenderer = NULL; + delete this->thrownTogetherRenderer; + this->thrownTogetherRenderer = NULL; // Remove previous CSG tree - if (this->root_module) { - delete this->root_module; - this->root_module = NULL; - } - - if (this->absolute_root_node) { - delete this->absolute_root_node; - this->absolute_root_node = NULL; - } + delete this->absolute_root_node; + this->absolute_root_node = NULL; this->root_raw_term.reset(); this->root_norm_term.reset(); - if (this->root_chain) { - delete this->root_chain; - this->root_chain = NULL; - } + delete this->root_chain; + this->root_chain = NULL; this->highlight_terms.clear(); delete this->highlights_chain; @@ -647,98 +631,44 @@ void MainWindow::compile(bool procevents) this->root_node = NULL; this->tree.setRoot(NULL); - // Initialize special variables - this->root_ctx.set_variable("$t", Value(e_tval->text().toDouble())); - - Value vpt; - vpt.type = Value::VECTOR; - vpt.append(new Value(-this->glview->object_trans_x)); - vpt.append(new Value(-this->glview->object_trans_y)); - vpt.append(new Value(-this->glview->object_trans_z)); - this->root_ctx.set_variable("$vpt", vpt); - - Value vpr; - vpr.type = Value::VECTOR; - vpr.append(new Value(fmodf(360 - this->glview->object_rot_x + 90, 360))); - vpr.append(new Value(fmodf(360 - this->glview->object_rot_y, 360))); - vpr.append(new Value(fmodf(360 - this->glview->object_rot_z, 360))); - root_ctx.set_variable("$vpr", vpr); - - // Parse - this->last_compiled_doc = editor->toPlainText(); - this->root_module = parse((this->last_compiled_doc + "\n" + - QString::fromStdString(commandline_commands)).toAscii().data(), - this->fileName.isEmpty() ? - "" : - QFileInfo(this->fileName).absolutePath().toLocal8Bit(), - false); - - // Error highlighting - if (this->highlighter) { - delete this->highlighter; - this->highlighter = NULL; - } - if (parser_error_pos >= 0) { - this->highlighter = new Highlighter(editor->document()); - } - - if (!this->root_module) { - if (!animate_panel->isVisible()) { -#ifdef _QCODE_EDIT_ - QDocumentCursor cursor = editor->cursor(); - cursor.setPosition(parser_error_pos); -#else - QTextCursor cursor = editor->textCursor(); - cursor.setPosition(parser_error_pos); - editor->setTextCursor(cursor); -#endif + if (this->root_module) { + // Evaluate CSG tree + PRINT("Compiling design (CSG Tree generation)..."); + if (procevents) QApplication::processEvents(); + + AbstractNode::resetIndexCounter(); + this->root_inst = ModuleInstantiation(); + this->absolute_root_node = this->root_module->evaluate(&this->root_ctx, &this->root_inst); + + if (this->absolute_root_node) { + // Do we have an explicit root node (! modifier)? + if (!(this->root_node = find_root_tag(this->absolute_root_node))) { + this->root_node = this->absolute_root_node; + } + // FIXME: Consider giving away ownership of root_node to the Tree, or use reference counted pointers + this->tree.setRoot(this->root_node); + // Dump the tree (to initialize caches). + // FIXME: We shouldn't really need to do this explicitly.. + this->tree.getString(*this->root_node); + + PRINT("Compilation finished."); + if (procevents) QApplication::processEvents(); } - goto fail; } - this->root_module->handleDependencies(); - - // Evaluate CSG tree - PRINT("Compiling design (CSG Tree generation)..."); - if (procevents) - QApplication::processEvents(); - - AbstractNode::resetIndexCounter(); - this->root_inst = ModuleInstantiation(); - this->absolute_root_node = this->root_module->evaluate(&this->root_ctx, &this->root_inst); - - if (!this->absolute_root_node) - goto fail; - - // Do we have an explicit root node (! modifier)? - if (!(this->root_node = find_root_tag(this->absolute_root_node))) { - this->root_node = this->absolute_root_node; - } - // FIXME: Consider giving away ownership of root_node to the Tree, or use reference counted pointers - this->tree.setRoot(this->root_node); - // Dump the tree (to initialize caches). - // FIXME: We shouldn't really need to do this explicitly.. - this->tree.getString(*this->root_node); - - if (1) { - PRINT("Compilation finished."); - if (procevents) - QApplication::processEvents(); - } else { -fail: + if (!this->root_node) { if (parser_error_pos < 0) { PRINT("ERROR: Compilation failed! (no top level object found)"); } else { PRINT("ERROR: Compilation failed!"); } - if (procevents) - QApplication::processEvents(); + if (procevents) QApplication::processEvents(); } } /*! Generates CSG tree for OpenCSG evaluation. - Assumes that the design has been parsed and evaluated + Assumes that the design has been parsed and evaluated (this->root_node is set) */ void MainWindow::compileCSG(bool procevents) { @@ -994,7 +924,7 @@ void MainWindow::actionSaveAs() void MainWindow::actionReload() { - if (checkModified()) load(); + if (checkModified()) refreshDocument(); } void MainWindow::hideEditor() @@ -1034,16 +964,99 @@ void MainWindow::pasteViewportRotation() cursor.insertText(txt); } -void MainWindow::checkAutoReload() +void MainWindow::updateTemporalVariables() +{ + this->root_ctx.set_variable("$t", Value(this->e_tval->text().toDouble())); + + Value vpt; + vpt.type = Value::VECTOR; + vpt.append(new Value(-this->glview->object_trans_x)); + vpt.append(new Value(-this->glview->object_trans_y)); + vpt.append(new Value(-this->glview->object_trans_z)); + this->root_ctx.set_variable("$vpt", vpt); + + Value vpr; + vpr.type = Value::VECTOR; + vpr.append(new Value(fmodf(360 - this->glview->object_rot_x + 90, 360))); + vpr.append(new Value(fmodf(360 - this->glview->object_rot_y, 360))); + vpr.append(new Value(fmodf(360 - this->glview->object_rot_z, 360))); + root_ctx.set_variable("$vpr", vpr); +} + +bool MainWindow::fileChangedOnDisk() { if (!this->fileName.isEmpty()) { - QString new_stinfo; - QFileInfo finfo(this->fileName); - new_stinfo = QString::number(finfo.size()) + QString::number(finfo.lastModified().toTime_t()); - if (new_stinfo != autoReloadInfo) - actionReloadCompile(); - autoReloadInfo = new_stinfo; + struct stat st; + memset(&st, 0, sizeof(struct stat)); + stat(this->fileName.toLocal8Bit(), &st); + std::string newid = str(boost::format("%x.%x") % st.st_mtime % st.st_size); + + if (newid != this->autoReloadId) { + this->autoReloadId = newid; + return true; + } } + return false; +} + +/*! + If reload is true, does a timestamp check on the document and tries to reload it. + Otherwise, just reparses the current document and any dependencies, updates the + GUI accordingly and populates this->root_module. +*/ +void MainWindow::compileTopLevelDocument(bool reload) +{ + bool shouldcompiletoplevel = true; + + if (reload && fileChangedOnDisk()) { + if (!checkModified()) shouldcompiletoplevel = false; + refreshDocument(); + } + + if (shouldcompiletoplevel) { + updateTemporalVariables(); + + this->last_compiled_doc = editor->toPlainText(); + std::string fulltext = + this->last_compiled_doc.toStdString() + "\n" + commandline_commands; + + delete this->root_module; + this->root_module = NULL; + + this->root_module = parse(fulltext.c_str(), + this->fileName.isEmpty() ? + "" : + QFileInfo(this->fileName).absolutePath().toLocal8Bit(), + false); + + // Error highlighting + delete this->highlighter; + this->highlighter = NULL; + + if (!this->root_module) { + this->highlighter = new Highlighter(editor->document()); + + if (!animate_panel->isVisible()) { +#ifdef _QCODE_EDIT_ + QDocumentCursor cursor = editor->cursor(); + cursor.setPosition(parser_error_pos); +#else + QTextCursor cursor = editor->textCursor(); + cursor.setPosition(parser_error_pos); + editor->setTextCursor(cursor); +#endif + } + } + } + + if (this->root_module) this->root_module->handleDependencies(); +} + +void MainWindow::checkAutoReload() +{ + if (GuiLocker::isLocked()) return; + GuiLocker lock; + compile(true, true); } void MainWindow::autoReloadSet(bool on) @@ -1051,7 +1064,7 @@ void MainWindow::autoReloadSet(bool on) QSettings settings; settings.setValue("design/autoReload",designActionAutoReload->isChecked()); if (on) { - autoReloadInfo = QString(); + autoReloadId = ""; autoReloadTimer->start(200); } else { autoReloadTimer->stop(); @@ -1083,10 +1096,12 @@ void MainWindow::actionReloadCompile() console->clear(); - load(); + refreshDocument(); setCurrentOutput(); - compile(true); + PRINT("Parsing design (AST generation)..."); + QApplication::processEvents(); + compile(true, true); if (this->root_node) compileCSG(true); // Go to non-CGAL view mode @@ -1112,7 +1127,9 @@ void MainWindow::actionCompile() setCurrentOutput(); console->clear(); - compile(!viewActionAnimate->isChecked()); + PRINT("Parsing design (AST generation)..."); + QApplication::processEvents(); + compile(false, !viewActionAnimate->isChecked()); if (this->root_node) compileCSG(!viewActionAnimate->isChecked()); // Go to non-CGAL view mode @@ -1130,8 +1147,8 @@ void MainWindow::actionCompile() if (viewActionAnimate->isChecked() && e_dump->isChecked()) { QImage img = this->glview->grabFrameBuffer(); QString filename; - double s = e_fsteps->text().toDouble(); - double t = e_tval->text().toDouble(); + double s = this->e_fsteps->text().toDouble(); + double t = this->e_tval->text().toDouble(); filename.sprintf("frame%05d.png", int(round(s*t))); img.save(filename, "PNG"); } @@ -1149,7 +1166,9 @@ void MainWindow::actionRenderCGAL() setCurrentOutput(); console->clear(); - compile(true); + PRINT("Parsing design (AST generation)..."); + QApplication::processEvents(); + compile(false, true); if (!this->root_module || !this->root_node) { return; @@ -1559,7 +1578,7 @@ void MainWindow::animateUpdate() { if (animate_panel->isVisible()) { bool fps_ok; - double fps = e_fps->text().toDouble(&fps_ok); + double fps = this->e_fps->text().toDouble(&fps_ok); if (fps_ok && fps <= 0 && !animate_timer->isActive()) { animate_timer->stop(); animate_timer->setSingleShot(true); -- cgit v0.10.1 From 5d6a259a8b64810e3e6bae6c3da9e018e9d8927f Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Tue, 14 Feb 2012 21:22:48 -0500 Subject: Added vector math support. Added vector dot-product, matrix*vec, vec*matrix and matrix*matrix support. diff --git a/src/value.cc b/src/value.cc index 47fac1e..48fea1a 100644 --- a/src/value.cc +++ b/src/value.cc @@ -30,6 +30,7 @@ #include #include #include +#include "printutils.h" Value::Value() { @@ -157,6 +158,64 @@ Value Value::operator * (const Value &v) const if (this->type == NUMBER && v.type == NUMBER) { return Value(this->num * v.num); } + if (this->type == VECTOR && v.type == VECTOR && this->vec.size() == v.vec.size() ) { + if ( this->vec[0]->type == NUMBER && v.vec[0]->type == NUMBER ) { + // Vector dot product. + double r=0.0; + for (size_t i=0; i vec.size(); i++) { + if ( this->vec[i]->type != NUMBER || v.vec[i]->type != NUMBER ) return Value(); + r = r + (this->vec[i]->num * v.vec[i]->num); + } + return Value(r); + } else if ( this->vec[0]->type == VECTOR && v.vec[0]->type == NUMBER ) { + // Matrix * Vector + Value r; + r.type = VECTOR; + for ( size_t i=0; i < this->vec.size(); i++) { + double r_e=0.0; + if ( this->vec[i]->vec.size() != v.vec.size() ) return Value(); + for ( size_t j=0; j < this->vec[i]->vec.size(); j++) { + if ( this->vec[i]->vec[j]->type != NUMBER || v.vec[i]->type != NUMBER ) return Value(); + r_e = r_e + (this->vec[i]->vec[j]->num * v.vec[j]->num); + } + r.vec.push_back(new Value(r_e)); + } + return r; + } else if (this->vec[0]->type == NUMBER && v.vec[0]->type == VECTOR ) { + // Vector * Matrix + Value r; + r.type = VECTOR; + for ( size_t i=0; i < v.vec[0]->vec.size(); i++) { + double r_e=0.0; + for ( size_t j=0; j < v.vec.size(); j++) { + if ( v.vec[j]->vec.size() != v.vec[0]->vec.size() ) return Value(); + if ( this->vec[j]->type != NUMBER || v.vec[j]->vec[i]->type != NUMBER ) return Value(); + r_e = r_e + (this->vec[j]->num * v.vec[j]->vec[i]->num); + } + r.vec.push_back(new Value(r_e)); + } + return r; + } + } + if (this->type == VECTOR && v.type == VECTOR && this->vec[0]->type == VECTOR && v.vec[0]->type == VECTOR && this->vec[0]->vec.size() == v.vec.size() ) { + // Matrix * Matrix + Value rrow; + rrow.type = VECTOR; + for ( size_t i=0; i < this->vec.size(); i++ ) { + Value * rcol=new Value(); + rcol->type = VECTOR; + for ( size_t j=0; j < this->vec.size(); j++ ) { + double r_e=0.0; + for ( size_t k=0; k < v.vec.size(); k++ ) { + r_e = r_e + (this->vec[i]->vec[k]->num * v.vec[k]->vec[j]->num); + } + // PRINTB(" r_e = %s",r_e); + rcol->vec.push_back(new Value(r_e)); + } + rrow.vec.push_back(rcol); + } + return rrow; + } return Value(); } diff --git a/testdata/scad/misc/vector-values.scad b/testdata/scad/misc/vector-values.scad new file mode 100644 index 0000000..1872b39 --- /dev/null +++ b/testdata/scad/misc/vector-values.scad @@ -0,0 +1,40 @@ +// Value vector tests. + +a1=[0,1,2]; +b1=[3,4,5]; +c1=a1*b1; +echo(str("Testing vector dot product: ",c1)); + +d1=[1,0]; +echo(str(" Bounds check: ",a1*d1)); + +m2=[[0,1],[1,0]]; +v2=[2,3]; +p2=m2*v2; +echo(str("Testing matrix * vector: ",p2)); + +d2=[0,0,1]; +echo(str(" Bounds check: ",m2*d2)); + +m3=[[1,-1,1],[1,0,-1]]; +v3=[1,1]; +p3=v3*m3; +echo(str("Testing vector * matrix: ",p3)); + +echo(str(" Bounds check: ",m3*v3)); + +ma4=[ [1,0],[0,1] ]; +mb4=[ [1,0],[0,1] ]; +echo(str("Testing id matrix * id matrix: ",ma4*mb4)); + +ma5=[ [1, 0, 1] + ,[0, 1,-1] ]; +mb5=[ [1,0] + ,[0,1] + ,[1,1] ]; +echo(str("Testing asymmetric matrix * matrix: ",ma5*mb5)); +echo(str("Testing alternate asymmetric matrix * matrix: ",mb5*ma5)); + +echo(str(" Bounds check: ",ma5*ma4)); + +cube(1.0); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b81ce8c..4329795 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -608,7 +608,8 @@ list(APPEND ECHO_FILES ${FUNCTION_FILES} ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/builtin-tests.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/dim-all.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/string-test.scad - ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/string-indexing.scad) + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/string-indexing.scad + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/vector-values.scad) list(APPEND DUMPTEST_FILES ${MINIMAL_FILES} ${FEATURES_FILES} ${EXAMPLE_FILES}) list(APPEND DUMPTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/escape-test.scad diff --git a/tests/regression/echotest/vector-values-expected.txt b/tests/regression/echotest/vector-values-expected.txt new file mode 100644 index 0000000..7654892 --- /dev/null +++ b/tests/regression/echotest/vector-values-expected.txt @@ -0,0 +1,10 @@ +ECHO: "Testing vector dot product: 14" +ECHO: " Bounds check: undef" +ECHO: "Testing matrix * vector: [3, 2]" +ECHO: " Bounds check: undef" +ECHO: "Testing vector * matrix: [2, -1, 0]" +ECHO: " Bounds check: undef" +ECHO: "Testing id matrix * id matrix: [[1, 0], [0, 1]]" +ECHO: "Testing asymmetric matrix * matrix: [[2, 1], [-1, 0]]" +ECHO: "Testing alternate asymmetric matrix * matrix: [[1, 0, 1], [0, 1, -1], [1, 1, 0]]" +ECHO: " Bounds check: undef" -- cgit v0.10.1 From 505e8080671bdd54e03180f84ae155dffc9fc2bd Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Tue, 14 Feb 2012 23:04:40 -0500 Subject: Added search function Search for characters, strings and integers in a lookup table and return the index (or indices) for matches. diff --git a/src/func.cc b/src/func.cc index 6686cb9..1dc1364 100644 --- a/src/func.cc +++ b/src/func.cc @@ -33,6 +33,7 @@ #include "mathc99.h" #include #include "stl-utils.h" +#include "printutils.h" AbstractFunction::~AbstractFunction() { @@ -345,6 +346,148 @@ Value builtin_lookup(const Context *, const std::vector&, const std return Value(high_v * f + low_v * (1-f)); } +/* + Pattern: + + "search" "(" ( match_value | list_of_match_values ) "," vector_of_vectors + ("," num_returns_per_match + ("," index_col_num )? )? + ")"; + match_value : ( Value::NUMBER | Value::STRING ); + list_of_values : "[" match_value ("," match_value)* "]"; + vector_of_vectors : "[" ("[" Value ("," Value)* "]")+ "]"; + num_returns_per_match : int; + index_col_num : int; + + Examples: + Index values return as list: + search("a","abcdabcd"); + - returns [0,4] + search("a","abcdabcd",1); + - returns [0] + search("e","abcdabcd",1); + - returns [] + search("a",[ ["a",1],["b",2],["c",3],["d",4],["a",5],["b",6],["c",7],["d",8],["e",9] ]); + - returns [0,4] + + Search on different column; return Index values: + search(3,[ ["a",1],["b",2],["c",3],["d",4],["a",5],["b",6],["c",7],["d",8],["e",3] ], 0, 1); + - returns [0,8] + + Search on list of values: + Return all matches per search vector element: + search("abc",[ ["a",1],["b",2],["c",3],["d",4],["a",5],["b",6],["c",7],["d",8],["e",9] ], 0); + - returns [[0,4],[1,5],[2,6]] + + Return first match per search vector element; special case return vector: + search("abc",[ ["a",1],["b",2],["c",3],["d",4],["a",5],["b",6],["c",7],["d",8],["e",9] ], 1); + - returns [0,1,2] + + Return first two matches per search vector element; vector of vectors: + search("abce",[ ["a",1],["b",2],["c",3],["d",4],["a",5],["b",6],["c",7],["d",8],["e",9] ], 2); + - returns [[0,4],[1,5],[2,6],[8]] + +*/ +Value builtin_search(const Context *, const std::vector&, const std::vector &args) +{ + Value findThis; + Value searchTable; + Value returnVector; + returnVector.type = Value::VECTOR; + unsigned int num_returns_per_match = 1; + unsigned int index_col_num=0; + if (args.size() < 2 ) + return Value(); + findThis=args[0]; + // PRINTB(" builtin_search: findThis = %s",findThis); + searchTable=args[1]; + // PRINTB(" builtin_search: searchTable = %s",searchTable); + if ( args.size() > 2 ) num_returns_per_match=args[2].num; + if ( args.size() > 3 ) index_col_num=args[3].num; + if ( findThis.type==Value::NUMBER ) { + // PRINTB(" builtin_search: findThis type: NUMBER %s",findThis); + unsigned int matchCount=0; + Value *resultVector = new Value(); + resultVector->type = Value::VECTOR; + for (size_t j = 0; j < searchTable.vec.size(); j++) { + if ( searchTable.vec[j]->vec[index_col_num]->type==Value::NUMBER && findThis.num == searchTable.vec[j]->vec[index_col_num]->num ) { + Value *resultValue; + resultValue = new Value(double(j)); + returnVector.append(resultValue); + matchCount++; + if(num_returns_per_match!=0 && matchCount>=num_returns_per_match) break; + } + } + } else if ( findThis.type==Value::STRING ) { + //PRINTB(" builtin_search: findThis type STRING %s",findThis); + //PRINTB(" builtin_search: checking findThis.text.size()==%s",findThis.text.size()); + unsigned int searchTableSize; + if(searchTable.type == Value::STRING) { + searchTableSize=searchTable.text.size(); + } else { + searchTableSize=searchTable.vec.size(); + } + for (size_t i = 0; i < findThis.text.size(); i++) { + unsigned int matchCount=0; + Value *resultVector = new Value(); + resultVector->type = Value::VECTOR; + for (size_t j = 0; j < searchTableSize; j++) { + // PRINTB(" builtin_search: checking findThis.text[i]==%s",findThis.text[i]); + if ( searchTable.type==Value::VECTOR && findThis.text[i] == searchTable.vec[j]->vec[index_col_num]->text[0] + || searchTable.type==Value::STRING && findThis.text[i] == searchTable.text[j] + ) { + Value *resultValue; + resultValue = new Value(double(j)); + matchCount++; + if(num_returns_per_match==1) { + returnVector.append(resultValue); + break; + } else { + resultVector->append(resultValue); + } + if(num_returns_per_match>1 && matchCount>=num_returns_per_match) break; + } + } + if(matchCount==0) PRINTB(" search term not found: \"%s\"",findThis.text[i]); + if(num_returns_per_match==0 || num_returns_per_match>1) returnVector.append(resultVector); + } + ; + } else if ( findThis.type==Value::VECTOR ) { + // PRINTB(" builtin_search: findThis type: VECTOR %s",findThis); + for (size_t i = 0; i < findThis.vec.size(); i++) { + unsigned int matchCount=0; + Value *resultVector = new Value(); + resultVector->type = Value::VECTOR; + for (size_t j = 0; j < searchTable.vec.size(); j++) { + Value *resultValue; + resultValue = new Value(double(j)); + if ( findThis.vec[i]->type==Value::NUMBER && searchTable.vec[j]->vec[index_col_num]->type==Value::NUMBER && findThis.vec[i]->num == searchTable.vec[j]->vec[index_col_num]->num + || findThis.vec[i]->type==Value::STRING && searchTable.vec[j]->vec[index_col_num]->type==Value::STRING && findThis.vec[i]->text == searchTable.vec[j]->vec[index_col_num]->text ) { + resultValue = new Value(double(j)); + matchCount++; + if(num_returns_per_match==1) { + returnVector.append(resultValue); + break; + } else { + resultVector->append(resultValue); + } + if(num_returns_per_match>1 && matchCount>=num_returns_per_match) break; + } + } + if( num_returns_per_match==1 && matchCount==0 ) { + if(findThis.vec[i]->type==Value::NUMBER) PRINTB(" search term not found: %s",findThis.vec[i]->num); + if(findThis.vec[i]->type==Value::STRING) PRINTB(" search term not found: \"%s\"",findThis.vec[i]->text); + returnVector.append(resultVector); + } + if(num_returns_per_match==0 || num_returns_per_match>1) returnVector.append(resultVector); + } + } else { + PRINTB(" search: none performed on input %s",findThis); + return Value(); + } + return returnVector; +} + #define QUOTE(x__) # x__ #define QUOTED(x__) QUOTE(x__) @@ -397,6 +540,7 @@ void register_builtin_functions() Builtins::init("ln", new BuiltinFunction(&builtin_ln)); Builtins::init("str", new BuiltinFunction(&builtin_str)); Builtins::init("lookup", new BuiltinFunction(&builtin_lookup)); + Builtins::init("search", new BuiltinFunction(&builtin_search)); Builtins::init("version", new BuiltinFunction(&builtin_version)); Builtins::init("version_num", new BuiltinFunction(&builtin_version_num)); } diff --git a/testdata/scad/misc/search-tests.scad b/testdata/scad/misc/search-tests.scad new file mode 100644 index 0000000..fb85109 --- /dev/null +++ b/testdata/scad/misc/search-tests.scad @@ -0,0 +1,63 @@ +// string searches + +simpleSearch1=search("a","abcdabcd"); +echo(str("Characters in string (\"a\"): ",simpleSearch1)); + +simpleSearch2=search("adeq","abcdeabcd",0); +echo(str("Characters in string (\"adeq\"): ",simpleSearch2)); + +sTable1=[ ["a",1],["b",2],["c",3],["d",4],["a",5],["b",6],["c",7],["d",8],["e",9] ]; +s1= search("abe",sTable1); +echo(str("Default string search (\"abe\"): ",s1)); + +sTable2=[ ["a",1],["b",2],["c",3],["d",4],["a",5],["b",6],["c",7],["d",8],["e",9],["a",10],["a",11] ]; +s2= search("abe",sTable2,0); +echo(str("Return all matches for string search (\"abe\"): ",s2)); + +sTable3=[ ["a",1],["b",2],["c",3],["d",4],["a",5],["b",6],["c",7],["d",8],["e",9],["a",10],["a",11] ]; +s3= search("abe",sTable3,2); +echo(str("Return up to 2 matches for string search (\"abe\"): ",s3)); + +sTable4=[ [1,"a",[20]],[2,"b",21],[3,"c",22],[4,"d",23],[5,"a",24],[6,"b",25],[7,"c",26],[8,"d",27],[9,"e",28],[10,"a",29],[11,"a",30] ]; +s4= search("aebe",sTable4,2,1); +echo(str("Return up to 2 matches for string search; alternate columns (\"aebe\"): ",s4)); + +// s5= search("abe",sTable4,2,1,3); // bounds checking needs fixing. +// echo(str("Return up to 2 matches for string search; alternate columns: ",s4)); + + +// number searches +nTable1=[ [1,"a"],[3,"b"],[2,"c"],[4,"d"],[1,"a"],[7,"b"],[2,"c"],[8,"d"],[9,"e"],[10,"a"],[1,"a"] ]; +n1 = search(7,nTable1); +echo(str("Default number search (7): ",n1)); +n2 = search(1,nTable1,0); +echo(str("Return all matches for number search (1): ",n2)); +n3 = search(1,nTable1,2); +echo(str("Return up to 2 matches for number search (1): ",n3)); + +// list searches +lTable1=[ [1,"a"],[3,"b"],[2,"c"],[4,"d"],[1,"a"],[7,"b"],[2,"c"],[8,"d"],[9,"e"],[10,"a"],[1,"a"] ]; +lSearch1=[1,3,1000]; +l1=search(lSearch1,lTable1); +echo(str("Default list number search (",lSearch1,"): ",l1)); + +lTable2=[ ["cat",1],["b",2],["c",3],["dog",4],["a",5],["b",6],["c",7],["d",8],["e",9],["apple",10],["a",11] ]; +lSearch2=["b","zzz","a","c","apple","dog"]; +l2=search(lSearch2,lTable2); +echo(str("Default list string search (",lSearch2,"): ",l2)); + +lTable3=[ ["cat",1],["b",2],["c",3],[4,"dog"],["a",5],["b",6],["c",7],["d",8],["e",9],["apple",10],["a",11] ]; +lSearch3=["b",4,"zzz","c","apple",500,"a",""]; +l3=search(lSearch3,lTable3); +echo(str("Default list mixed search (",lSearch3,"): ",l3)); + +l4=search(lSearch3,lTable3,0); +echo(str("Return all matches for mixed search (",lSearch3,"): ",l4)); + +lSearch5=[1,"zz","dog",500,11]; +l5=search(lSearch5,lTable3,0,1); +echo(str("Return all matches for mixed search; alternate columns (",lSearch5,"): ",l5)); + + +// for completeness +cube(1.0); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4329795..f8c66d8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -609,7 +609,8 @@ list(APPEND ECHO_FILES ${FUNCTION_FILES} ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/dim-all.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/string-test.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/string-indexing.scad - ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/vector-values.scad) + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/vector-values.scad + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/search-tests.scad) list(APPEND DUMPTEST_FILES ${MINIMAL_FILES} ${FEATURES_FILES} ${EXAMPLE_FILES}) list(APPEND DUMPTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/escape-test.scad diff --git a/tests/regression/echotest/search-tests-expected.txt b/tests/regression/echotest/search-tests-expected.txt new file mode 100644 index 0000000..64df0b6 --- /dev/null +++ b/tests/regression/echotest/search-tests-expected.txt @@ -0,0 +1,20 @@ + search term not found: "q" + search term not found: 1000 + search term not found: "zzz" + search term not found: "zzz" + search term not found: 500 + search term not found: "" +ECHO: "Characters in string (\"a\"): [0]" +ECHO: "Characters in string (\"adeq\"): [[0, 5], [3, 8], [4], []]" +ECHO: "Default string search (\"abe\"): [0, 1, 8]" +ECHO: "Return all matches for string search (\"abe\"): [[0, 4, 9, 10], [1, 5], [8]]" +ECHO: "Return up to 2 matches for string search (\"abe\"): [[0, 4], [1, 5], [8]]" +ECHO: "Return up to 2 matches for string search; alternate columns (\"aebe\"): [[0, 4], [8], [1, 5], [8]]" +ECHO: "Default number search (7): [5]" +ECHO: "Return all matches for number search (1): [0, 4, 10]" +ECHO: "Return up to 2 matches for number search (1): [0, 4]" +ECHO: "Default list number search ([1, 3, 1000]): [0, 1, []]" +ECHO: "Default list string search ([\"b\", \"zzz\", \"a\", \"c\", \"apple\", \"dog\"]): [1, [], 4, 2, 9, 3]" +ECHO: "Default list mixed search ([\"b\", 4, \"zzz\", \"c\", \"apple\", 500, \"a\", \"\"]): [1, 3, [], 2, 9, [], 4, []]" +ECHO: "Return all matches for mixed search ([\"b\", 4, \"zzz\", \"c\", \"apple\", 500, \"a\", \"\"]): [[1, 5], [3], [], [2, 6], [9], [], [4, 10], []]" +ECHO: "Return all matches for mixed search; alternate columns ([1, \"zz\", \"dog\", 500, 11]): [[0], [], [3], [], [10]]" -- cgit v0.10.1 From 32a408f594e01400ec5ce941481120bdf76bb762 Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Wed, 15 Feb 2012 00:10:36 -0500 Subject: Test using search() and MCAD/fonts.scad A more comprehensive test that exercises the search function and MCAD/fonts.scad approach to text rendering together. diff --git a/testdata/scad/features/text-search-test.scad b/testdata/scad/features/text-search-test.scad new file mode 100644 index 0000000..8b6047f --- /dev/null +++ b/testdata/scad/features/text-search-test.scad @@ -0,0 +1,29 @@ +// fonts test + +use + +thisFont=8bit_polyfont(); +thisText="OpenSCAD Rocks!"; +// Find one letter matches from 2nd column (index 1) +theseIndicies=search(thisText,thisFont[2],1,1); +// Letter spacing, x direction. +x_shift=thisFont[0][0]; +y_shift=thisFont[0][1]; +echo(theseIndicies); +// Simple polygon usage. +for(i=[0:len(theseIndicies)-1]) translate([i*x_shift-len(theseIndicies)*x_shift/2,0]) { + polygon(points=thisFont[2][theseIndicies[i]][6][0],paths=thisFont[2][theseIndicies[i]][6][1]); +} + +theseIndicies2=search("ABC",thisFont[2],1,1); +// outline_2d() example +for(i=[0:len(theseIndicies2)-1]) translate([i*x_shift-len(theseIndicies2)*x_shift,-y_shift]) { + outline_2d(outline=true,points=thisFont[2][theseIndicies2[i]][6][0],paths=thisFont[2][theseIndicies2[i]][6][1],width=0.25); +} + +theseIndicies3=search("123",thisFont[2],1,1); +// bold_2d() outline_2d(false) example +for(i=[0:len(theseIndicies3)-1]) translate([i*x_shift,-2*y_shift]) { + bold_2d(bold=true,width=0.25,resolution=8) + outline_2d(false,thisFont[2][theseIndicies3[i]][6][0],thisFont[2][theseIndicies3[i]][6][1]); +} \ No newline at end of file diff --git a/tests/regression/cgalpngtest/text-search-test-expected.png b/tests/regression/cgalpngtest/text-search-test-expected.png new file mode 100644 index 0000000..76e7087 Binary files /dev/null and b/tests/regression/cgalpngtest/text-search-test-expected.png differ diff --git a/tests/regression/dumptest/text-search-test-expected.txt b/tests/regression/dumptest/text-search-test-expected.txt new file mode 100644 index 0000000..f0c8aad --- /dev/null +++ b/tests/regression/dumptest/text-search-test-expected.txt @@ -0,0 +1,848 @@ + group(); + group() { + multmatrix([[1, 0, 0, -60], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[2, 1], [2, 2], [1, 2], [1, 6], [2, 6], [2, 7], [6, 7], [6, 6], [7, 6], [7, 2], [6, 2], [6, 1], [3, 2], [3, 6], [5, 6], [5, 2]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [12, 13, 14, 15]], convexity = 1); + } + multmatrix([[1, 0, 0, -52], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[1, 0], [1, 6], [6, 6], [6, 5], [7, 5], [7, 3], [6, 3], [6, 2], [3, 2], [3, 0], [3, 3], [3, 5], [5, 5], [5, 3]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [10, 11, 12, 13]], convexity = 1); + } + multmatrix([[1, 0, 0, -44], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[2, 1], [2, 2], [1, 2], [1, 5], [2, 5], [2, 6], [6, 6], [6, 5], [7, 5], [7, 3], [3, 3], [3, 2], [6, 2], [6, 1], [3, 4], [3, 5], [5, 5], [5, 4]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [14, 15, 16, 17]], convexity = 1); + } + multmatrix([[1, 0, 0, -36], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[1, 1], [1, 6], [6, 6], [6, 5], [7, 5], [7, 1], [5, 1], [5, 5], [3, 5], [3, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], convexity = 1); + } + multmatrix([[1, 0, 0, -28], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[2, 1], [2, 2], [5, 2], [5, 4], [2, 4], [2, 5], [1, 5], [1, 6], [2, 6], [2, 7], [6, 7], [6, 6], [3, 6], [3, 5], [6, 5], [6, 4], [7, 4], [7, 2], [6, 2], [6, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]], convexity = 1); + } + multmatrix([[1, 0, 0, -20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[2, 1], [2, 2], [1, 2], [1, 6], [2, 6], [2, 7], [6, 7], [6, 6], [7, 6], [7, 5], [5, 5], [5, 6], [3, 6], [3, 2], [5, 2], [5, 3], [7, 3], [7, 2], [6, 2], [6, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]], convexity = 1); + } + multmatrix([[1, 0, 0, -12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[1, 1], [1, 5], [2, 5], [2, 6], [3, 6], [3, 7], [5, 7], [5, 6], [6, 6], [6, 5], [7, 5], [7, 1], [5, 1], [5, 2], [3, 2], [3, 1], [3, 3], [3, 5], [5, 5], [5, 3]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [16, 17, 18, 19]], convexity = 1); + } + multmatrix([[1, 0, 0, -4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[1, 1], [1, 7], [5, 7], [5, 6], [6, 6], [6, 5], [7, 5], [7, 3], [6, 3], [6, 2], [5, 2], [5, 1], [3, 2], [3, 6], [4, 6], [4, 5], [5, 5], [5, 3], [4, 3], [4, 2]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [12, 13, 14, 15, 16, 17, 18, 19]], convexity = 1); + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = undef, paths = undef, convexity = 1); + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[1, 1], [1, 7], [6, 7], [6, 6], [7, 6], [7, 4], [6, 4], [6, 2], [7, 2], [7, 1], [5, 1], [5, 2], [4, 2], [4, 3], [3, 3], [3, 1], [3, 4], [3, 6], [5, 6], [5, 4]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [16, 17, 18, 19]], convexity = 1); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[2, 1], [2, 2], [1, 2], [1, 5], [2, 5], [2, 6], [6, 6], [6, 5], [7, 5], [7, 2], [6, 2], [6, 1], [3, 2], [3, 5], [5, 5], [5, 2]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [12, 13, 14, 15]], convexity = 1); + } + multmatrix([[1, 0, 0, 28], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[2, 1], [2, 2], [1, 2], [1, 5], [2, 5], [2, 6], [6, 6], [6, 5], [3, 5], [3, 2], [6, 2], [6, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]], convexity = 1); + } + multmatrix([[1, 0, 0, 36], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[1, 1], [1, 7], [3, 7], [3, 4], [4, 4], [4, 5], [6, 5], [6, 4], [5, 4], [5, 3], [6, 3], [6, 2], [7, 2], [7, 1], [5, 1], [5, 2], [4, 2], [4, 3], [3, 3], [3, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]], convexity = 1); + } + multmatrix([[1, 0, 0, 44], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[1, 1], [1, 2], [5, 2], [5, 3], [2, 3], [2, 4], [1, 4], [1, 5], [2, 5], [2, 6], [7, 6], [7, 5], [3, 5], [3, 4], [6, 4], [6, 3], [7, 3], [7, 2], [6, 2], [6, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]], convexity = 1); + } + multmatrix([[1, 0, 0, 52], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[3, 1], [3, 2], [5, 2], [5, 1], [3, 3], [3, 7], [5, 7], [5, 3]], paths = [[0, 1, 2, 3], [4, 5, 6, 7]], convexity = 1); + } + } + group() { + multmatrix([[1, 0, 0, -24], [0, 1, 0, -8], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + group() { + union() { + group() { + hull() { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 2], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 2], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 3], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 3], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 5], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 5], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 6], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 6], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 7], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 7], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 5], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 5], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 3], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + } + hull() { + multmatrix([[1, 0, 0, 3], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + } + union() { + group() { + hull() { + multmatrix([[1, 0, 0, 3], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 3], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 5], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + } + hull() { + multmatrix([[1, 0, 0, 5], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + } + } + } + } + } + multmatrix([[1, 0, 0, -16], [0, 1, 0, -8], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + group() { + union() { + group() { + hull() { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 6], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 6], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 7], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 7], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 6], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 6], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 7], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 7], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 6], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + } + hull() { + multmatrix([[1, 0, 0, 6], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + } + union() { + group() { + hull() { + multmatrix([[1, 0, 0, 3], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 3], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 5], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + } + hull() { + multmatrix([[1, 0, 0, 5], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + } + union() { + group() { + hull() { + multmatrix([[1, 0, 0, 3], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 3], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 5], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + } + hull() { + multmatrix([[1, 0, 0, 5], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + } + } + } + } + } + multmatrix([[1, 0, 0, -8], [0, 1, 0, -8], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + group() { + union() { + group() { + hull() { + multmatrix([[1, 0, 0, 2], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 2], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 2], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 2], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 6], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 6], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 7], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 7], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 5], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 5], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 3], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 3], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 5], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 5], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 7], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 7], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + hull() { + multmatrix([[1, 0, 0, 6], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + } + hull() { + multmatrix([[1, 0, 0, 6], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 2, r = 0.125); + } + } + } + } + } + } + } + } + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, -16], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + group() { + union() { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [3, 2], [3, 5], [2, 5], [2, 6], [3, 6], [3, 7], [5, 7], [5, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]], convexity = 1); + } + } + group() { + group() { + multmatrix([[1, 0, 0, 0.25], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [3, 2], [3, 5], [2, 5], [2, 6], [3, 6], [3, 7], [5, 7], [5, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, 0.176777], [0, 1, 0, 0.176777], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [3, 2], [3, 5], [2, 5], [2, 6], [3, 6], [3, 7], [5, 7], [5, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, 1.53081e-17], [0, 1, 0, 0.25], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [3, 2], [3, 5], [2, 5], [2, 6], [3, 6], [3, 7], [5, 7], [5, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, -0.176777], [0, 1, 0, 0.176777], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [3, 2], [3, 5], [2, 5], [2, 6], [3, 6], [3, 7], [5, 7], [5, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, -0.25], [0, 1, 0, 3.06162e-17], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [3, 2], [3, 5], [2, 5], [2, 6], [3, 6], [3, 7], [5, 7], [5, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, -0.176777], [0, 1, 0, -0.176777], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [3, 2], [3, 5], [2, 5], [2, 6], [3, 6], [3, 7], [5, 7], [5, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, -4.59243e-17], [0, 1, 0, -0.25], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [3, 2], [3, 5], [2, 5], [2, 6], [3, 6], [3, 7], [5, 7], [5, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, 0.176777], [0, 1, 0, -0.176777], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [3, 2], [3, 5], [2, 5], [2, 6], [3, 6], [3, 7], [5, 7], [5, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]], convexity = 1); + } + } + } + } + } + } + } + } + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, -16], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + group() { + union() { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [2, 2], [2, 3], [3, 3], [3, 4], [4, 4], [4, 5], [5, 5], [5, 6], [3, 6], [3, 5], [1, 5], [1, 6], [2, 6], [2, 7], [6, 7], [6, 6], [7, 6], [7, 5], [6, 5], [6, 4], [5, 4], [5, 3], [4, 3], [4, 2], [3, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]], convexity = 1); + } + } + group() { + group() { + multmatrix([[1, 0, 0, 0.25], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [2, 2], [2, 3], [3, 3], [3, 4], [4, 4], [4, 5], [5, 5], [5, 6], [3, 6], [3, 5], [1, 5], [1, 6], [2, 6], [2, 7], [6, 7], [6, 6], [7, 6], [7, 5], [6, 5], [6, 4], [5, 4], [5, 3], [4, 3], [4, 2], [3, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, 0.176777], [0, 1, 0, 0.176777], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [2, 2], [2, 3], [3, 3], [3, 4], [4, 4], [4, 5], [5, 5], [5, 6], [3, 6], [3, 5], [1, 5], [1, 6], [2, 6], [2, 7], [6, 7], [6, 6], [7, 6], [7, 5], [6, 5], [6, 4], [5, 4], [5, 3], [4, 3], [4, 2], [3, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, 1.53081e-17], [0, 1, 0, 0.25], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [2, 2], [2, 3], [3, 3], [3, 4], [4, 4], [4, 5], [5, 5], [5, 6], [3, 6], [3, 5], [1, 5], [1, 6], [2, 6], [2, 7], [6, 7], [6, 6], [7, 6], [7, 5], [6, 5], [6, 4], [5, 4], [5, 3], [4, 3], [4, 2], [3, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, -0.176777], [0, 1, 0, 0.176777], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [2, 2], [2, 3], [3, 3], [3, 4], [4, 4], [4, 5], [5, 5], [5, 6], [3, 6], [3, 5], [1, 5], [1, 6], [2, 6], [2, 7], [6, 7], [6, 6], [7, 6], [7, 5], [6, 5], [6, 4], [5, 4], [5, 3], [4, 3], [4, 2], [3, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, -0.25], [0, 1, 0, 3.06162e-17], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [2, 2], [2, 3], [3, 3], [3, 4], [4, 4], [4, 5], [5, 5], [5, 6], [3, 6], [3, 5], [1, 5], [1, 6], [2, 6], [2, 7], [6, 7], [6, 6], [7, 6], [7, 5], [6, 5], [6, 4], [5, 4], [5, 3], [4, 3], [4, 2], [3, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, -0.176777], [0, 1, 0, -0.176777], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [2, 2], [2, 3], [3, 3], [3, 4], [4, 4], [4, 5], [5, 5], [5, 6], [3, 6], [3, 5], [1, 5], [1, 6], [2, 6], [2, 7], [6, 7], [6, 6], [7, 6], [7, 5], [6, 5], [6, 4], [5, 4], [5, 3], [4, 3], [4, 2], [3, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, -4.59243e-17], [0, 1, 0, -0.25], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [2, 2], [2, 3], [3, 3], [3, 4], [4, 4], [4, 5], [5, 5], [5, 6], [3, 6], [3, 5], [1, 5], [1, 6], [2, 6], [2, 7], [6, 7], [6, 6], [7, 6], [7, 5], [6, 5], [6, 4], [5, 4], [5, 3], [4, 3], [4, 2], [3, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, 0.176777], [0, 1, 0, -0.176777], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[1, 1], [1, 2], [2, 2], [2, 3], [3, 3], [3, 4], [4, 4], [4, 5], [5, 5], [5, 6], [3, 6], [3, 5], [1, 5], [1, 6], [2, 6], [2, 7], [6, 7], [6, 6], [7, 6], [7, 5], [6, 5], [6, 4], [5, 4], [5, 3], [4, 3], [4, 2], [3, 2], [7, 2], [7, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]], convexity = 1); + } + } + } + } + } + } + } + } + } + } + multmatrix([[1, 0, 0, 16], [0, 1, 0, -16], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + group() { + union() { + group() { + group() { + polygon(points = [[2, 1], [2, 2], [1, 2], [1, 3], [3, 3], [3, 2], [5, 2], [5, 3], [4, 3], [4, 4], [3, 4], [3, 5], [4, 5], [4, 6], [1, 6], [1, 7], [7, 7], [7, 6], [6, 6], [6, 5], [5, 5], [5, 4], [6, 4], [6, 3], [7, 3], [7, 2], [6, 2], [6, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]], convexity = 1); + } + } + group() { + group() { + multmatrix([[1, 0, 0, 0.25], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[2, 1], [2, 2], [1, 2], [1, 3], [3, 3], [3, 2], [5, 2], [5, 3], [4, 3], [4, 4], [3, 4], [3, 5], [4, 5], [4, 6], [1, 6], [1, 7], [7, 7], [7, 6], [6, 6], [6, 5], [5, 5], [5, 4], [6, 4], [6, 3], [7, 3], [7, 2], [6, 2], [6, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, 0.176777], [0, 1, 0, 0.176777], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[2, 1], [2, 2], [1, 2], [1, 3], [3, 3], [3, 2], [5, 2], [5, 3], [4, 3], [4, 4], [3, 4], [3, 5], [4, 5], [4, 6], [1, 6], [1, 7], [7, 7], [7, 6], [6, 6], [6, 5], [5, 5], [5, 4], [6, 4], [6, 3], [7, 3], [7, 2], [6, 2], [6, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, 1.53081e-17], [0, 1, 0, 0.25], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[2, 1], [2, 2], [1, 2], [1, 3], [3, 3], [3, 2], [5, 2], [5, 3], [4, 3], [4, 4], [3, 4], [3, 5], [4, 5], [4, 6], [1, 6], [1, 7], [7, 7], [7, 6], [6, 6], [6, 5], [5, 5], [5, 4], [6, 4], [6, 3], [7, 3], [7, 2], [6, 2], [6, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, -0.176777], [0, 1, 0, 0.176777], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[2, 1], [2, 2], [1, 2], [1, 3], [3, 3], [3, 2], [5, 2], [5, 3], [4, 3], [4, 4], [3, 4], [3, 5], [4, 5], [4, 6], [1, 6], [1, 7], [7, 7], [7, 6], [6, 6], [6, 5], [5, 5], [5, 4], [6, 4], [6, 3], [7, 3], [7, 2], [6, 2], [6, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, -0.25], [0, 1, 0, 3.06162e-17], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[2, 1], [2, 2], [1, 2], [1, 3], [3, 3], [3, 2], [5, 2], [5, 3], [4, 3], [4, 4], [3, 4], [3, 5], [4, 5], [4, 6], [1, 6], [1, 7], [7, 7], [7, 6], [6, 6], [6, 5], [5, 5], [5, 4], [6, 4], [6, 3], [7, 3], [7, 2], [6, 2], [6, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, -0.176777], [0, 1, 0, -0.176777], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[2, 1], [2, 2], [1, 2], [1, 3], [3, 3], [3, 2], [5, 2], [5, 3], [4, 3], [4, 4], [3, 4], [3, 5], [4, 5], [4, 6], [1, 6], [1, 7], [7, 7], [7, 6], [6, 6], [6, 5], [5, 5], [5, 4], [6, 4], [6, 3], [7, 3], [7, 2], [6, 2], [6, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, -4.59243e-17], [0, 1, 0, -0.25], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[2, 1], [2, 2], [1, 2], [1, 3], [3, 3], [3, 2], [5, 2], [5, 3], [4, 3], [4, 4], [3, 4], [3, 5], [4, 5], [4, 6], [1, 6], [1, 7], [7, 7], [7, 6], [6, 6], [6, 5], [5, 5], [5, 4], [6, 4], [6, 3], [7, 3], [7, 2], [6, 2], [6, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]], convexity = 1); + } + } + } + } + group() { + multmatrix([[1, 0, 0, 0.176777], [0, 1, 0, -0.176777], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + polygon(points = [[2, 1], [2, 2], [1, 2], [1, 3], [3, 3], [3, 2], [5, 2], [5, 3], [4, 3], [4, 4], [3, 4], [3, 5], [4, 5], [4, 6], [1, 6], [1, 7], [7, 7], [7, 6], [6, 6], [6, 5], [5, 5], [5, 4], [6, 4], [6, 3], [7, 3], [7, 2], [6, 2], [6, 1]], paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]], convexity = 1); + } + } + } + } + } + } + } + } + } + } + } + diff --git a/tests/regression/opencsgtest/text-search-test-expected.png b/tests/regression/opencsgtest/text-search-test-expected.png new file mode 100644 index 0000000..eadd61e Binary files /dev/null and b/tests/regression/opencsgtest/text-search-test-expected.png differ diff --git a/tests/regression/throwntogethertest/text-search-test-expected.png b/tests/regression/throwntogethertest/text-search-test-expected.png new file mode 100644 index 0000000..eadd61e Binary files /dev/null and b/tests/regression/throwntogethertest/text-search-test-expected.png differ -- cgit v0.10.1 From 6845399e497726958d51170f906474e2624848c4 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 15 Feb 2012 12:36:13 +0100 Subject: Print info about module cache size diff --git a/src/ModuleCache.h b/src/ModuleCache.h index 57ff2e7..25ae192 100644 --- a/src/ModuleCache.h +++ b/src/ModuleCache.h @@ -6,6 +6,7 @@ class ModuleCache public: static ModuleCache *instance() { if (!inst) inst = new ModuleCache; return inst; } class Module *evaluate(const std::string &filename); + size_t size() { return this->entries.size(); } void clear(); private: diff --git a/src/mainwin.cc b/src/mainwin.cc index 688d935..3708013 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -650,9 +650,6 @@ void MainWindow::compile(bool reload, bool procevents) // Dump the tree (to initialize caches). // FIXME: We shouldn't really need to do this explicitly.. this->tree.getString(*this->root_node); - - PRINT("Compilation finished."); - if (procevents) QApplication::processEvents(); } } @@ -1049,7 +1046,10 @@ void MainWindow::compileTopLevelDocument(bool reload) } } - if (this->root_module) this->root_module->handleDependencies(); + if (this->root_module) { + this->root_module->handleDependencies(); + PRINTB("Module cache size: %d modules", ModuleCache::instance()->size()); + } } void MainWindow::checkAutoReload() -- cgit v0.10.1 From 5edb7d9b8d294ad53358f9a805f8f249b0975139 Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Wed, 15 Feb 2012 08:42:53 -0500 Subject: Replaced static paths with $$PWD and $QTDIR Hand-editing openscad.pro.user to make all paths relative to $$PWD (the location of openscad.pro) and $QTDIR works. diff --git a/openscad.pro.user b/openscad.pro.user index e53f571..087d6e6 100644 --- a/openscad.pro.user +++ b/openscad.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget @@ -103,7 +103,7 @@ Qt4ProjectManager.Qt4BuildConfiguration 0 - /Users/clothbot/Projects/github/clothbot/openscad-build-desktop + $$PWD/../openscad-build-desktop -1 true @@ -124,7 +124,7 @@ Qt4ProjectManager.MakeStep false - + -j4 2 @@ -151,14 +151,14 @@ OPENSCAD_LIBRARIES=$$PWD/../libraries/install CCACHE_BASEDIR=$$PWD/.. - PATH=/opt/local/libexec/ccache:/usr/bin:/Users/clothbot/QtSDK/Desktop/Qt/474/gcc/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin + PATH=/opt/local/libexec/ccache:/usr/bin:$QTDIR/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin EIGEN2DIR=$$PWD/../libraries/install/include/eigen2 Desktop Qt 4.7.4 for GCC (Qt SDK) Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - /Users/clothbot/Projects/github/clothbot/openscad + $$PWD 3 false @@ -208,7 +208,7 @@ Qt4ProjectManager.Qt4BuildConfiguration 2 - /Users/clothbot/Projects/github/clothbot/openscad-build-desktop + $$PWD/../openscad-build-desktop -1 true @@ -258,7 +258,7 @@ Qt4ProjectManager.Qt4BuildConfiguration 0 - /Users/clothbot/Projects/github/clothbot/openscad-build-desktop + $$PWD/../openscad-build-desktop -1 true @@ -310,7 +310,7 @@ Desktop Qt 4.7.4 for GCC (Qt SDK) Qt4ProjectManager.Qt4BuildConfiguration 0 - /Users/clothbot/Projects/github/clothbot/openscad-release-desktop + $$PWD/../openscad-release-desktop 3 true -- cgit v0.10.1 From 2e7a27f64416b3bb5b8e0a5d2969292cbacde7b6 Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Wed, 15 Feb 2012 13:12:11 -0500 Subject: Setting QTDIR via qmake -query For CLI purposes, set QTDIR based on qmake query and prepend it on $PATH. diff --git a/setenv_mjau.sh b/setenv_mjau.sh index 3b9fd92..61e10d5 100644 --- a/setenv_mjau.sh +++ b/setenv_mjau.sh @@ -6,6 +6,9 @@ export DYLD_LIBRARY_PATH=$OPENSCAD_LIBRARIES/lib #export QCODEEDITDIR=$PWD/../qcodeedit-2.2.3/install #export DYLD_LIBRARY_PATH=$OPENCSGDIR/lib:$QCODEEDITDIR/lib +export QTDIR=`qmake -query "QT_INSTALL_PREFIX"` +export PATH=$QTDIR/bin:$PATH + # ccache: export PATH=/opt/local/libexec/ccache:$PATH export CCACHE_BASEDIR=$PWD/.. -- cgit v0.10.1 From 068632fe2bbe9a2f8fe1fcebe2d05a0eba94b0f0 Mon Sep 17 00:00:00 2001 From: tjhowse Date: Thu, 16 Feb 2012 17:18:09 +1000 Subject: Added licensing information. diff --git a/contrib/OpenSCAD.xml b/contrib/OpenSCAD.xml index 7c6cf76..e632887 100644 --- a/contrib/OpenSCAD.xml +++ b/contrib/OpenSCAD.xml @@ -1,3 +1,5 @@ + + -- cgit v0.10.1 From f615f3a5e1344bbb05f56614d959fdb2779e164c Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Fri, 17 Feb 2012 20:50:26 +0100 Subject: Added matrix/vector multiplication diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 8d66ad9..a78fa7b 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -5,6 +5,8 @@ Features: o Snappier GUI while performing CGAL computations (computations running in separate thread) o The size of the misc. caches can now be adjusted from Preferences o The limit for when to disable OpenCSG can now be adjusted from Preferences +o Added Dot product operator: vec * vec +o Added Matrix multiplication operator: vec * mat, mat * mat Bugfixes: o use'ing an non-existing file sometimes crashed under Windows -- cgit v0.10.1 From f71e9cf7922d5d6e28fa52563660bc7eeaa9fbe7 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Fri, 17 Feb 2012 21:08:55 +0100 Subject: missing include boost/version.hpp diff --git a/src/mainwin.cc b/src/mainwin.cc index 9b24eea..b371742 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -77,6 +77,7 @@ #include #include +#include #include #include #include -- cgit v0.10.1 From 2316127e62ba4c4c0e49cd35d869fcaeca357a29 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Fri, 17 Feb 2012 23:05:36 +0100 Subject: Handle include dependencies diff --git a/src/MainWindow.h b/src/MainWindow.h index 4110b45..ed12f34 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -77,8 +77,8 @@ private: AbstractNode *find_root_tag(AbstractNode *n); void updateTemporalVariables(); bool fileChangedOnDisk(); - void compileTopLevelDocument(bool reload); - void compile(bool reload, bool procevents); + bool compileTopLevelDocument(bool reload); + bool compile(bool reload, bool procevents); void compileCSG(bool procevents); bool maybeSave(); bool checkModified(); diff --git a/src/ModuleCache.cc b/src/ModuleCache.cc index 7a0fe51..e974a03 100644 --- a/src/ModuleCache.cc +++ b/src/ModuleCache.cc @@ -6,10 +6,12 @@ #include "boosty.h" #include #include +#include #include #include #include +#include #include /*! @@ -18,10 +20,18 @@ ModuleCache *ModuleCache::inst = NULL; +static bool is_modified(const std::string &filename, const time_t &mtime) +{ + struct stat st; + memset(&st, 0, sizeof(struct stat)); + stat(filename.c_str(), &st); + return (st.st_mtime > mtime); +} + Module *ModuleCache::evaluate(const std::string &filename) { Module *lib_mod = NULL; - + // Create cache ID struct stat st; memset(&st, 0, sizeof(struct stat)); @@ -35,8 +45,14 @@ Module *ModuleCache::evaluate(const std::string &filename) #ifdef DEBUG PRINTB("Using cached library: %s (%s)", filename % cache_id); #endif - PRINTB("%s", this->entries[filename].msg); lib_mod = &(*this->entries[filename].module); + + BOOST_FOREACH(const Module::IncludeContainer::value_type &item, lib_mod->includes) { + if (is_modified(item.first, item.second)) { + lib_mod = NULL; + break; + } + } } // If cache lookup failed (non-existing or old timestamp), compile module @@ -59,9 +75,10 @@ Module *ModuleCache::evaluate(const std::string &filename) print_messages_push(); - cache_entry e = { NULL, cache_id, std::string("WARNING: Library `") + filename + "' tries to recursively use itself!" }; - if (this->entries.find(filename) != this->entries.end()) + cache_entry e = { NULL, cache_id }; + if (this->entries.find(filename) != this->entries.end()) { delete this->entries[filename].module; + } this->entries[filename] = e; std::string pathname = boosty::stringy(fs::path(filename).parent_path()); @@ -69,7 +86,6 @@ Module *ModuleCache::evaluate(const std::string &filename) if (lib_mod) { this->entries[filename].module = lib_mod; - this->entries[filename].msg = print_messages_stack.back(); } else { this->entries.erase(filename); } diff --git a/src/ModuleCache.h b/src/ModuleCache.h index 25ae192..1e6373d 100644 --- a/src/ModuleCache.h +++ b/src/ModuleCache.h @@ -17,7 +17,7 @@ private: struct cache_entry { class Module *module; - std::string cache_id, msg; + std::string cache_id; }; boost::unordered_map entries; }; diff --git a/src/lexer.l b/src/lexer.l index 5e24e7f..884275e 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -30,6 +30,7 @@ #include "printutils.h" #include "parsersettings.h" #include "parser_yacc.h" +#include "module.h" #include #include #include @@ -52,7 +53,8 @@ int lexerget_lineno(void); static void yyunput(int, char*) __attribute__((unused)); #endif extern const char *parser_input_buffer; - extern std::string parser_source_path; +extern std::string parser_source_path; +extern Module *currmodule; #define YY_INPUT(buf,result,max_size) { \ if (yyin && yyin != stdin) { \ @@ -219,8 +221,10 @@ void includefile() filepath.clear(); path_stack.push_back(finfo.parent_path()); - handle_dep(boosty::absolute(finfo).string()); - yyin = fopen(boosty::absolute(finfo).string().c_str(), "r"); + std::string fullname = boosty::absolute(finfo).string(); + handle_dep(fullname); + currmodule->registerInclude(fullname); + yyin = fopen(fullname.c_str(), "r"); if (!yyin) { PRINTB("WARNING: Can't open input file '%s'.", filename); path_stack.pop_back(); diff --git a/src/mainwin.cc b/src/mainwin.cc index 3708013..b9544d5 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -79,6 +79,7 @@ #include #include +#include #include #ifdef ENABLE_CGAL @@ -598,10 +599,13 @@ AbstractNode *MainWindow::find_root_tag(AbstractNode *n) /*! Parse and evaluate the design => this->root_node + + Returns true if something was compiled, false if nothing was changed + and the root_node was left untouched. */ -void MainWindow::compile(bool reload, bool procevents) +bool MainWindow::compile(bool reload, bool procevents) { - compileTopLevelDocument(reload); + if (!compileTopLevelDocument(reload)) return false; // Invalidate renderers before we kill the CSG tree this->glview->setRenderer(NULL); @@ -661,6 +665,8 @@ void MainWindow::compile(bool reload, bool procevents) } if (procevents) QApplication::processEvents(); } + + return true; } /*! @@ -1000,13 +1006,15 @@ bool MainWindow::fileChangedOnDisk() If reload is true, does a timestamp check on the document and tries to reload it. Otherwise, just reparses the current document and any dependencies, updates the GUI accordingly and populates this->root_module. + + Returns true if anything was compiled. */ -void MainWindow::compileTopLevelDocument(bool reload) +bool MainWindow::compileTopLevelDocument(bool reload) { - bool shouldcompiletoplevel = true; + bool shouldcompiletoplevel = !reload; - if (reload && fileChangedOnDisk()) { - if (!checkModified()) shouldcompiletoplevel = false; + if (reload && fileChangedOnDisk() && checkModified()) { + shouldcompiletoplevel = true; refreshDocument(); } @@ -1046,17 +1054,18 @@ void MainWindow::compileTopLevelDocument(bool reload) } } + bool changed = shouldcompiletoplevel; if (this->root_module) { - this->root_module->handleDependencies(); - PRINTB("Module cache size: %d modules", ModuleCache::instance()->size()); + changed |= this->root_module->handleDependencies(); + if (changed) PRINTB("Module cache size: %d modules", ModuleCache::instance()->size()); } + + return changed; } void MainWindow::checkAutoReload() { - if (GuiLocker::isLocked()) return; - GuiLocker lock; - compile(true, true); + if (!this->fileName.isEmpty()) actionReloadCompile(); } void MainWindow::autoReloadSet(bool on) @@ -1091,17 +1100,12 @@ void MainWindow::actionReloadCompile() { if (GuiLocker::isLocked()) return; GuiLocker lock; - - if (!checkModified()) return; - + setCurrentOutput(); console->clear(); - refreshDocument(); - - setCurrentOutput(); - PRINT("Parsing design (AST generation)..."); - QApplication::processEvents(); - compile(true, true); + // PRINT("Parsing design (AST generation)..."); + // QApplication::processEvents(); + if (!compile(true, true)) return; if (this->root_node) compileCSG(true); // Go to non-CGAL view mode @@ -1123,7 +1127,6 @@ void MainWindow::actionCompile() { if (GuiLocker::isLocked()) return; GuiLocker lock; - setCurrentOutput(); console->clear(); @@ -1819,7 +1822,7 @@ void MainWindow::consoleOutput(const std::string &msg, void *userdata) void MainWindow::setCurrentOutput() { - set_output_handler(&MainWindow::consoleOutput, this); +// set_output_handler(&MainWindow::consoleOutput, this); } void MainWindow::clearCurrentOutput() diff --git a/src/module.cc b/src/module.cc index f049da1..69623dd 100644 --- a/src/module.cc +++ b/src/module.cc @@ -34,6 +34,7 @@ #include #include +#include AbstractModule::~AbstractModule() { @@ -203,18 +204,33 @@ std::string Module::dump(const std::string &indent, const std::string &name) con return dump.str(); } -void Module::handleDependencies() +void Module::registerInclude(const std::string &filename) { -// PRINTB_NOCACHE("Module::handleDependencies(): %p (%d libs %p)", this % this->usedlibs.size() % &this->usedlibs); + struct stat st; + memset(&st, 0, sizeof(struct stat)); + stat(filename.c_str(), &st); + this->includes[filename] = st.st_mtime; +} + +/*! + Check if any dependencies have been modified and recompile them. + Returns true if anything was recompiled. +*/ +bool Module::handleDependencies() +{ + bool changed = false; // Iterating manually since we want to modify the container while iterating Module::ModuleContainer::iterator iter = this->usedlibs.begin(); while (iter != this->usedlibs.end()) { Module::ModuleContainer::iterator curr = iter++; + Module *oldmodule = curr->second; curr->second = ModuleCache::instance()->evaluate(curr->first); + if (curr->second != oldmodule) changed = true; PRINTB_NOCACHE(" %s: %p", curr->first % curr->second); if (!curr->second) { PRINTB_NOCACHE("WARNING: Failed to compile library '%s'.", curr->first); this->usedlibs.erase(curr); } } + return changed; } diff --git a/src/module.h b/src/module.h index a490129..cd25287 100644 --- a/src/module.h +++ b/src/module.h @@ -3,6 +3,7 @@ #include #include +#include #include #include "value.h" @@ -67,7 +68,10 @@ public: typedef boost::unordered_map ModuleContainer; ModuleContainer usedlibs; - void handleDependencies(); + void registerInclude(const std::string &filename); + typedef boost::unordered_map IncludeContainer; + IncludeContainer includes; + bool handleDependencies(); std::vector assignments_var; std::vector assignments_expr; -- cgit v0.10.1 From 07f2da79687264b49d6310c8310a7b280a8070f7 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 18 Feb 2012 13:26:36 +0100 Subject: Updated MCAD diff --git a/libraries/MCAD b/libraries/MCAD index cde0d55..fa26564 160000 --- a/libraries/MCAD +++ b/libraries/MCAD @@ -1 +1 @@ -Subproject commit cde0d5514a7441812fb8a88f2bd6f2af48ded695 +Subproject commit fa265644af9b720557414125fd5ba26981b97576 -- cgit v0.10.1 From 9d7446de46eda7efefa14e324c6c7cdf22bf8929 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 18 Feb 2012 13:44:24 +0100 Subject: minor fixes: Don't copy input vectors, fixed a leak of a Value object + some cosmetics diff --git a/src/func.cc b/src/func.cc index 1dc1364..eec0986 100644 --- a/src/func.cc +++ b/src/func.cc @@ -390,99 +390,95 @@ Value builtin_lookup(const Context *, const std::vector&, const std */ Value builtin_search(const Context *, const std::vector&, const std::vector &args) { - Value findThis; - Value searchTable; + if (args.size() < 2) return Value(); + + const Value &findThis = args[0]; + const Value &searchTable = args[1]; + unsigned int num_returns_per_match = (args.size() > 2) ? args[2].num : 1; + unsigned int index_col_num = (args.size() > 3) ? args[3].num : 0; + Value returnVector; returnVector.type = Value::VECTOR; - unsigned int num_returns_per_match = 1; - unsigned int index_col_num=0; - if (args.size() < 2 ) - return Value(); - findThis=args[0]; - // PRINTB(" builtin_search: findThis = %s",findThis); - searchTable=args[1]; - // PRINTB(" builtin_search: searchTable = %s",searchTable); - if ( args.size() > 2 ) num_returns_per_match=args[2].num; - if ( args.size() > 3 ) index_col_num=args[3].num; - if ( findThis.type==Value::NUMBER ) { - // PRINTB(" builtin_search: findThis type: NUMBER %s",findThis); - unsigned int matchCount=0; + + if (findThis.type == Value::NUMBER) { + unsigned int matchCount = 0; Value *resultVector = new Value(); resultVector->type = Value::VECTOR; for (size_t j = 0; j < searchTable.vec.size(); j++) { - if ( searchTable.vec[j]->vec[index_col_num]->type==Value::NUMBER && findThis.num == searchTable.vec[j]->vec[index_col_num]->num ) { - Value *resultValue; - resultValue = new Value(double(j)); - returnVector.append(resultValue); + if (searchTable.vec[j]->vec[index_col_num]->type == Value::NUMBER && + findThis.num == searchTable.vec[j]->vec[index_col_num]->num) { + returnVector.append(new Value(double(j))); matchCount++; - if(num_returns_per_match!=0 && matchCount>=num_returns_per_match) break; + if (num_returns_per_match != 0 && matchCount >= num_returns_per_match) break; } } - } else if ( findThis.type==Value::STRING ) { - //PRINTB(" builtin_search: findThis type STRING %s",findThis); - //PRINTB(" builtin_search: checking findThis.text.size()==%s",findThis.text.size()); + } else if (findThis.type == Value::STRING) { unsigned int searchTableSize; - if(searchTable.type == Value::STRING) { - searchTableSize=searchTable.text.size(); - } else { - searchTableSize=searchTable.vec.size(); - } + if (searchTable.type == Value::STRING) searchTableSize = searchTable.text.size(); + else searchTableSize = searchTable.vec.size(); for (size_t i = 0; i < findThis.text.size(); i++) { - unsigned int matchCount=0; + unsigned int matchCount = 0; Value *resultVector = new Value(); resultVector->type = Value::VECTOR; for (size_t j = 0; j < searchTableSize; j++) { - // PRINTB(" builtin_search: checking findThis.text[i]==%s",findThis.text[i]); - if ( searchTable.type==Value::VECTOR && findThis.text[i] == searchTable.vec[j]->vec[index_col_num]->text[0] - || searchTable.type==Value::STRING && findThis.text[i] == searchTable.text[j] - ) { - Value *resultValue; - resultValue = new Value(double(j)); + if (searchTable.type == Value::VECTOR && + findThis.text[i] == searchTable.vec[j]->vec[index_col_num]->text[0] || + searchTable.type == Value::STRING && + findThis.text[i] == searchTable.text[j]) { + Value *resultValue = new Value(double(j)); matchCount++; - if(num_returns_per_match==1) { - returnVector.append(resultValue); - break; + if (num_returns_per_match==1) { + returnVector.append(resultValue); + break; } else { - resultVector->append(resultValue); + resultVector->append(resultValue); } - if(num_returns_per_match>1 && matchCount>=num_returns_per_match) break; + if (num_returns_per_match > 1 && matchCount >= num_returns_per_match) break; } } - if(matchCount==0) PRINTB(" search term not found: \"%s\"",findThis.text[i]); - if(num_returns_per_match==0 || num_returns_per_match>1) returnVector.append(resultVector); + if (matchCount == 0) PRINTB(" search term not found: \"%s\"", findThis.text[i]); + if (num_returns_per_match == 0 || num_returns_per_match > 1) { + returnVector.append(resultVector); + } } - ; - } else if ( findThis.type==Value::VECTOR ) { - // PRINTB(" builtin_search: findThis type: VECTOR %s",findThis); + } else if (findThis.type == Value::VECTOR) { for (size_t i = 0; i < findThis.vec.size(); i++) { - unsigned int matchCount=0; + unsigned int matchCount = 0; Value *resultVector = new Value(); resultVector->type = Value::VECTOR; for (size_t j = 0; j < searchTable.vec.size(); j++) { - Value *resultValue; - resultValue = new Value(double(j)); - if ( findThis.vec[i]->type==Value::NUMBER && searchTable.vec[j]->vec[index_col_num]->type==Value::NUMBER && findThis.vec[i]->num == searchTable.vec[j]->vec[index_col_num]->num - || findThis.vec[i]->type==Value::STRING && searchTable.vec[j]->vec[index_col_num]->type==Value::STRING && findThis.vec[i]->text == searchTable.vec[j]->vec[index_col_num]->text ) { - resultValue = new Value(double(j)); + if (findThis.vec[i]->type == Value::NUMBER && + searchTable.vec[j]->vec[index_col_num]->type == Value::NUMBER && + findThis.vec[i]->num == searchTable.vec[j]->vec[index_col_num]->num || + findThis.vec[i]->type == Value::STRING && + searchTable.vec[j]->vec[index_col_num]->type == Value::STRING && + findThis.vec[i]->text == searchTable.vec[j]->vec[index_col_num]->text) { + Value *resultValue = new Value(double(j)); matchCount++; - if(num_returns_per_match==1) { - returnVector.append(resultValue); - break; + if (num_returns_per_match==1) { + returnVector.append(resultValue); + break; } else { - resultVector->append(resultValue); + resultVector->append(resultValue); } - if(num_returns_per_match>1 && matchCount>=num_returns_per_match) break; + if (num_returns_per_match > 1 && matchCount >= num_returns_per_match) break; } } - if( num_returns_per_match==1 && matchCount==0 ) { - if(findThis.vec[i]->type==Value::NUMBER) PRINTB(" search term not found: %s",findThis.vec[i]->num); - if(findThis.vec[i]->type==Value::STRING) PRINTB(" search term not found: \"%s\"",findThis.vec[i]->text); + if (num_returns_per_match == 1 && matchCount == 0) { + if (findThis.vec[i]->type == Value::NUMBER) { + PRINTB(" search term not found: %s",findThis.vec[i]->num); + } + else if (findThis.vec[i]->type == Value::STRING) { + PRINTB(" search term not found: \"%s\"",findThis.vec[i]->text); + } returnVector.append(resultVector); } - if(num_returns_per_match==0 || num_returns_per_match>1) returnVector.append(resultVector); + if (num_returns_per_match == 0 || num_returns_per_match > 1) { + returnVector.append(resultVector); + } } } else { - PRINTB(" search: none performed on input %s",findThis); + PRINTB(" search: none performed on input %s", findThis); return Value(); } return returnVector; -- cgit v0.10.1 From a6678827b797b50b9dfea5cd1c0fc6a33f310872 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 18 Feb 2012 13:45:28 +0100 Subject: Revert "Setting QTDIR via qmake -query" This reverts commit 2e7a27f64416b3bb5b8e0a5d2969292cbacde7b6. diff --git a/setenv_mjau.sh b/setenv_mjau.sh index 61e10d5..3b9fd92 100644 --- a/setenv_mjau.sh +++ b/setenv_mjau.sh @@ -6,9 +6,6 @@ export DYLD_LIBRARY_PATH=$OPENSCAD_LIBRARIES/lib #export QCODEEDITDIR=$PWD/../qcodeedit-2.2.3/install #export DYLD_LIBRARY_PATH=$OPENCSGDIR/lib:$QCODEEDITDIR/lib -export QTDIR=`qmake -query "QT_INSTALL_PREFIX"` -export PATH=$QTDIR/bin:$PATH - # ccache: export PATH=/opt/local/libexec/ccache:$PATH export CCACHE_BASEDIR=$PWD/.. -- cgit v0.10.1 From 89ffc684864c8e109e4c0ea5c9ba61a407179c60 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 18 Feb 2012 13:47:17 +0100 Subject: Updated MCAD diff --git a/libraries/MCAD b/libraries/MCAD index cde0d55..fa26564 160000 --- a/libraries/MCAD +++ b/libraries/MCAD @@ -1 +1 @@ -Subproject commit cde0d5514a7441812fb8a88f2bd6f2af48ded695 +Subproject commit fa265644af9b720557414125fd5ba26981b97576 -- cgit v0.10.1 From 3300d3f85d7616ed640b1b987f54343ac198ef2f Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 18 Feb 2012 14:47:08 +0100 Subject: Kill warnings diff --git a/src/func.cc b/src/func.cc index eec0986..0c9b450 100644 --- a/src/func.cc +++ b/src/func.cc @@ -421,10 +421,10 @@ Value builtin_search(const Context *, const std::vector&, const std Value *resultVector = new Value(); resultVector->type = Value::VECTOR; for (size_t j = 0; j < searchTableSize; j++) { - if (searchTable.type == Value::VECTOR && - findThis.text[i] == searchTable.vec[j]->vec[index_col_num]->text[0] || - searchTable.type == Value::STRING && - findThis.text[i] == searchTable.text[j]) { + if ((searchTable.type == Value::VECTOR && + findThis.text[i] == searchTable.vec[j]->vec[index_col_num]->text[0]) || + (searchTable.type == Value::STRING && + findThis.text[i] == searchTable.text[j])) { Value *resultValue = new Value(double(j)); matchCount++; if (num_returns_per_match==1) { @@ -447,12 +447,12 @@ Value builtin_search(const Context *, const std::vector&, const std Value *resultVector = new Value(); resultVector->type = Value::VECTOR; for (size_t j = 0; j < searchTable.vec.size(); j++) { - if (findThis.vec[i]->type == Value::NUMBER && - searchTable.vec[j]->vec[index_col_num]->type == Value::NUMBER && - findThis.vec[i]->num == searchTable.vec[j]->vec[index_col_num]->num || - findThis.vec[i]->type == Value::STRING && - searchTable.vec[j]->vec[index_col_num]->type == Value::STRING && - findThis.vec[i]->text == searchTable.vec[j]->vec[index_col_num]->text) { + if ((findThis.vec[i]->type == Value::NUMBER && + searchTable.vec[j]->vec[index_col_num]->type == Value::NUMBER && + findThis.vec[i]->num == searchTable.vec[j]->vec[index_col_num]->num) || + (findThis.vec[i]->type == Value::STRING && + searchTable.vec[j]->vec[index_col_num]->type == Value::STRING && + findThis.vec[i]->text == searchTable.vec[j]->vec[index_col_num]->text)) { Value *resultValue = new Value(double(j)); matchCount++; if (num_returns_per_match==1) { -- cgit v0.10.1 From 5870c462d65de69d7fa9ec516473e3012fb43d7e Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 18 Feb 2012 14:48:11 +0100 Subject: Reenable output in the OpenSCAD console diff --git a/src/mainwin.cc b/src/mainwin.cc index 1057499..45b9ff3 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -1823,7 +1823,7 @@ void MainWindow::consoleOutput(const std::string &msg, void *userdata) void MainWindow::setCurrentOutput() { -// set_output_handler(&MainWindow::consoleOutput, this); + set_output_handler(&MainWindow::consoleOutput, this); } void MainWindow::clearCurrentOutput() -- cgit v0.10.1 From ccde3135708a704134cb921a9fffdd7d1aaa4eb3 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 18 Feb 2012 16:05:16 +0100 Subject: Removed redundant dependency on tests-common diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9803704..f7c3206 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -401,25 +401,25 @@ target_link_libraries(echotest tests-nocgal tests-core ${QT_LIBRARIES} ${OPENGL_ # dumptest # add_executable(dumptest dumptest.cc) -target_link_libraries(dumptest tests-common tests-nocgal ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES}) +target_link_libraries(dumptest tests-nocgal ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES}) # # modulecachetest # add_executable(modulecachetest modulecachetest.cc) -target_link_libraries(modulecachetest tests-common tests-nocgal ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES}) +target_link_libraries(modulecachetest tests-nocgal ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES}) # # csgtexttest # add_executable(csgtexttest csgtexttest.cc CSGTextRenderer.cc CSGTextCache.cc) -target_link_libraries(csgtexttest tests-common tests-nocgal ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES}) +target_link_libraries(csgtexttest tests-nocgal ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES}) # # csgtermtest # add_executable(csgtermtest csgtermtest.cc ../src/CSGTermEvaluator.cc) -target_link_libraries(csgtermtest tests-common tests-nocgal ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES}) +target_link_libraries(csgtermtest tests-nocgal ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES}) # # cgaltest -- cgit v0.10.1 From d460e7203fe8ce8c799a1558351e374218e1222a Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 18 Feb 2012 16:26:56 +0100 Subject: Try pkg-config to find GLEW if no override path was specified. Simplifies build on Ubuntu diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9803704..ad3eefe 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -229,10 +229,28 @@ if (NOT $ENV{GLEWDIR} STREQUAL "") elseif (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "") set(GLEW_DIR "$ENV{OPENSCAD_LIBRARIES}") endif() +if (NOT GLEW_INCLUDE_DIR) + message(STATUS "OPENCSG_DIR: " ${OPENCSG_DIR}) + find_path(GLEW_INCLUDE_DIR + GL/glew.h + HINTS ${GLEW_DIR}/include + NO_DEFAULT_PATH) + find_library(GLEW_LIBRARY + NAMES GLEW glew + HINTS ${GLEW_DIR}/lib + NO_DEFAULT_PATH) + if (NOT GLEW_INCLUDE_DIR OR NOT GLEW_LIBRARY) + find_package(GLEW REQUIRED) + if (NOT GLEW_INCLUDE_DIR OR NOT GLEW_LIBRARY) + message(FATAL_ERROR "GLEW not found") + endif() + else() + message(STATUS "GLEW include found in " ${GLEW_INCLUDE_DIR}) + message(STATUS "GLEW library found in " ${GLEW_LIBRARY}) + endif() +endif() -find_package(GLEW REQUIRED) - -inclusion( GLEW_DIR GLEW_INCLUDE_PATH ) +inclusion(GLEW_DIR GLEW_INCLUDE_DIR) # Flex/Bison find_package(BISON REQUIRED) @@ -419,7 +437,7 @@ target_link_libraries(csgtexttest tests-common tests-nocgal ${QT_LIBRARIES} ${OP # csgtermtest # add_executable(csgtermtest csgtermtest.cc ../src/CSGTermEvaluator.cc) -target_link_libraries(csgtermtest tests-common tests-nocgal ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES}) +target_link_libraries(csgtermtest tests-nocgal ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES}) # # cgaltest diff --git a/tests/FindGLEW.cmake b/tests/FindGLEW.cmake index 1b0cac4..b7e37d0 100644 --- a/tests/FindGLEW.cmake +++ b/tests/FindGLEW.cmake @@ -3,55 +3,63 @@ # Once done this will define # # GLEW_FOUND -# GLEW_INCLUDE_PATH +# GLEW_INCLUDE_DIR # GLEW_LIBRARY # # a few lines of this file are based on the LGPL code found at # http://openlibraries.org/browser/trunk/FindGLEW.cmake?rev=1383 +include(FindPkgConfig) -IF (WIN32 AND MSVC) - IF (WIN32_STATIC_BUILD) # passed from caller - SET(GLEW_LIB_SEARCH_NAME glew32s.lib) # static, non-debug (Release) - ELSE () - SET(GLEW_LIB_SEARCH_NAME glew32.lib) # other. untested with OpenSCAD - ENDIF() -ELSE () # GCC - SET(GLEW_LIB_SEARCH_NAME "libglew32s.a") -ENDIF () +if (PKG_CONFIG_FOUND) + message("Doing pkg config glew check...") + pkg_check_modules(GLEW glew>=1.5) +endif() -IF (WIN32) - FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h - $ENV{PROGRAMFILES}/GLEW/include - ${PROJECT_SOURCE_DIR}/src/nvgl/glew/include - DOC "The directory where GL/glew.h resides") - FIND_LIBRARY( GLEW_LIBRARY - NAMES ${GLEW_LIB_SEARCH_NAME} - PATHS - $ENV{PROGRAMFILES}/GLEW/lib - ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin - ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib - DOC "The GLEW library") -ELSE (WIN32) - message(STATUS "GLEW_DIR: " ${GLEW_DIR}) - FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h - HINTS ${GLEW_DIR}/include - PATHS /usr/include /usr/local/include /usr/pkg/include - NO_DEFAULT_PATH - DOC "The directory where GL/glew.h resides") - FIND_LIBRARY( GLEW_LIBRARY - NAMES GLEW glew - HINTS ${GLEW_DIR}/lib - PATHS /usr/lib /usr/local/lib /usr/pkg/lib - NO_DEFAULT_PATH - DOC "The GLEW library") -ENDIF (WIN32) +if (GLEW_FOUND) + set(GLEW_INCLUDE_DIR ${GLEW_INCLUDE_DIRS}) + set(GLEW_LIBRARY ${GLEW_LDFLAGS}) +else() + if (WIN32 AND MSVC) + if (WIN32_STATIC_BUILD) # passed from caller + set(GLEW_LIB_SEARCH_NAME glew32s.lib) # static, non-debug (Release) + else () + set(GLEW_LIB_SEARCH_NAME glew32.lib) # other. untested with OpenSCAD + endif() + else () # GCC + set(GLEW_LIB_SEARCH_NAME "libglew32s.a") + endif () -IF (GLEW_INCLUDE_PATH) - SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") - MESSAGE(STATUS "GLEW include found in " ${GLEW_INCLUDE_PATH} ) - MESSAGE(STATUS "GLEW library found in " ${GLEW_LIBRARY} ) -ELSE (GLEW_INCLUDE_PATH) - SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") -ENDIF (GLEW_INCLUDE_PATH) + if (WIN32) + find_path(GLEW_INCLUDE_DIR GL/glew.h + $ENV{PROGRAMFILES}/GLEW/include + ${PROJECT_SOURCE_DIR}/src/nvgl/glew/include + DOC "The directory where GL/glew.h resides") + find_library(GLEW_LIBRARY + NAMES ${GLEW_LIB_SEARCH_NAME} + PATHS + $ENV{PROGRAMFILES}/GLEW/lib + ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin + ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib + DOC "The GLEW library") + else (WIN32) + find_path(GLEW_INCLUDE_DIR GL/glew.h + PATHS /usr/include /usr/local/include /usr/pkg/include + NO_DEFAULT_PATH + DOC "The directory where GL/glew.h resides") + find_library(GLEW_LIBRARY + NAMES GLEW glew + PATHS /usr/lib /usr/local/lib /usr/pkg/lib + NO_DEFAULT_PATH + DOC "The GLEW library") + endif (WIN32) + + if (GLEW_INCLUDE_DIR) + set(GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") + message(STATUS "GLEW include found in " ${GLEW_INCLUDE_DIR} ) + message(STATUS "GLEW library found in " ${GLEW_LIBRARY} ) + else() + set(GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") + endif() +endif() \ No newline at end of file -- cgit v0.10.1 From 79d9fdba3256cf7e60d6d00e92b0f46160bcf45b Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 18 Feb 2012 16:57:24 +0100 Subject: GLEW fix: Support GLEW installed in the default system location diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ad3eefe..c395a52 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -239,15 +239,14 @@ if (NOT GLEW_INCLUDE_DIR) NAMES GLEW glew HINTS ${GLEW_DIR}/lib NO_DEFAULT_PATH) - if (NOT GLEW_INCLUDE_DIR OR NOT GLEW_LIBRARY) + if (NOT GLEW_LIBRARY) find_package(GLEW REQUIRED) - if (NOT GLEW_INCLUDE_DIR OR NOT GLEW_LIBRARY) + if (NOT GLEW_LIBRARY) message(FATAL_ERROR "GLEW not found") endif() - else() - message(STATUS "GLEW include found in " ${GLEW_INCLUDE_DIR}) - message(STATUS "GLEW library found in " ${GLEW_LIBRARY}) endif() + message(STATUS "GLEW include: " ${GLEW_INCLUDE_DIR}) + message(STATUS "GLEW library: " ${GLEW_LIBRARY}) endif() inclusion(GLEW_DIR GLEW_INCLUDE_DIR) diff --git a/tests/FindGLEW.cmake b/tests/FindGLEW.cmake index b7e37d0..a503368 100644 --- a/tests/FindGLEW.cmake +++ b/tests/FindGLEW.cmake @@ -17,9 +17,9 @@ if (PKG_CONFIG_FOUND) pkg_check_modules(GLEW glew>=1.5) endif() -if (GLEW_FOUND) - set(GLEW_INCLUDE_DIR ${GLEW_INCLUDE_DIRS}) - set(GLEW_LIBRARY ${GLEW_LDFLAGS}) +if (GLEW_LIBRARIES) + set(GLEW_INCLUDE_DIR "${GLEW_INCLUDE_DIRS}") + set(GLEW_LIBRARY ${GLEW_LDFLAGS}) else() if (WIN32 AND MSVC) if (WIN32_STATIC_BUILD) # passed from caller -- cgit v0.10.1 From bd5aac6f96ac7ecf3613fd81999bd82605925562 Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Sat, 18 Feb 2012 12:10:06 -0500 Subject: MCAD/fonts with search() example. Adding example023.scad demonstrating use of search() with MCAD/fonts.scad diff --git a/examples/example023.scad b/examples/example023.scad new file mode 100644 index 0000000..3f59264 --- /dev/null +++ b/examples/example023.scad @@ -0,0 +1,30 @@ +// MCAD/fonts.scad with search() function example. + +use + +thisFont=8bit_polyfont(); +thisText="OpenSCAD Rocks!"; +// Find one letter matches from 2nd column (index 1) +theseIndicies=search(thisText,thisFont[2],1,1); +// Letter spacing, x direction. +x_shift=thisFont[0][0]; +y_shift=thisFont[0][1]; +echo(theseIndicies); +// Simple polygon usage. +for(i=[0:len(theseIndicies)-1]) translate([i*x_shift-len(theseIndicies)*x_shift/2,0]) { + polygon(points=thisFont[2][theseIndicies[i]][6][0],paths=thisFont[2][theseIndicies[i]][6][1]); +} + +theseIndicies2=search("ABC",thisFont[2],1,1); +// outline_2d() example +for(i=[0:len(theseIndicies2)-1]) translate([i*x_shift-len(theseIndicies2)*x_shift,-y_shift]) { + outline_2d(outline=true,points=thisFont[2][theseIndicies2[i]][6][0],paths=thisFont[2][theseIndicies2[i]][6][1],width=0.25); +} + +theseIndicies3=search("123",thisFont[2],1,1); +// bold_2d() outline_2d(false) example +for(i=[0:len(theseIndicies3)-1]) translate([i*x_shift,-2*y_shift]) { + bold_2d(bold=true,width=0.25,resolution=8) + outline_2d(false,thisFont[2][theseIndicies3[i]][6][0],thisFont[2][theseIndicies3[i]][6][1]); +} + -- cgit v0.10.1 From 5606f457c3c4ba5dfdeb745f2c1386413e3b0b5e Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 18 Feb 2012 18:23:59 +0100 Subject: Removed deprecated file diff --git a/scripts/release-macosx.sh b/scripts/release-macosx.sh deleted file mode 100755 index 18174d6..0000000 --- a/scripts/release-macosx.sh +++ /dev/null @@ -1,69 +0,0 @@ -## -## Deprecated! Use release-common.sh instead -## - -#!/bin/sh -# -# This script creates a binary release of OpenSCAD for Mac OS X. -# The script will create a file called openscad-.zip -# in the current directory. -# -# Usage: makedmg.sh [-v ] -# -v Version string (e.g. -v 2010.01) -# -# If no version string is given, todays date will be used (YYYY-MM-DD) -# -printUsage() -{ - echo "Usage: $0 -v " - echo - echo " Example: $0 -v 2010.01" -} - -while getopts 'v:' c -do - case $c in - v) VERSION=$OPTARG;; - esac -done - -if test -z "$VERSION"; then - VERSION=`date "+%Y.%m.%d"` -fi - -echo "Building openscad-$VERSION..." -export OPENCSGDIR=$PWD/../OpenCSG-1.2.0 -qmake VERSION=$VERSION CONFIG+=mdi openscad.pro -make clean -make -j2 -echo "Preparing executable.." -mkdir OpenSCAD.app/Contents/Frameworks -cp $OPENCSGDIR/lib/libopencsg.dylib OpenSCAD.app/Contents/Frameworks -cp /opt/local/lib/libGLEW.1.5.1.dylib OpenSCAD.app/Contents/Frameworks -cp /Library/Frameworks/QtOpenGL.framework/Versions/4/QtOpenGL OpenSCAD.app/Contents/Frameworks -cp /Library/Frameworks/QtGui.framework/Versions/4/QtGui OpenSCAD.app/Contents/Frameworks -cp /Library/Frameworks/QtCore.framework/Versions/4/QtCore OpenSCAD.app/Contents/Frameworks -install_name_tool -change libopencsg.1.dylib @executable_path/../Frameworks/libopencsg.dylib OpenSCAD.app/Contents/MacOS/openscad -install_name_tool -change QtOpenGL.framework/Versions/4/QtOpenGL @executable_path/../Frameworks/QtOpenGL OpenSCAD.app/Contents/MacOS/openscad -install_name_tool -change QtGui.framework/Versions/4/QtGui @executable_path/../Frameworks/QtGui OpenSCAD.app/Contents/MacOS/openscad -install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore OpenSCAD.app/Contents/MacOS/openscad -install_name_tool -change QtGui.framework/Versions/4/QtGui @executable_path/../Frameworks/QtGui OpenSCAD.app/Contents/Frameworks/QtOpenGL -install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore OpenSCAD.app/Contents/Frameworks/QtOpenGL -install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore OpenSCAD.app/Contents/Frameworks/QtGui -install_name_tool -change /opt/local/lib/libGLEW.1.5.1.dylib @executable_path/../Frameworks/libGLEW.1.5.1.dylib OpenSCAD.app/Contents/MacOS/openscad -install_name_tool -id libopencsg.dylib OpenSCAD.app/Contents/Frameworks/libopencsg.dylib -install_name_tool -change /opt/local/lib/libGLEW.1.5.1.dylib @executable_path/../Frameworks/libGLEW.1.5.1.dylib OpenSCAD.app/Contents/Frameworks/libopencsg.dylib -install_name_tool -change QtGui.framework/Versions/4/QtGui @executable_path/../Frameworks/QtGui OpenSCAD.app/Contents/Frameworks/libopencsg.dylib -install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore OpenSCAD.app/Contents/Frameworks/libopencsg.dylib -install_name_tool -id libGLEW.1.5.1.dylib OpenSCAD.app/Contents/Frameworks/libGLEW.1.5.1.dylib - -echo "Creating directory structure.." -rm -rf openscad-$VERSION -mkdir -p openscad-$VERSION/examples -cp examples/* openscad-$VERSION/examples/ -chmod -R 644 openscad-$VERSION/examples/* -mv OpenSCAD.app openscad-$VERSION - -echo "Creating archive.." -zip -qr openscad-$VERSION.zip openscad-$VERSION -echo "Mac OS X binary created: openscad-$VERSION.zip" -- cgit v0.10.1 From 6652ede2c2167b2eb2ca685002710764d0986299 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 18 Feb 2012 18:37:26 +0100 Subject: nan vs. -nan fix to make inf-tests work under Linux diff --git a/src/value.cc b/src/value.cc index 48fea1a..c9dbd55 100644 --- a/src/value.cc +++ b/src/value.cc @@ -426,6 +426,10 @@ std::string Value::toString() const // Quick and dirty hack to work around floating point rounding differences // across platforms for testing purposes. { + if (this->num != this->num) { // Fix for avoiding nan vs. -nan across platforms + stream << "nan"; + break; + } std::stringstream tmp; tmp.precision(12); tmp.setf(std::ios_base::fixed); -- cgit v0.10.1 From bd72e2dc2381f9c1167900fe98e2cc922a0d608f Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 18 Feb 2012 18:37:53 +0100 Subject: Make MCAD submodule relative to openscad toplevel. diff --git a/.gitmodules b/.gitmodules index 4ab4cf0..6556377 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "libraries/MCAD"] path = libraries/MCAD - url = git@github.com:openscad/MCAD.git + url = ../MCAD.git -- cgit v0.10.1 From 45c180e8e36a5ee4bf1d7d611ac3f8127688420a Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 18 Feb 2012 18:44:45 +0100 Subject: Disable test causing floating point comparison issues diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0e74f58..881a750 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -657,6 +657,7 @@ disable_tests(dumptest_transform-tests dumptest_render-tests dumptest_difference-tests dumptest_intersection-tests + dumptest_text-search-test dumptest_example001 dumptest_example005 dumptest_example006 -- cgit v0.10.1 From cd0218d9aa665db78a0f74f6a95f29b68100494e Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 18 Feb 2012 19:16:40 +0100 Subject: Added note about adding examples diff --git a/doc/testing.txt b/doc/testing.txt index 542de5d..6990c2f 100644 --- a/doc/testing.txt +++ b/doc/testing.txt @@ -51,6 +51,20 @@ Adding a new regression test: 7) run the test normally and verify that it passes: $ ctest -R mytest +Adding a new example: +--------------------- + +This is almost the same as adding a new regression test: +1) Create the example under examples/ +2) run the test with the environment variable TEST_GENERATE=1, e.g.: + $ TEST_GENERATE=1 ctest -C Examples -R exampleNNN + (this will generate a exampleNNN-expected.txt file which is used for regression testing) +3) manually verify that the output is correct (tests/regression//exampleNNN.) +4) run the test normally and verify that it passes: + $ ctest -C Examples -R exampleNNN + + + Troubleshooting: ------------------------------ -- cgit v0.10.1 From de1deb113fa098d2a758b933436cde81a1a09beb Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Sat, 18 Feb 2012 21:22:31 -0500 Subject: Added better example023 with test output. diff --git a/examples/example023.scad b/examples/example023.scad index 3f59264..1332899 100644 --- a/examples/example023.scad +++ b/examples/example023.scad @@ -1,30 +1,20 @@ -// MCAD/fonts.scad with search() function example. +// Example combining MCAD/fonts.scad with search() function. use thisFont=8bit_polyfont(); -thisText="OpenSCAD Rocks!"; -// Find one letter matches from 2nd column (index 1) -theseIndicies=search(thisText,thisFont[2],1,1); -// Letter spacing, x direction. x_shift=thisFont[0][0]; y_shift=thisFont[0][1]; -echo(theseIndicies); -// Simple polygon usage. -for(i=[0:len(theseIndicies)-1]) translate([i*x_shift-len(theseIndicies)*x_shift/2,0]) { - polygon(points=thisFont[2][theseIndicies[i]][6][0],paths=thisFont[2][theseIndicies[i]][6][1]); -} -theseIndicies2=search("ABC",thisFont[2],1,1); -// outline_2d() example -for(i=[0:len(theseIndicies2)-1]) translate([i*x_shift-len(theseIndicies2)*x_shift,-y_shift]) { - outline_2d(outline=true,points=thisFont[2][theseIndicies2[i]][6][0],paths=thisFont[2][theseIndicies2[i]][6][1],width=0.25); -} +hours=["one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve"]; -theseIndicies3=search("123",thisFont[2],1,1); -// bold_2d() outline_2d(false) example -for(i=[0:len(theseIndicies3)-1]) translate([i*x_shift,-2*y_shift]) { - bold_2d(bold=true,width=0.25,resolution=8) - outline_2d(false,thisFont[2][theseIndicies3[i]][6][0],thisFont[2][theseIndicies3[i]][6][1]); +module clock_hour_words(word_offset=20.0,word_height=2.0) { + for(i=[0:(len(hours)-1)]) assign( hourHandAngle=(i+1)*360/len(hours), theseIndicies=search(hours[i],thisFont[2],1,1) ) { + rotate(90-hourHandAngle) translate([word_offset,0]) + for( j=[0:(len(theseIndicies)-1)] ) translate([j*x_shift,-y_shift/2]) { + linear_extrude(height=word_height) polygon(points=thisFont[2][theseIndicies[j]][6][0],paths=thisFont[2][theseIndicies[j]][6][1]); + } + } } +clock_hour_words(word_offset=16.0,word_height=5.0); diff --git a/tests/regression/cgalpngtest/example023-expected.png b/tests/regression/cgalpngtest/example023-expected.png new file mode 100644 index 0000000..c528b90 Binary files /dev/null and b/tests/regression/cgalpngtest/example023-expected.png differ diff --git a/tests/regression/opencsgtest/example023-expected.png b/tests/regression/opencsgtest/example023-expected.png new file mode 100644 index 0000000..a097d99 Binary files /dev/null and b/tests/regression/opencsgtest/example023-expected.png differ diff --git a/tests/regression/throwntogethertest/example023-expected.png b/tests/regression/throwntogethertest/example023-expected.png new file mode 100644 index 0000000..a097d99 Binary files /dev/null and b/tests/regression/throwntogethertest/example023-expected.png differ -- cgit v0.10.1 From d3528779bb370b2314af3b198e8aa4456eba0189 Mon Sep 17 00:00:00 2001 From: Andrew Plumb Date: Sat, 18 Feb 2012 23:20:28 -0500 Subject: Added dumptest_example023 to disable_tests() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 881a750..12b8543 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -669,7 +669,8 @@ disable_tests(dumptest_transform-tests dumptest_example017 dumptest_example020 dumptest_example021 - dumptest_example022) + dumptest_example022 + dumptest_example023) # FIXME: This test illustrates a weakness in child() combined with modifiers. # Reenable it when this is improved -- cgit v0.10.1 From bddf392281d20bf1ad763577c8d3a846c5891ab9 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sun, 19 Feb 2012 11:17:24 +0100 Subject: Bugfix: Unknown cmd-line options caused a crash. Reported by nop head. diff --git a/src/openscad.cc b/src/openscad.cc index f45f81a..7fe054f 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -149,9 +149,14 @@ int main(int argc, char **argv) all_options.add(desc).add(hidden); po::variables_map vm; - po::store(po::command_line_parser(argc, argv).options(all_options).positional(p).run(), vm); -// po::notify(vm); - + try { + po::store(po::command_line_parser(argc, argv).options(all_options).positional(p).run(), vm); + } + catch(std::exception &e) { // Catches e.g. unknown options + fprintf(stderr, "%s\n", e.what()); + help(argv[0]); + } + if (vm.count("help")) help(argv[0]); if (vm.count("version")) version(); -- cgit v0.10.1 From 03bbd55c9377823c67ca8ea8027b0078d6d464ba Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sun, 19 Feb 2012 11:40:33 +0100 Subject: Fixed recently introduced bug: Don't clear console unless something is being compiled diff --git a/src/mainwin.cc b/src/mainwin.cc index 45b9ff3..be7c567 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -1020,6 +1020,8 @@ bool MainWindow::compileTopLevelDocument(bool reload) } if (shouldcompiletoplevel) { + console->clear(); + updateTemporalVariables(); this->last_compiled_doc = editor->toPlainText(); @@ -1102,7 +1104,6 @@ void MainWindow::actionReloadCompile() if (GuiLocker::isLocked()) return; GuiLocker lock; setCurrentOutput(); - console->clear(); // PRINT("Parsing design (AST generation)..."); // QApplication::processEvents(); -- cgit v0.10.1 From 955e0f1344d772119e2d7af1afb7658df7e8c43e Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sun, 19 Feb 2012 13:01:36 +0100 Subject: Added commented-out support for CGAL-4.0beta1 diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh index fada8c4..730eb7f 100755 --- a/scripts/macosx-build-dependencies.sh +++ b/scripts/macosx-build-dependencies.sh @@ -192,9 +192,11 @@ build_cgal() cd $BASEDIR/src rm -rf CGAL-$version if [ ! -f CGAL-$version.tar.gz ]; then + # 4.0beta1curl -O https://gforge.inria.fr/frs/download.php/30225/CGAL-$version.tar.gz + # 3.9 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 + # 3.8 curl -O https://gforge.inria.fr/frs/download.php/28500/CGAL-$version.tar.gz + # 3.7 curl -O https://gforge.inria.fr/frs/download.php/27641/CGAL-$version.tar.gz fi tar xzf CGAL-$version.tar.gz cd CGAL-$version -- cgit v0.10.1 From c5703b44077ca6185f7611d6ffba68f4955c1cbd Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sun, 19 Feb 2012 13:09:02 +0100 Subject: bugfix: Fix crash bug when using zero scale factors. Reported by Alan Cox diff --git a/RELEASE_NOTES b/RELEASE_NOTES index a78fa7b..1a10b10 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -7,6 +7,8 @@ o The size of the misc. caches can now be adjusted from Preferences o The limit for when to disable OpenCSG can now be adjusted from Preferences o Added Dot product operator: vec * vec o Added Matrix multiplication operator: vec * mat, mat * mat +o Added search() function +o Dependencies are now tracked - any changes in uses/included files will be detected and cause a recompile Bugfixes: o use'ing an non-existing file sometimes crashed under Windows @@ -14,6 +16,9 @@ o Better font handling: Ensure a monospace font is chosen as default o Division by zero caused hang in some cases (e.g. sin(1/0)) o Larger minkowski operations sometimes caused a crash after a CGAL assert was thrown o Fixed crashes in shared_ptr.hpp (or similar places) due to a cache management bug +o scale() with a scale factor of zero could cause a crash +o Fixed a number of issues related to use/include +o Providing an unknown parameter on the cmd-line caused a crash Deprecations: o The old include syntax "" without the include keyword is no diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index 15fa746..0e849a8 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -252,31 +252,45 @@ Response CGALEvaluator::visit(State &state, const TransformNode &node) // objects. So we convert in to our internal 2d data format, transform it, // tesselate it and create a new CGAL_Nef_polyhedron2 from it.. What a hack! - CGAL_Aff_transformation2 t( - node.matrix(0,0), node.matrix(0,1), node.matrix(0,3), - node.matrix(1,0), node.matrix(1,1), node.matrix(1,3), node.matrix(3,3)); - - DxfData *dd = N.convertToDxfData(); - for (size_t i=0; i < dd->points.size(); i++) { - CGAL_Kernel2::Point_2 p = CGAL_Kernel2::Point_2(dd->points[i][0], dd->points[i][1]); - p = t.transform(p); - dd->points[i][0] = to_double(p.x()); - dd->points[i][1] = to_double(p.y()); + Eigen::Matrix2f testmat; + testmat << node.matrix(0,0), node.matrix(0,1), node.matrix(1,0), node.matrix(1,1); + if (testmat.determinant() == 0) { + PRINT("Warning: Scaling a 2D object with 0 - removing object"); + N.p2.reset(); + } + else { + CGAL_Aff_transformation2 t( + node.matrix(0,0), node.matrix(0,1), node.matrix(0,3), + node.matrix(1,0), node.matrix(1,1), node.matrix(1,3), node.matrix(3,3)); + + DxfData *dd = N.convertToDxfData(); + for (size_t i=0; i < dd->points.size(); i++) { + CGAL_Kernel2::Point_2 p = CGAL_Kernel2::Point_2(dd->points[i][0], dd->points[i][1]); + p = t.transform(p); + dd->points[i][0] = to_double(p.x()); + dd->points[i][1] = to_double(p.y()); + } + + PolySet ps; + ps.is2d = true; + dxf_tesselate(&ps, *dd, 0, true, false, 0); + + N = evaluateCGALMesh(ps); + delete dd; } - - PolySet ps; - ps.is2d = true; - dxf_tesselate(&ps, *dd, 0, true, false, 0); - - N = evaluateCGALMesh(ps); - delete dd; } else if (N.dim == 3) { - CGAL_Aff_transformation t( - node.matrix(0,0), node.matrix(0,1), node.matrix(0,2), node.matrix(0,3), - node.matrix(1,0), node.matrix(1,1), node.matrix(1,2), node.matrix(1,3), - node.matrix(2,0), node.matrix(2,1), node.matrix(2,2), node.matrix(2,3), node.matrix(3,3)); - N.p3->transform(t); + if (node.matrix.matrix().determinant() == 0) { + PRINT("Warning: Scaling a 3D object with 0 - removing object"); + N.p3.reset(); + } + else { + CGAL_Aff_transformation t( + node.matrix(0,0), node.matrix(0,1), node.matrix(0,2), node.matrix(0,3), + node.matrix(1,0), node.matrix(1,1), node.matrix(1,2), node.matrix(1,3), + node.matrix(2,0), node.matrix(2,1), node.matrix(2,2), node.matrix(2,3), node.matrix(3,3)); + N.p3->transform(t); + } } } else { diff --git a/src/CGAL_Nef_polyhedron.cc b/src/CGAL_Nef_polyhedron.cc index 04783e5..ba298ad 100644 --- a/src/CGAL_Nef_polyhedron.cc +++ b/src/CGAL_Nef_polyhedron.cc @@ -61,6 +61,8 @@ CGAL_Nef_polyhedron &CGAL_Nef_polyhedron::minkowski(const CGAL_Nef_polyhedron &o int CGAL_Nef_polyhedron::weight() const { + if (this->empty()) return 0; + size_t memsize = sizeof(CGAL_Nef_polyhedron); if (this->dim == 2) { memsize += sizeof(CGAL_Nef_polyhedron2) + diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc index 81ae31e..6ed1ab4 100644 --- a/src/PolySetCGALEvaluator.cc +++ b/src/PolySetCGALEvaluator.cc @@ -281,12 +281,14 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const LinearExtrudeNode &node) BOOST_FOREACH (AbstractNode * v, node.getChildren()) { if (v->modinst->isBackground()) continue; CGAL_Nef_polyhedron N = this->cgalevaluator.evaluateCGALMesh(*v); - if (N.dim != 2) { - PRINT("ERROR: linear_extrude() is not defined for 3D child objects!"); - } - else { - if (sum.empty()) sum = N.copy(); - else sum += N; + if (!N.empty()) { + if (N.dim != 2) { + PRINT("ERROR: linear_extrude() is not defined for 3D child objects!"); + } + else { + if (sum.empty()) sum = N.copy(); + else sum += N; + } } } @@ -379,12 +381,14 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const RotateExtrudeNode &node) BOOST_FOREACH (AbstractNode * v, node.getChildren()) { if (v->modinst->isBackground()) continue; CGAL_Nef_polyhedron N = this->cgalevaluator.evaluateCGALMesh(*v); - if (N.dim != 2) { - PRINT("ERROR: rotate_extrude() is not defined for 3D child objects!"); - } - else { - if (sum.empty()) sum = N.copy(); - else sum += N; + if (!N.empty()) { + if (N.dim != 2) { + PRINT("ERROR: rotate_extrude() is not defined for 3D child objects!"); + } + else { + if (sum.empty()) sum = N.copy(); + else sum += N; + } } } diff --git a/src/transform.cc b/src/transform.cc index f5038b1..c2ac194 100644 --- a/src/transform.cc +++ b/src/transform.cc @@ -87,11 +87,10 @@ AbstractNode *TransformModule::evaluate(const Context *ctx, const ModuleInstanti { Vector3d scalevec(1,1,1); Value v = c.lookup_variable("v"); - v.getnum(scalevec[0]); - v.getnum(scalevec[1]); - v.getnum(scalevec[2]); - v.getv3(scalevec[0], scalevec[1], scalevec[2]); - if (scalevec[2] == 0) scalevec[2] = 1; + if (!v.getv3(scalevec[0], scalevec[1], scalevec[2], 1.0)) { + double num; + if (v.getnum(num)) scalevec.setConstant(num); + } node->matrix.scale(scalevec); } else if (this->type == ROTATE) diff --git a/src/value.cc b/src/value.cc index c9dbd55..93c4d5e 100644 --- a/src/value.cc +++ b/src/value.cc @@ -359,11 +359,11 @@ bool Value::getv2(double &x, double &y) const return true; } -bool Value::getv3(double &x, double &y, double &z) const +bool Value::getv3(double &x, double &y, double &z, double defaultval) const { if (this->type == VECTOR && this->vec.size() == 2) { if (getv2(x, y)) { - z = 0; + z = defaultval; return true; } return false; diff --git a/src/value.h b/src/value.h index a2cfbdf..4a67fbc 100644 --- a/src/value.h +++ b/src/value.h @@ -73,7 +73,7 @@ public: bool getnum(double &v) const; bool getv2(double &x, double &y) const; - bool getv3(double &x, double &y, double &z) const; + bool getv3(double &x, double &y, double &z, double defaultval = 0.0) const; std::string toString() const; diff --git a/tests/regression/cgalpngtest/scale2D-tests-expected.png b/tests/regression/cgalpngtest/scale2D-tests-expected.png new file mode 100644 index 0000000..c23b7a0 Binary files /dev/null and b/tests/regression/cgalpngtest/scale2D-tests-expected.png differ diff --git a/tests/regression/cgalpngtest/scale3D-tests-expected.png b/tests/regression/cgalpngtest/scale3D-tests-expected.png new file mode 100644 index 0000000..cbd8227 Binary files /dev/null and b/tests/regression/cgalpngtest/scale3D-tests-expected.png differ diff --git a/tests/regression/dumptest/scale2D-tests-expected.txt b/tests/regression/dumptest/scale2D-tests-expected.txt new file mode 100644 index 0000000..aa1eca2 --- /dev/null +++ b/tests/regression/dumptest/scale2D-tests-expected.txt @@ -0,0 +1,34 @@ + multmatrix([[2, 0, 0, 0], [0, 1.33333, 0, 0], [0, 0, 2, 0], [0, 0, 0, 1]]) { + group() { + square(size = [2, 3], center = true); + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[2, 0, 0, 0], [0, 1.33333, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + square(size = [2, 3], center = true); + } + } + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[2, 0, 0, 0], [0, 2, 0, 0], [0, 0, 2, 0], [0, 0, 0, 1]]) { + group() { + square(size = [2, 3], center = true); + } + } + } + linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + square(size = [2, 3], center = true); + } + } + } + linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + square(size = [2, 3], center = true); + } + } + } + diff --git a/tests/regression/dumptest/scale3D-tests-expected.txt b/tests/regression/dumptest/scale3D-tests-expected.txt new file mode 100644 index 0000000..c06b2fe --- /dev/null +++ b/tests/regression/dumptest/scale3D-tests-expected.txt @@ -0,0 +1,43 @@ + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 2, 0, 0], [0, 0, 3, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 8, $fa = 12, $fs = 2, h = 1, r1 = 1, r2 = 1, center = true); + } + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[2, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 8, $fa = 12, $fs = 2, h = 1, r1 = 1, r2 = 1, center = true); + } + } + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[2, 0, 0, 0], [0, 2, 0, 0], [0, 0, 2, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 8, $fa = 12, $fs = 2, h = 1, r1 = 1, r2 = 1, center = true); + } + } + } + linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 8, $fa = 12, $fs = 2, h = 1, r1 = 1, r2 = 1, center = true); + } + } + } + linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 8, $fa = 12, $fs = 2, h = 1, r1 = 1, r2 = 1, center = true); + } + } + } + linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 8, $fa = 12, $fs = 2, h = 1, r1 = 1, r2 = 1, center = true); + } + } + } + diff --git a/tests/regression/opencsgtest/scale2D-tests-expected.png b/tests/regression/opencsgtest/scale2D-tests-expected.png new file mode 100644 index 0000000..515265b Binary files /dev/null and b/tests/regression/opencsgtest/scale2D-tests-expected.png differ diff --git a/tests/regression/opencsgtest/scale3D-tests-expected.png b/tests/regression/opencsgtest/scale3D-tests-expected.png new file mode 100644 index 0000000..7401b99 Binary files /dev/null and b/tests/regression/opencsgtest/scale3D-tests-expected.png differ diff --git a/tests/regression/throwntogethertest/scale2D-tests-expected.png b/tests/regression/throwntogethertest/scale2D-tests-expected.png new file mode 100644 index 0000000..515265b Binary files /dev/null and b/tests/regression/throwntogethertest/scale2D-tests-expected.png differ diff --git a/tests/regression/throwntogethertest/scale3D-tests-expected.png b/tests/regression/throwntogethertest/scale3D-tests-expected.png new file mode 100644 index 0000000..7401b99 Binary files /dev/null and b/tests/regression/throwntogethertest/scale3D-tests-expected.png differ -- cgit v0.10.1 From 70d933290271d072399d6bf47ec1703d5160b5dd Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 22 Feb 2012 13:50:38 +0100 Subject: bugfix: include dependency trackng didn't work for top-level includes. Reported by Gordon Wrigley diff --git a/src/MainWindow.h b/src/MainWindow.h index ed12f34..a4835c2 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -77,11 +77,12 @@ private: AbstractNode *find_root_tag(AbstractNode *n); void updateTemporalVariables(); bool fileChangedOnDisk(); + bool includesChanged(); bool compileTopLevelDocument(bool reload); bool compile(bool reload, bool procevents); void compileCSG(bool procevents); bool maybeSave(); - bool checkModified(); + bool checkEditorModified(); QString dumpCSGTree(AbstractNode *root); static void consoleOutput(const std::string &msg, void *userdata); void loadViewSettings(); diff --git a/src/mainwin.cc b/src/mainwin.cc index be7c567..4b9a0e7 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -928,7 +928,7 @@ void MainWindow::actionSaveAs() void MainWindow::actionReload() { - if (checkModified()) refreshDocument(); + if (checkEditorModified()) refreshDocument(); } void MainWindow::hideEditor() @@ -1003,6 +1003,23 @@ bool MainWindow::fileChangedOnDisk() return false; } +// FIXME: The following two methods are duplicated in ModuleCache.cc - refactor +static bool is_modified(const std::string &filename, const time_t &mtime) +{ + struct stat st; + memset(&st, 0, sizeof(struct stat)); + stat(filename.c_str(), &st); + return (st.st_mtime > mtime); +} + +bool MainWindow::includesChanged() +{ + BOOST_FOREACH(const Module::IncludeContainer::value_type &item, this->root_module->includes) { + if (is_modified(item.first, item.second)) return true; + } + return false; +} + /*! If reload is true, does a timestamp check on the document and tries to reload it. Otherwise, just reparses the current document and any dependencies, updates the @@ -1014,7 +1031,9 @@ bool MainWindow::compileTopLevelDocument(bool reload) { bool shouldcompiletoplevel = !reload; - if (reload && fileChangedOnDisk() && checkModified()) { + if (reload && + (fileChangedOnDisk() && checkEditorModified()) || + includesChanged()) { shouldcompiletoplevel = true; refreshDocument(); } @@ -1083,7 +1102,7 @@ void MainWindow::autoReloadSet(bool on) } } -bool MainWindow::checkModified() +bool MainWindow::checkEditorModified() { if (editor->isContentModified()) { QMessageBox::StandardButton ret; -- cgit v0.10.1 From 6a9b8a56c1123d4ef0e511a1ab69d1f31fc6306d Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 22 Feb 2012 14:00:10 +0100 Subject: Fix for missing GLU include by chrysn diff --git a/src/system-gl.h b/src/system-gl.h index 0377b72..d7de3c6 100644 --- a/src/system-gl.h +++ b/src/system-gl.h @@ -7,6 +7,7 @@ #include #else #include + #include #ifdef _WIN32 #include // For the CALLBACK macro #endif -- cgit v0.10.1 From f8228a61d098007457726e356ebdb4dedd8268e6 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 25 Feb 2012 06:01:29 +0100 Subject: fixed crash bug introduced in previous commit diff --git a/src/mainwin.cc b/src/mainwin.cc index 4b9a0e7..bb0f90d 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -1014,8 +1014,10 @@ static bool is_modified(const std::string &filename, const time_t &mtime) bool MainWindow::includesChanged() { - BOOST_FOREACH(const Module::IncludeContainer::value_type &item, this->root_module->includes) { - if (is_modified(item.first, item.second)) return true; + if (this->root_module) { + BOOST_FOREACH(const Module::IncludeContainer::value_type &item, this->root_module->includes) { + if (is_modified(item.first, item.second)) return true; + } } return false; } -- cgit v0.10.1 From 48421951da466c2e78a1354797f6b215224e827d Mon Sep 17 00:00:00 2001 From: Don Bright Date: Thu, 1 Mar 2012 17:15:15 -0600 Subject: update GLEW version required, bug rpt from 42loop diff --git a/README b/README index 8c000fa..c00ecb0 100644 --- a/README +++ b/README @@ -55,7 +55,7 @@ development. Other versions may or may not work as well.. * OpenCSG (1.3.2): http://www.opencsg.org/ -* GLEW (1.5 ->) +* GLEW (1.6 ->) http://glew.sourceforge.net/ * Eigen2 (2.0.13->) -- cgit v0.10.1 From e88ec1a6167bcd7490b0124e9e4a6041b80809be Mon Sep 17 00:00:00 2001 From: Don Bright Date: Thu, 1 Mar 2012 17:17:30 -0600 Subject: require GLEW 1.6 per bug rpt from 42loop diff --git a/tests/FindGLEW.cmake b/tests/FindGLEW.cmake index a503368..1d94ca2 100644 --- a/tests/FindGLEW.cmake +++ b/tests/FindGLEW.cmake @@ -14,7 +14,7 @@ include(FindPkgConfig) if (PKG_CONFIG_FOUND) message("Doing pkg config glew check...") - pkg_check_modules(GLEW glew>=1.5) + pkg_check_modules(GLEW glew>=1.6) endif() if (GLEW_LIBRARIES) @@ -62,4 +62,4 @@ else() else() set(GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") endif() -endif() \ No newline at end of file +endif() -- cgit v0.10.1 From b38310a837fc41dae26efcadbb8305a20d7034dc Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 20 Mar 2012 12:05:18 +0100 Subject: bugfix: Support passing files without an explicit parent directory diff --git a/tests/cgalcachetest.cc b/tests/cgalcachetest.cc index 5675ef5..18e9efa 100644 --- a/tests/cgalcachetest.cc +++ b/tests/cgalcachetest.cc @@ -152,7 +152,9 @@ int main(int argc, char **argv) exit(1); } - fs::current_path(fs::path(filename).parent_path()); + if (fs::path(filename).has_parent_path()) { + fs::current_path(fs::path(filename).parent_path()); + } AbstractNode::resetIndexCounter(); AbstractNode *absolute_root_node = root_module->evaluate(&root_ctx, &root_inst); diff --git a/tests/cgalpngtest.cc b/tests/cgalpngtest.cc index 650c6d7..7c9684a 100644 --- a/tests/cgalpngtest.cc +++ b/tests/cgalpngtest.cc @@ -125,7 +125,9 @@ int main(int argc, char **argv) exit(1); } - fs::current_path(fs::path(filename).parent_path()); + if (fs::path(filename).has_parent_path()) { + fs::current_path(fs::path(filename).parent_path()); + } AbstractNode::resetIndexCounter(); AbstractNode *absolute_root_node = root_module->evaluate(&root_ctx, &root_inst); diff --git a/tests/cgalstlsanitytest.cc b/tests/cgalstlsanitytest.cc index 0bf7ac2..d0d0077 100644 --- a/tests/cgalstlsanitytest.cc +++ b/tests/cgalstlsanitytest.cc @@ -111,7 +111,9 @@ int main(int argc, char **argv) exit(1); } - fs::current_path(fs::path(filename).parent_path()); + if (fs::path(filename).has_parent_path()) { + fs::current_path(fs::path(filename).parent_path()); + } AbstractNode::resetIndexCounter(); AbstractNode *absolute_root_node = root_module->evaluate(&root_ctx, &root_inst); diff --git a/tests/cgaltest.cc b/tests/cgaltest.cc index 076983f..98617a3 100644 --- a/tests/cgaltest.cc +++ b/tests/cgaltest.cc @@ -104,7 +104,9 @@ int main(int argc, char **argv) exit(1); } - fs::current_path(fs::path(filename).parent_path()); + if (fs::path(filename).has_parent_path()) { + fs::current_path(fs::path(filename).parent_path()); + } AbstractNode::resetIndexCounter(); AbstractNode *absolute_root_node = root_module->evaluate(&root_ctx, &root_inst); diff --git a/tests/csgtermtest.cc b/tests/csgtermtest.cc index 89a9bdc..1bd2468 100644 --- a/tests/csgtermtest.cc +++ b/tests/csgtermtest.cc @@ -91,7 +91,9 @@ int main(int argc, char **argv) exit(1); } - fs::current_path(fs::path(filename).parent_path()); + if (fs::path(filename).has_parent_path()) { + fs::current_path(fs::path(filename).parent_path()); + } AbstractNode::resetIndexCounter(); root_node = root_module->evaluate(&root_ctx, &root_inst); diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc index b9f0d27..cb96940 100644 --- a/tests/csgtestcore.cc +++ b/tests/csgtestcore.cc @@ -276,7 +276,9 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) } if (!sysinfo_dump) { - fs::current_path(fs::path(filename).parent_path()); + if (fs::path(filename).has_parent_path()) { + fs::current_path(fs::path(filename).parent_path()); + } } AbstractNode::resetIndexCounter(); diff --git a/tests/csgtexttest.cc b/tests/csgtexttest.cc index 67e3416..6e18f20 100644 --- a/tests/csgtexttest.cc +++ b/tests/csgtexttest.cc @@ -95,7 +95,9 @@ int main(int argc, char **argv) exit(1); } - fs::current_path(fs::path(filename).parent_path()); + if (fs::path(filename).has_parent_path()) { + fs::current_path(fs::path(filename).parent_path()); + } AbstractNode::resetIndexCounter(); root_node = root_module->evaluate(&root_ctx, &root_inst); diff --git a/tests/dumptest.cc b/tests/dumptest.cc index dbf74ab..f923a64 100644 --- a/tests/dumptest.cc +++ b/tests/dumptest.cc @@ -101,7 +101,9 @@ int main(int argc, char **argv) exit(1); } - fs::current_path(fs::path(filename).parent_path()); + if (fs::path(filename).has_parent_path()) { + fs::current_path(fs::path(filename).parent_path()); + } AbstractNode::resetIndexCounter(); root_node = root_module->evaluate(&root_ctx, &root_inst); diff --git a/tests/echotest.cc b/tests/echotest.cc index b08e81a..d731ee3 100644 --- a/tests/echotest.cc +++ b/tests/echotest.cc @@ -103,7 +103,9 @@ int main(int argc, char **argv) exit(1); } - fs::current_path(fs::path(filename).parent_path()); + if (fs::path(filename).has_parent_path()) { + fs::current_path(fs::path(filename).parent_path()); + } AbstractNode::resetIndexCounter(); root_node = root_module->evaluate(&root_ctx, &root_inst); diff --git a/tests/modulecachetest.cc b/tests/modulecachetest.cc index ae872e2..2ef7a6c 100644 --- a/tests/modulecachetest.cc +++ b/tests/modulecachetest.cc @@ -92,7 +92,9 @@ int main(int argc, char **argv) exit(1); } - fs::current_path(fs::path(filename).parent_path()); + if (fs::path(filename).has_parent_path()) { + fs::current_path(fs::path(filename).parent_path()); + } AbstractNode::resetIndexCounter(); root_node = root_module->evaluate(&root_ctx, &root_inst); -- cgit v0.10.1 From 99cec78159145c6e2649ea30722e332db9a283e4 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 27 Mar 2012 23:40:55 +0200 Subject: Revert "expected file for updated projection-tests" This reverts commit 3cd36f972edd62c63b6a831b6b8b944240c22e49. diff --git a/tests/regression/dumptest/projection-tests-expected.txt b/tests/regression/dumptest/projection-tests-expected.txt index 9bc389e..77fdbb4 100644 --- a/tests/regression/dumptest/projection-tests-expected.txt +++ b/tests/regression/dumptest/projection-tests-expected.txt @@ -35,13 +35,4 @@ } } } - multmatrix([[1, 0, 0, 0], [0, 1, 0, -22], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 5, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { - projection(cut = true, convexity = 0) { - multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -5], [0, 0, 0, 1]]) { - cube(size = [10, 10, 10], center = true); - } - } - } - } -- cgit v0.10.1 From 4394c7a030ce7a08c95bd1af2e8c38ffcf972439 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 28 Mar 2012 00:02:48 +0200 Subject: Upgraded CGAL to 4.0 diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh index 730eb7f..1ce3103 100755 --- a/scripts/macosx-build-dependencies.sh +++ b/scripts/macosx-build-dependencies.sh @@ -192,9 +192,9 @@ build_cgal() cd $BASEDIR/src rm -rf CGAL-$version if [ ! -f CGAL-$version.tar.gz ]; then - # 4.0beta1curl -O https://gforge.inria.fr/frs/download.php/30225/CGAL-$version.tar.gz - # 3.9 - curl -O https://gforge.inria.fr/frs/download.php/29125/CGAL-$version.tar.gz + #4.0 + curl -O https://gforge.inria.fr/frs/download.php/30387/CGAL-$version.tar.gz + # 3.9 curl -O https://gforge.inria.fr/frs/download.php/29125/CGAL-$version.tar.gz # 3.8 curl -O https://gforge.inria.fr/frs/download.php/28500/CGAL-$version.tar.gz # 3.7 curl -O https://gforge.inria.fr/frs/download.php/27641/CGAL-$version.tar.gz fi @@ -291,6 +291,6 @@ 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 -build_cgal 3.9 +build_cgal 4.0 build_glew 1.7.0 build_opencsg 1.3.2 -- cgit v0.10.1 From 3019295737c5085af8e75d806702b7852ee5511d Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 28 Mar 2012 03:53:09 +0200 Subject: Less debug output diff --git a/src/ModuleCache.cc b/src/ModuleCache.cc index e974a03..70b1fb9 100644 --- a/src/ModuleCache.cc +++ b/src/ModuleCache.cc @@ -43,7 +43,8 @@ Module *ModuleCache::evaluate(const std::string &filename) if (this->entries.find(filename) != this->entries.end() && this->entries[filename].cache_id == cache_id) { #ifdef DEBUG - PRINTB("Using cached library: %s (%s)", filename % cache_id); +// Causes too much debug output +// PRINTB("Using cached library: %s (%s)", filename % cache_id); #endif lib_mod = &(*this->entries[filename].module); diff --git a/src/module.cc b/src/module.cc index 69623dd..fc849ff 100644 --- a/src/module.cc +++ b/src/module.cc @@ -225,8 +225,12 @@ bool Module::handleDependencies() Module::ModuleContainer::iterator curr = iter++; Module *oldmodule = curr->second; curr->second = ModuleCache::instance()->evaluate(curr->first); - if (curr->second != oldmodule) changed = true; - PRINTB_NOCACHE(" %s: %p", curr->first % curr->second); + if (curr->second != oldmodule) { + changed = true; +#ifdef DEBUG + PRINTB_NOCACHE(" %s: %p", curr->first % curr->second); +#endif + } if (!curr->second) { PRINTB_NOCACHE("WARNING: Failed to compile library '%s'.", curr->first); this->usedlibs.erase(curr); -- cgit v0.10.1 From c869c6e6b28580ab59c614f92d5834bb224bca02 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Thu, 29 Mar 2012 02:04:47 +0200 Subject: Remove superfluous debug output. Fixes #103 diff --git a/src/lexer.l b/src/lexer.l index 884275e..188046f 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -110,7 +110,6 @@ use[ \t\r\n>]*"<" { BEGIN(cond_use); } { [^\t\r\n>]+ { filename = yytext; } ">" { - PRINTB("USE: %s", filename); BEGIN(INITIAL); fs::path usepath; if (boosty::is_absolute(fs::path(filename))) { diff --git a/src/parser.y b/src/parser.y index 2f4379a..195e7a8 100644 --- a/src/parser.y +++ b/src/parser.y @@ -169,7 +169,6 @@ statement: Module *p = currmodule; module_stack.push_back(currmodule); currmodule = new Module(); - PRINTB_NOCACHE("New module: %s %p", $2 % currmodule); p->modules[$2] = currmodule; currmodule->argnames = $4->argnames; currmodule->argexpr = $4->argexpr; -- cgit v0.10.1 From 382e5fa7e1654b2e49ec81be482eef1bd2b09644 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 3 Apr 2012 12:36:22 +0200 Subject: Example file for issue #95 diff --git a/testdata/scad/bugs/issue95-normalization-crash.scad b/testdata/scad/bugs/issue95-normalization-crash.scad new file mode 100644 index 0000000..933cb3a --- /dev/null +++ b/testdata/scad/bugs/issue95-normalization-crash.scad @@ -0,0 +1,128 @@ +# +# Reported by Triffid Hunter. +# Causes a crash in CCGTermNormalizer::normalizePass() +# + +pi = 3.141592653589; +sl = 0.5; + +w = 400; + +pulley_diam = 28; +bearing_diam = 22; //include size of bearing guides + +module crx(size=[1, 1, 1]) { + linear_extrude(height=size[2]) + square([size[0], size[1]], center=true); +} + +module cyl(r=1, h=1, center=false) { + cylinder(r=r, h=h, center=center, $fn=r * 2 * pi / sl); +} + +module lm8uu() { + cyl(r=15 /2, h=24); +} + +module nema17() { + translate([0, 0, -48]) crx([42, 42, 48]); + translate([0, 0, -1]) { + cyl(r=2.5, h=26); + cyl(r=22.5 / 2, h=3.1); + } + translate([0, 0, 2.1]) { + difference() { + cyl(r=pulley_diam / 2, h=11.5); + translate([0, 0, (11.5 - 8) / 2]) rotate_extrude() + translate([21.5 / 2, 0]) + square(8); + } + } + cyl(r=17.5 / 2, h=19.5); + for (i=[0:3]) { + rotate([0, 0, i * 90]) + translate([31 / 2, 31 / 2, -1]) { + cyl(r=1.5, h=11); + translate([0, 0, 5.5]) + cyl(r=4, h=30); + } + } +} + +module bearing608() { + cyl(r=bearing_diam / 2, h = 7); +} + +module rods() { + for (i=[0:1]) { + translate([25, 0, i * 70]) + rotate([0, -90, 0]) + cyl(r=4, h=420); + } + + translate([0, 10, -40]) { + cyl(r=3, h=150); + translate([0, 0, 34]) cylinder(r=10 / cos(180 / 6) / 2, h=6, $fn=6); + } + + translate([30, 10, -40]) { + cyl(r=4, h=150); + } +} + +module lm8uu_holder() { + render() + difference() { + union() { + translate([0, 0, -13]) difference() { + hull() { + translate([-9, -9, -1]) cube([18, 1, 28]); + translate([0, 1, -1]) cyl(r=18 / 2, h = 28); + } + translate([-10, 5, -1]) cube([20, 10, 28]); + translate([-10, -3, 11 - 5]) cube([20, 20, 4]); + translate([-10, -3, 11 + 5]) cube([20, 20, 4]); + } + } + translate([0, 0, -11]) { + hull() { + #lm8uu(); + translate([0, 10, 0]) cyl(r=6, h=24); + } + translate([0, 0, -3]) hull() { + cyl(r=5, h=30); + translate([0, 10, 0]) cyl(r=5, h=30); + } + } + } +} + +module x_end_motor() { + difference() { + union() { + translate([-10, -18, -19]) #cube([50, 2, 90]); + translate([30, 10, 60]) lm8uu_holder(); + translate([30, 10, -5]) lm8uu_holder(); + } + #rods(); + + translate([15.5, -19, 14]) { + rotate([90, 0, 0]) cyl(r=30 / 2, h= 50, center=true); + rotate([-90, 45, 0]) + #nema17(); + translate([-w, 4, 0]) + rotate([-90, 0, 0]) + bearing608(); + translate([0, 5, 0]) hull() { + #translate([0, 0, 24 / 2 - 1.5]) cube([1, 5, 1.5]); + #translate([-w, 0, bearing_diam / 2 ]) cube([1, 5, 1.5]); + } + translate([0, 5, 0]) hull() { + #translate([0, 0, 24 / -2]) cube([1, 5, 1.5]); + #translate([-w, 0, bearing_diam / -2 - 1.5]) cube([1, 5, 1.5]); + } + } + } +} + +x_end_motor(); \ No newline at end of file -- cgit v0.10.1 From 405dfaa65fee892714ca7a689cc2916f54ada409 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 3 Apr 2012 13:21:16 +0200 Subject: typo diff --git a/testdata/scad/bugs/issue95-normalization-crash.scad b/testdata/scad/bugs/issue95-normalization-crash.scad index 933cb3a..10a3f66 100644 --- a/testdata/scad/bugs/issue95-normalization-crash.scad +++ b/testdata/scad/bugs/issue95-normalization-crash.scad @@ -1,7 +1,7 @@ -# -# Reported by Triffid Hunter. -# Causes a crash in CCGTermNormalizer::normalizePass() -# +// +// Reported by Triffid Hunter. +// Causes a crash in CCGTermNormalizer::normalizePass() +// pi = 3.141592653589; sl = 0.5; -- cgit v0.10.1 From 2c2731598aac00589be3f525687e0b3d272ed7eb Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 4 Apr 2012 01:46:50 +0200 Subject: Missing NULL check on some normalization corner cases. Fixes #95 diff --git a/src/csgtermnormalizer.cc b/src/csgtermnormalizer.cc index 0e7a759..b4bfa4c 100644 --- a/src/csgtermnormalizer.cc +++ b/src/csgtermnormalizer.cc @@ -44,9 +44,10 @@ shared_ptr CSGTermNormalizer::normalizePass(shared_ptr term) do { while (term && normalize_tail(term)) { } if (!term || term->type == CSGTerm::TYPE_PRIMITIVE) return term; - term->left = normalizePass(term->left); + if (term->left) term->left = normalizePass(term->left); } while (term->type != CSGTerm::TYPE_UNION && - (term->right->type != CSGTerm::TYPE_PRIMITIVE || term->left->type == CSGTerm::TYPE_UNION)); + (term->right && term->right->type != CSGTerm::TYPE_PRIMITIVE || + term->left && term->left->type == CSGTerm::TYPE_UNION)); term->right = normalizePass(term->right); // FIXME: Do we need to take into account any transformation of item here? -- cgit v0.10.1 From dda5195130c6f0628768ad2a441b91c6fe5955e5 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sun, 22 Apr 2012 19:31:23 -0400 Subject: Align tesselation of cylinders and rotate_extrude. Fixes #108 diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc index 6ed1ab4..1cc6b16 100644 --- a/src/PolySetCGALEvaluator.cc +++ b/src/PolySetCGALEvaluator.cc @@ -454,15 +454,10 @@ PolySet *PolySetCGALEvaluator::rotateDxfData(const RotateExtrudeNode &node, DxfD } for (int j = 0; j < fragments; j++) { - double a = (j*2*M_PI) / fragments; + double a = (j*2*M_PI) / fragments - M_PI/2; // start on the X axis for (size_t k = 0; k < dxf.paths[i].indices.size(); k++) { - if (dxf.points[dxf.paths[i].indices[k]][0] == 0) { - points[j][k][0] = 0; - points[j][k][1] = 0; - } else { - points[j][k][0] = dxf.points[dxf.paths[i].indices[k]][0] * sin(a); - points[j][k][1] = dxf.points[dxf.paths[i].indices[k]][0] * cos(a); - } + points[j][k][0] = dxf.points[dxf.paths[i].indices[k]][0] * sin(a); + points[j][k][1] = dxf.points[dxf.paths[i].indices[k]][0] * cos(a); points[j][k][2] = dxf.points[dxf.paths[i].indices[k]][1]; } } -- cgit v0.10.1 From 775a9c89f3c570026262b51d16c3bc93cce3b6ee Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sun, 22 Apr 2012 19:32:01 -0400 Subject: sync diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 1a10b10..32f3788 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -15,7 +15,7 @@ o use'ing an non-existing file sometimes crashed under Windows o Better font handling: Ensure a monospace font is chosen as default o Division by zero caused hang in some cases (e.g. sin(1/0)) o Larger minkowski operations sometimes caused a crash after a CGAL assert was thrown -o Fixed crashes in shared_ptr.hpp (or similar places) due to a cache management bug +o Fixed crashes in shared_ptr.hpp (or similar places) due bugs in cache management and CSG normalization o scale() with a scale factor of zero could cause a crash o Fixed a number of issues related to use/include o Providing an unknown parameter on the cmd-line caused a crash -- cgit v0.10.1 From 4280fb25ad2dbb1ef8651bf93da574ac73a65cd1 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sun, 22 Apr 2012 19:32:15 -0400 Subject: sync diff --git a/doc/TODO.txt b/doc/TODO.txt index 5bb66af..8fc9be8 100644 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -1,6 +1,6 @@ -BUGS ----- +BUGS (FIXME: Verify and move these to github) +--------------------------------------------- o Some invalid DXF data gets pass the import checks and breaks the tessing code o Tesselation via GLU sometimes produces strange results o Export STL: Exports existing CGAL model even though the current model is changed, but not CGAL rendered @@ -8,8 +8,8 @@ o Look into the polygon winding and rotate_extrude() problem reported by Britton o CGAL Aff_transformation_3 doesn't support non-affine transformations (non-aff-matrix.scad) o 2D union of polygons with a touching vertex doesn't work. see testdata/scad/bugs/polygon-touch.scad -STL Import BUGS ---------------- +STL Import BUGS (FIXME: Verify and move these to github) +-------------------------------------------------------- Using STL-imported models is tricky and triggers multiple issues: (these all fail with the usual "Illegal polygonal object" error) @@ -117,7 +117,6 @@ OpenCSG-related --------------- o OpenCSG rendering: Coincident surfaces causes z-buffer fighting. Is this somehow avoidable tuning the depth tests in OpenCSG? -o Make the 10.000 element OpenCSG limit configurable (Preferences) ? o When specifying a transparency with the color() statement, the object is not sorted and will be rendered wrongly o Bug: Using the background operator (%) on the only object in a scene triggers a -- cgit v0.10.1 From bc15e944da6a5670b81cb6edfaf44a7493c630fa Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Tue, 24 Apr 2012 01:14:33 +0200 Subject: Added /openscad to .gitignore diff --git a/.gitignore b/.gitignore index a1db306..50dace1 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ parser_yacc.h /tmp /OpenSCAD.app */#*# +/openscad -- cgit v0.10.1 From dde401cadb499b272c1a2fe992e48c354bc5e5cf Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Tue, 24 Apr 2012 01:16:22 +0200 Subject: Fixed build for old OpenCSG versions (no OPENCSG_VERSION_STRING) diff --git a/src/mainwin.cc b/src/mainwin.cc index bb0f90d..90e5f61 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -95,6 +95,10 @@ #endif // ENABLE_CGAL +#ifndef OPENCSG_VERSION_STRING +#define OPENCSG_VERSION_STRING "unknown, <1.3.2" +#endif + // Global application state unsigned int GuiLocker::gui_locked = 0; -- cgit v0.10.1 From a718c4a59dd251dd4c2cf8fca1ae6a5ebe1ad990 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Tue, 24 Apr 2012 01:17:21 +0200 Subject: Some trivial fixes for compiler warnings diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index 0e849a8..46f4cfa 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -43,11 +43,8 @@ CGAL_Nef_polyhedron CGALEvaluator::evaluateCGALMesh(const AbstractNode &node) Traverser evaluate(*this, node, Traverser::PRE_AND_POSTFIX); evaluate.execute(); return this->root; - assert(this->visitedchildren.empty()); - } - else { - return CGALCache::instance()->get(this->tree.getIdString(node)); } + return CGALCache::instance()->get(this->tree.getIdString(node)); } bool CGALEvaluator::isCached(const AbstractNode &node) const diff --git a/src/OpenCSGWarningDialog.cc b/src/OpenCSGWarningDialog.cc index fdaaa50..5648576 100644 --- a/src/OpenCSGWarningDialog.cc +++ b/src/OpenCSGWarningDialog.cc @@ -1,7 +1,7 @@ #include "OpenCSGWarningDialog.h" #include "Preferences.h" -OpenCSGWarningDialog::OpenCSGWarningDialog(QWidget *parent) +OpenCSGWarningDialog::OpenCSGWarningDialog(QWidget*) { setupUi(this); diff --git a/src/csgtermnormalizer.cc b/src/csgtermnormalizer.cc index b4bfa4c..6600758 100644 --- a/src/csgtermnormalizer.cc +++ b/src/csgtermnormalizer.cc @@ -46,8 +46,8 @@ shared_ptr CSGTermNormalizer::normalizePass(shared_ptr term) if (!term || term->type == CSGTerm::TYPE_PRIMITIVE) return term; if (term->left) term->left = normalizePass(term->left); } while (term->type != CSGTerm::TYPE_UNION && - (term->right && term->right->type != CSGTerm::TYPE_PRIMITIVE || - term->left && term->left->type == CSGTerm::TYPE_UNION)); + ((term->right && term->right->type != CSGTerm::TYPE_PRIMITIVE) || + (term->left && term->left->type == CSGTerm::TYPE_UNION))); term->right = normalizePass(term->right); // FIXME: Do we need to take into account any transformation of item here? diff --git a/src/mainwin.cc b/src/mainwin.cc index 90e5f61..087cb30 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -1037,8 +1037,7 @@ bool MainWindow::compileTopLevelDocument(bool reload) { bool shouldcompiletoplevel = !reload; - if (reload && - (fileChangedOnDisk() && checkEditorModified()) || + if ((reload && fileChangedOnDisk() && checkEditorModified()) || includesChanged()) { shouldcompiletoplevel = true; refreshDocument(); -- cgit v0.10.1 From 940946c060e682446994ba6b671ce7f6bd8b6da5 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Tue, 24 Apr 2012 01:20:48 +0200 Subject: Fixed rendering of crosshairs position diff --git a/src/glview.cc b/src/glview.cc index 0f9ec5b..5ff6c2c 100644 --- a/src/glview.cc +++ b/src/glview.cc @@ -393,8 +393,6 @@ void GLView::paintGL() glRotated(object_rot_y, 0.0, 1.0, 0.0); glRotated(object_rot_z, 0.0, 0.0, 1.0); - glTranslated(object_trans_x, object_trans_y, object_trans_z); - // FIXME: Crosshairs and axes are lighted, this doesn't make sense and causes them // to change color based on view orientation. if (showcrosshairs) @@ -412,6 +410,8 @@ void GLView::paintGL() glEnd(); } + glTranslated(object_trans_x, object_trans_y, object_trans_z); + // Large gray axis cross inline with the model // FIXME: This is always gray - adjust color to keep contrast with background if (showaxes) -- cgit v0.10.1 From f5a7e92367adb7bbadaff8d27ff1610d91034b6a Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Tue, 24 Apr 2012 01:33:22 +0200 Subject: Fixed x/y panning (middle mouse button) diff --git a/src/glview.cc b/src/glview.cc index 5ff6c2c..12657b8 100644 --- a/src/glview.cc +++ b/src/glview.cc @@ -589,14 +589,21 @@ void GLView::mouseMoveEvent(QMouseEvent *event) normalizeAngle(object_rot_y); normalizeAngle(object_rot_z); } else { - // Right button pans - // Shift-right zooms + // Right button pans in the xz plane + // Middle button pans in the xy plane + // Shift-right and Shift-middle zooms if ((QApplication::keyboardModifiers() & Qt::ShiftModifier) != 0) { viewer_distance += (GLdouble)dy; } else { double mx = +(dx) * viewer_distance/1000; - double my = -(dy) * viewer_distance/1000; + double mz = -(dy) * viewer_distance/1000; + + double my = 0; + if (event->buttons() & Qt::MiddleButton) { + my = mz; + mz = 0; + } Matrix3d aax, aay, aaz, tm3; aax = Eigen::AngleAxisd(-(object_rot_x/180) * M_PI, Vector3d::UnitX()); @@ -612,15 +619,10 @@ void GLView::mouseMoveEvent(QMouseEvent *event) Matrix4d vec; vec << 0, 0, 0, mx, - 0, 0, 0, 0, 0, 0, 0, my, + 0, 0, 0, mz, 0, 0, 0, 1 ; - if ((QApplication::keyboardModifiers() & Qt::ShiftModifier) != 0) { - vec(0,3) = 0; - vec(1,3) = my; - vec(2,3) = 0; - } tm = tm * vec; object_trans_x += tm(0,3); object_trans_y += tm(1,3); -- cgit v0.10.1 From 6d53b35f5b43de526248945aa046e37e8192845e Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Tue, 24 Apr 2012 11:50:41 +0200 Subject: Actually lock X for middle mouse button panning diff --git a/src/glview.cc b/src/glview.cc index 12657b8..aa2e746 100644 --- a/src/glview.cc +++ b/src/glview.cc @@ -603,6 +603,9 @@ void GLView::mouseMoveEvent(QMouseEvent *event) if (event->buttons() & Qt::MiddleButton) { my = mz; mz = 0; + // actually lock the x-position + // (turns out to be easier to use than xy panning) + mx = 0; } Matrix3d aax, aay, aaz, tm3; -- cgit v0.10.1 From 74a380df150fe21a0e432a9fc2f80824ce17097e Mon Sep 17 00:00:00 2001 From: Wil Chung Date: Mon, 7 May 2012 11:24:21 -0700 Subject: added md extension to README to get it to render correctly on Github diff --git a/README b/README deleted file mode 100644 index c00ecb0..0000000 --- a/README +++ /dev/null @@ -1,88 +0,0 @@ - -WHAT IS IT? -=========== - -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. - -Unlike most free software for creating 3D models (such as the famous -application Blender) it does not focus on the artistic aspects of 3D modelling -but instead on the CAD aspects. Thus it might be the application you are -looking for when you are planning to create 3D models of machine parts but -pretty sure is not what you are looking for when you are more interested in -creating computer-animated movies. - -OpenSCAD is not an interactive modeller. Instead it is something like a -3D-compiler that reads in a script file that describes the object and renders -the 3D model from this script file (see examples below). This gives you (the -designer) full control over the modelling process and enables you to easily -change any step in the modelling process or make designs that are defined by -configurable parameters. - -OpenSCAD provides two main modelling techniques: First there is constructive -solid geometry (aka CSG) and second there is extrusion of 2D outlines. As data -exchange format format for this 2D outlines Autocad DXF files are used. In -addition to 2D paths for extrusion it is also possible to read design parametes -from DXF files. Besides DXF files OpenSCAD can read and create 3D models in the -STL and OFF file formats. - - -PREREQUISITES -============= - -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.. - -* Qt4 (4.4 - 4.7): - http://www.qt.nokia.com/ - -* CGAL (3.6 - 3.9): - http://www.cgal.org/ - -* GMP (5.0.x): - http://www.gmplib.org/ - -* MPFR (3.x): - http://www.mpfr.org/ - -* boost (1.35 - 1.47) - http://www.boost.org/ - -* cmake (2.6 - 2.8, required by CGAL and the test framework) - http://www.cmake.org/ - -* OpenCSG (1.3.2): - http://www.opencsg.org/ - -* GLEW (1.6 ->) - http://glew.sourceforge.net/ - -* Eigen2 (2.0.13->) - http://eigen.tuxfamily.org/ - -* GCC C++ Compiler (4.2 ->): - http://gcc.gnu.org/ - -* Bison (2.4): - http://www.gnu.org/software/bison/ - -* Flex (2.5.35): - http://flex.sourceforge.net/ - - -BUILDING OPENSCAD -================ - -First, run 'qmake' from Qt4 to generate a Makefile. On some systems you need to -run 'qmake4', 'qmake-qt4' or something alike to run the qt4 version of the tool. - -Then run make. Finally you might run 'make install' as root or simply copy the -'openscad' binary (OpenSCAD.app on Mac OS X) to the bin directory of your choice. - - -DOCUMENTATION -============= - -Have a look at the OpenSCAD Homepage (http://openscad.org/) for documentation. - diff --git a/README.md b/README.md new file mode 100644 index 0000000..c00ecb0 --- /dev/null +++ b/README.md @@ -0,0 +1,88 @@ + +WHAT IS IT? +=========== + +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. + +Unlike most free software for creating 3D models (such as the famous +application Blender) it does not focus on the artistic aspects of 3D modelling +but instead on the CAD aspects. Thus it might be the application you are +looking for when you are planning to create 3D models of machine parts but +pretty sure is not what you are looking for when you are more interested in +creating computer-animated movies. + +OpenSCAD is not an interactive modeller. Instead it is something like a +3D-compiler that reads in a script file that describes the object and renders +the 3D model from this script file (see examples below). This gives you (the +designer) full control over the modelling process and enables you to easily +change any step in the modelling process or make designs that are defined by +configurable parameters. + +OpenSCAD provides two main modelling techniques: First there is constructive +solid geometry (aka CSG) and second there is extrusion of 2D outlines. As data +exchange format format for this 2D outlines Autocad DXF files are used. In +addition to 2D paths for extrusion it is also possible to read design parametes +from DXF files. Besides DXF files OpenSCAD can read and create 3D models in the +STL and OFF file formats. + + +PREREQUISITES +============= + +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.. + +* Qt4 (4.4 - 4.7): + http://www.qt.nokia.com/ + +* CGAL (3.6 - 3.9): + http://www.cgal.org/ + +* GMP (5.0.x): + http://www.gmplib.org/ + +* MPFR (3.x): + http://www.mpfr.org/ + +* boost (1.35 - 1.47) + http://www.boost.org/ + +* cmake (2.6 - 2.8, required by CGAL and the test framework) + http://www.cmake.org/ + +* OpenCSG (1.3.2): + http://www.opencsg.org/ + +* GLEW (1.6 ->) + http://glew.sourceforge.net/ + +* Eigen2 (2.0.13->) + http://eigen.tuxfamily.org/ + +* GCC C++ Compiler (4.2 ->): + http://gcc.gnu.org/ + +* Bison (2.4): + http://www.gnu.org/software/bison/ + +* Flex (2.5.35): + http://flex.sourceforge.net/ + + +BUILDING OPENSCAD +================ + +First, run 'qmake' from Qt4 to generate a Makefile. On some systems you need to +run 'qmake4', 'qmake-qt4' or something alike to run the qt4 version of the tool. + +Then run make. Finally you might run 'make install' as root or simply copy the +'openscad' binary (OpenSCAD.app on Mac OS X) to the bin directory of your choice. + + +DOCUMENTATION +============= + +Have a look at the OpenSCAD Homepage (http://openscad.org/) for documentation. + -- cgit v0.10.1 From 56648045cc191d00b935ce6357dcc51d20adffc6 Mon Sep 17 00:00:00 2001 From: Wil Chung Date: Mon, 7 May 2012 11:27:45 -0700 Subject: fixed typos in readme fixed typo diff --git a/README.md b/README.md index c00ecb0..90e2501 100644 --- a/README.md +++ b/README.md @@ -6,23 +6,23 @@ 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. Unlike most free software for creating 3D models (such as the famous -application Blender) it does not focus on the artistic aspects of 3D modelling +application Blender) it does not focus on the artistic aspects of 3D modeling but instead on the CAD aspects. Thus it might be the application you are looking for when you are planning to create 3D models of machine parts but pretty sure is not what you are looking for when you are more interested in creating computer-animated movies. -OpenSCAD is not an interactive modeller. Instead it is something like a +OpenSCAD is not an interactive modeler. Instead it is something like a 3D-compiler that reads in a script file that describes the object and renders the 3D model from this script file (see examples below). This gives you (the -designer) full control over the modelling process and enables you to easily -change any step in the modelling process or make designs that are defined by +designer) full control over the modeling process and enables you to easily +change any step in the modeling process or make designs that are defined by configurable parameters. -OpenSCAD provides two main modelling techniques: First there is constructive +OpenSCAD provides two main modeling techniques: First there is constructive solid geometry (aka CSG) and second there is extrusion of 2D outlines. As data exchange format format for this 2D outlines Autocad DXF files are used. In -addition to 2D paths for extrusion it is also possible to read design parametes +addition to 2D paths for extrusion it is also possible to read design parameters from DXF files. Besides DXF files OpenSCAD can read and create 3D models in the STL and OFF file formats. -- cgit v0.10.1 From 725d8f044eae93101cf2bbc42c2e4a3382ca8b1a Mon Sep 17 00:00:00 2001 From: Wil Chung Date: Mon, 7 May 2012 14:15:43 -0700 Subject: Changed prerequisites to links diff --git a/README.md b/README.md index 90e2501..e55c2c1 100644 --- a/README.md +++ b/README.md @@ -34,45 +34,18 @@ 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.. -* Qt4 (4.4 - 4.7): - http://www.qt.nokia.com/ - -* CGAL (3.6 - 3.9): - http://www.cgal.org/ - -* GMP (5.0.x): - http://www.gmplib.org/ - -* MPFR (3.x): - http://www.mpfr.org/ - -* boost (1.35 - 1.47) - http://www.boost.org/ - -* cmake (2.6 - 2.8, required by CGAL and the test framework) - http://www.cmake.org/ - -* OpenCSG (1.3.2): - http://www.opencsg.org/ - -* GLEW (1.6 ->) - http://glew.sourceforge.net/ - -* Eigen2 (2.0.13->) - http://eigen.tuxfamily.org/ - -* GCC C++ Compiler (4.2 ->): - http://gcc.gnu.org/ - -* Bison (2.4): - http://www.gnu.org/software/bison/ - -* Flex (2.5.35): - http://flex.sourceforge.net/ - - -BUILDING OPENSCAD -================ +* [Qt4 (4.4 - 4.7)](http://www.qt.nokia.com/) +* [CGAL (3.6 - 3.9)](http://www.cgal.org/) +* [GMP (5.0.x)](http://www.gmplib.org/) +* [MPFR (3.x)](http://www.mpfr.org/) +* [boost (1.35 - 1.47)](http://www.boost.org/) +* [cmake (2.6 - 2.8, required by CGAL and the test framework)](http://www.cmake.org/) +* [OpenCSG (1.3.2)](http://www.opencsg.org/) +* [GLEW (1.6 ->)](http://glew.sourceforge.net/) +* [Eigen2 (2.0.13->)](http://eigen.tuxfamily.org/) +* [GCC C++ Compiler (4.2 ->)](http://gcc.gnu.org/) +* [Bison (2.4)](http://www.gnu.org/software/bison/) +* [Flex (2.5.35)](http://flex.sourceforge.net/) First, run 'qmake' from Qt4 to generate a Makefile. On some systems you need to run 'qmake4', 'qmake-qt4' or something alike to run the qt4 version of the tool. -- cgit v0.10.1 From 924aa05f55666b361b7a777570fa6dc95d066686 Mon Sep 17 00:00:00 2001 From: Wil Chung Date: Mon, 7 May 2012 15:00:31 -0700 Subject: added build instructions in the README diff --git a/README.md b/README.md index e55c2c1..7cb5e34 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ -WHAT IS IT? -=========== +# What is OpenSCAD? 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. @@ -26,20 +25,28 @@ addition to 2D paths for extrusion it is also possible to read design parameters from DXF files. Besides DXF files OpenSCAD can read and create 3D models in the STL and OFF file formats. +# Documentation -PREREQUISITES -============= +Have a look at the OpenSCAD Homepage (http://openscad.org/) for documentation. + +## Building OpenSCAD + +To build OpenSCAD from source, follow the instructions for the platform applicable to you below. + +### Prerequisites 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.. +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. * [Qt4 (4.4 - 4.7)](http://www.qt.nokia.com/) * [CGAL (3.6 - 3.9)](http://www.cgal.org/) -* [GMP (5.0.x)](http://www.gmplib.org/) -* [MPFR (3.x)](http://www.mpfr.org/) -* [boost (1.35 - 1.47)](http://www.boost.org/) -* [cmake (2.6 - 2.8, required by CGAL and the test framework)](http://www.cmake.org/) + * [GMP (5.0.x)](http://www.gmplib.org/) + * [cmake (2.6 - 2.8, required by CGAL and the test framework)](http://www.cmake.org/) + * [MPFR (3.x)](http://www.mpfr.org/) + * [boost (1.35 - 1.47)](http://www.boost.org/) * [OpenCSG (1.3.2)](http://www.opencsg.org/) * [GLEW (1.6 ->)](http://glew.sourceforge.net/) * [Eigen2 (2.0.13->)](http://eigen.tuxfamily.org/) @@ -47,15 +54,35 @@ development. Other versions may or may not work as well.. * [Bison (2.4)](http://www.gnu.org/software/bison/) * [Flex (2.5.35)](http://flex.sourceforge.net/) +### Building for MacOSX + +First, make sure that you have XCode installed to get GCC. Then after you've cloned this git repository, run the script that sets up the environment variables. + + source setenv_maju.sh + +Then run the script to compile all the prerequisite libraries above: + + ./scripts/macosx-build-dependencies.sh + +We currently don't use [port](http://mxcl.github.com/homebrew/) or [brew](http://mxcl.github.com/homebrew/) to install the prerequisite libraries because CGAL doesn't exist on brew and opencsg doesn't exist on ports. And more importantly, there are some patches to GMP in the compilation process. + +After that, follow the Compilation instructions below. + +### Building for Ubuntu + +If you have done this and want to contribute, fork the repo and contribute docs on how to build for windows! + +### Building for Windows + +If you have done this and want to contribute, fork the repo and contribute docs on how to build for windows! + +### Compilation + First, run 'qmake' from Qt4 to generate a Makefile. On some systems you need to run 'qmake4', 'qmake-qt4' or something alike to run the qt4 version of the tool. Then run make. Finally you might run 'make install' as root or simply copy the 'openscad' binary (OpenSCAD.app on Mac OS X) to the bin directory of your choice. - -DOCUMENTATION -============= - -Have a look at the OpenSCAD Homepage (http://openscad.org/) for documentation. +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). -- cgit v0.10.1 From 2429d9d45acdddf963812121875c882a68b18ed8 Mon Sep 17 00:00:00 2001 From: Wil Chung Date: Mon, 7 May 2012 16:29:06 -0700 Subject: added a getting started section to the README diff --git a/README.md b/README.md index 7cb5e34..fe6fb50 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ - # What is OpenSCAD? OpenSCAD is a software for creating solid 3D CAD objects. It is free software @@ -25,6 +24,32 @@ addition to 2D paths for extrusion it is also possible to read design parameters from DXF files. Besides DXF files OpenSCAD can read and create 3D models in the STL and OFF file formats. +# Getting started + +You can download the latest binaries of OpenSCAD at . Install binaries as you would any other software. + +When you open OpenSCAD, you'll see three frames within the window. The left frame is where you'll write code to model 3D objects. The right frame is where you'll see the 3D rendering of your model. + +Let's make a tree! Type the following code into the left frame: + + cylinder(h = 30, r = 8); + +Then render the 3D model by hitting F5. Now you can see a cylinder for the trunk in our tree. Now let's add the bushy/leafy part of the tree represented by a sphere. To do so, we will union a cylinder and a sphere. + + union() { + cylinder(h = 30, r = 8); + sphere(20); + } + +But, it's not quite right! The bushy/leafy are around the base of the tree. We need to move the sphere up the z-axis. + + union() { + cylinder(h = 30, r = 8); + translate([0, 0, 40]) sphere(20); + } + +And that's it! You made your first 3D model! There are other primitive shapes that you can combine with other set operations (union, intersection, difference) and transformations (rotate, scale, translate) to make complex models! Check out all the other language features in the [OpenSCAD Manual](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual). + # Documentation Have a look at the OpenSCAD Homepage (http://openscad.org/) for documentation. -- cgit v0.10.1 From a78cee15b20ca158d18229d53dfb8792d1b357e1 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Mon, 7 May 2012 21:21:01 -0400 Subject: Minor typos + line breaks diff --git a/README.md b/README.md index fe6fb50..13fba4d 100644 --- a/README.md +++ b/README.md @@ -26,29 +26,42 @@ STL and OFF file formats. # Getting started -You can download the latest binaries of OpenSCAD at . Install binaries as you would any other software. +You can download the latest binaries of OpenSCAD at +. Install binaries as you would any other +software. -When you open OpenSCAD, you'll see three frames within the window. The left frame is where you'll write code to model 3D objects. The right frame is where you'll see the 3D rendering of your model. +When you open OpenSCAD, you'll see three frames within the window. The +left frame is where you'll write code to model 3D objects. The right +frame is where you'll see the 3D rendering of your model. Let's make a tree! Type the following code into the left frame: cylinder(h = 30, r = 8); -Then render the 3D model by hitting F5. Now you can see a cylinder for the trunk in our tree. Now let's add the bushy/leafy part of the tree represented by a sphere. To do so, we will union a cylinder and a sphere. +Then render the 3D model by hitting F5. Now you can see a cylinder for +the trunk in our tree. Now let's add the bushy/leafy part of the tree +represented by a sphere. To do so, we will union a cylinder and a +sphere. union() { cylinder(h = 30, r = 8); sphere(20); } -But, it's not quite right! The bushy/leafy are around the base of the tree. We need to move the sphere up the z-axis. +But, it's not quite right! The bushy/leafy are around the base of the +tree. We need to move the sphere up the z-axis. union() { cylinder(h = 30, r = 8); translate([0, 0, 40]) sphere(20); } -And that's it! You made your first 3D model! There are other primitive shapes that you can combine with other set operations (union, intersection, difference) and transformations (rotate, scale, translate) to make complex models! Check out all the other language features in the [OpenSCAD Manual](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual). +And that's it! You made your first 3D model! There are other primitive +shapes that you can combine with other set operations (union, +intersection, difference) and transformations (rotate, scale, +translate) to make complex models! Check out all the other language +features in the [OpenSCAD +Manual](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual). # Documentation @@ -56,7 +69,8 @@ Have a look at the OpenSCAD Homepage (http://openscad.org/) for documentation. ## Building OpenSCAD -To build OpenSCAD from source, follow the instructions for the platform applicable to you below. +To build OpenSCAD from source, follow the instructions for the +platform applicable to you below. ### Prerequisites @@ -64,7 +78,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 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. * [Qt4 (4.4 - 4.7)](http://www.qt.nokia.com/) * [CGAL (3.6 - 3.9)](http://www.cgal.org/) @@ -79,27 +96,35 @@ If you're using Ubuntu, you can install these libraries from aptitude. If you're * [Bison (2.4)](http://www.gnu.org/software/bison/) * [Flex (2.5.35)](http://flex.sourceforge.net/) -### Building for MacOSX +### Building for Mac OS X -First, make sure that you have XCode installed to get GCC. Then after you've cloned this git repository, run the script that sets up the environment variables. +First, make sure that you have XCode installed to get GCC. Then after +you've cloned this git repository, run the script that sets up the +environment variables. - source setenv_maju.sh + source setenv_mjau.sh Then run the script to compile all the prerequisite libraries above: ./scripts/macosx-build-dependencies.sh -We currently don't use [port](http://mxcl.github.com/homebrew/) or [brew](http://mxcl.github.com/homebrew/) to install the prerequisite libraries because CGAL doesn't exist on brew and opencsg doesn't exist on ports. And more importantly, there are some patches to GMP in the compilation process. +We currently don't use [MacPorts](http://www.macports.org) or +[brew](http://mxcl.github.com/homebrew/) to install the prerequisite +libraries because CGAL doesn't exist on brew and opencsg doesn't exist +on ports. And more importantly, there are some patches to GMP in the +compilation process. After that, follow the Compilation instructions below. ### Building for Ubuntu -If you have done this and want to contribute, fork the repo and contribute docs on how to build for windows! +If you have done this and want to contribute, fork the repo and +contribute docs on how to build for windows! ### Building for Windows -If you have done this and want to contribute, fork the repo and contribute docs on how to build for windows! +If you have done this and want to contribute, fork the repo and +contribute docs on how to build for windows! ### Compilation @@ -109,5 +134,6 @@ run 'qmake4', 'qmake-qt4' or something alike to run the qt4 version of the tool. Then run make. Finally you might run 'make install' as root or simply copy the 'openscad' binary (OpenSCAD.app on Mac OS X) to the bin directory of your choice. -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). +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). -- cgit v0.10.1 From a1ff48eef91a6fec285b54595a1abc45215781cd Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 3 Apr 2012 01:37:28 +0200 Subject: Fixes to make CGAL-4.0 link correctly on Mac diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh index 1ce3103..48f907e 100755 --- a/scripts/macosx-build-dependencies.sh +++ b/scripts/macosx-build-dependencies.sh @@ -65,13 +65,19 @@ build_gmp() mkdir -p lib if $OPTION_32BIT; then lipo -create i386/lib/libgmp.dylib x86_64/lib/libgmp.dylib -output lib/libgmp.dylib + lipo -create i386/lib/libgmpxx.dylib x86_64/lib/libgmpxx.dylib -output lib/libgmpxx.dylib else cp x86_64/lib/libgmp.dylib lib/libgmp.dylib + cp x86_64/lib/libgmpxx.dylib lib/libgmpxx.dylib fi install_name_tool -id $DEPLOYDIR/lib/libgmp.dylib lib/libgmp.dylib + install_name_tool -id $DEPLOYDIR/lib/libgmpxx.dylib lib/libgmpxx.dylib + install_name_tool -change $DEPLOYDIR/x86_64/lib/libgmp.10.dylib $DEPLOYDIR/lib/libgmp.dylib lib/libgmpxx.dylib if $OPTION_32BIT; then cp lib/libgmp.dylib i386/lib/ cp lib/libgmp.dylib x86_64/lib/ + cp lib/libgmpxx.dylib i386/lib/ + cp lib/libgmpxx.dylib x86_64/lib/ fi mkdir -p include cp x86_64/include/gmp.h include/ @@ -204,9 +210,12 @@ build_cgal() 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="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="x86_64$CGAL_EXTRA_FLAGS" -DBOOST_ROOT=$DEPLOYDIR + cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.dylib -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.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=TRUE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="x86_64$CGAL_EXTRA_FLAGS" -DBOOST_ROOT=$DEPLOYDIR -DCMAKE_BUILD_TYPE=Debug make -j4 make install + install_name_tool -id $DEPLOYDIR/lib/libCGAL.dylib $DEPLOYDIR/lib/libCGAL.dylib + install_name_tool -id $DEPLOYDIR/lib/libCGAL_Core.dylib $DEPLOYDIR/lib/libCGAL_Core.dylib + install_name_tool -change $PWD/lib/libCGAL.9.dylib $DEPLOYDIR/lib/libCGAL.dylib $DEPLOYDIR/lib/libCGAL_Core.dylib } build_glew() -- cgit v0.10.1 From db2d5b3177c79a082722c488576ddc3812524c4d Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 9 May 2012 11:12:24 -0400 Subject: Bumped gmp to 5.0.5 diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh index 48f907e..1436ac2 100755 --- a/scripts/macosx-build-dependencies.sh +++ b/scripts/macosx-build-dependencies.sh @@ -296,7 +296,7 @@ done echo "Using basedir:" $BASEDIR mkdir -p $SRCDIR $DEPLOYDIR build_eigen 2.0.17 -build_gmp 5.0.4 +build_gmp 5.0.5 build_mpfr 3.1.0 build_boost 1.47.0 # NB! For CGAL, also update the actual download URL in the function -- cgit v0.10.1 From 18529d2f78873972917741aeb8d3c981665d213e Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 9 May 2012 13:21:47 -0400 Subject: Build mpfr with the latest official patches diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh index 1436ac2..405f7aa 100755 --- a/scripts/macosx-build-dependencies.sh +++ b/scripts/macosx-build-dependencies.sh @@ -133,7 +133,8 @@ build_mpfr() fi tar xjf mpfr-$version.tar.bz2 cd mpfr-$version - + curl -O http://www.mpfr.org/mpfr-current/allpatches + patch -N -Z -p1 < allpatches if $OPTION_32BIT; then mkdir build-i386 cd build-i386 -- cgit v0.10.1 From 67eb2ebe90447e966dc1e08b91c43d937c521583 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 9 May 2012 13:25:28 -0400 Subject: sync diff --git a/doc/TODO.txt b/doc/TODO.txt index 8fc9be8..7f8378d 100644 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -73,6 +73,7 @@ o 3D View - 2D objects are rendered at z = -0.1 - why? - Rewrite to use VBOs or smth. - avoid inline calculations - Rewrite to a higher-level library (e.g. OSG)? + - Make navigation (e.g. zoom) available through menu entries (requested by disabled user) o Editor wishlist - More infrastructure for external editor (allow communication from the outside) - Preferences GUI for the features below @@ -93,12 +94,14 @@ o Editor wishlist - Auto-indent on enter and on tab o Error reporting/debugging - Provide better error messages when polygon ordering causes CGAL errors: + o Detect common error: self-intersecting polyhedron() o Supply syntax highlighting of the exact polygon indices which are reported to be wrong o Provide some interaction for debug walk-through? - Provide visual highlighting of geometry corresponding to code -> could aid debugging a lot - Optionally output console log to a file + - Common error: detect and report (and ignore?) duplicate line segments in DXF o Computation - Multi-threaded computation (mostly important for CGAL) - Progress: Call progresswidget more often to improve feedback -- cgit v0.10.1