Merge branch 'master' of github.com:openscad/openscad

felipesanches-svg
Marius Kintel 2013-01-17 09:58:54 -05:00
commit 0b1029ff4d
53 changed files with 1911 additions and 786 deletions

View File

@ -80,7 +80,7 @@ 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 a newer version of Ubuntu, you can install these
libraries from aptitude. If you're using Mac, or an older Linux, there
libraries from aptitude. If you're using Mac, or an older Linux/BSD, there
are build scripts that download and compile the libraries from source.
Follow the instructions for the platform you're compiling on below.
@ -91,7 +91,7 @@ Follow the instructions for the platform you're compiling on below.
* [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/)
* [GLEW (1.5.4 ->)](http://glew.sourceforge.net/)
* [Eigen (2.0.13->3.1.1)](http://eigen.tuxfamily.org/)
* [GCC C++ Compiler (4.2 ->)](http://gcc.gnu.org/)
* [Bison (2.4)](http://www.gnu.org/software/bison/)
@ -131,34 +131,52 @@ compilation process.
After that, follow the Compilation instructions below.
### Building for newer Linux distributions
### Building for Linux/BSD
First, make sure that you have development tools installed to get GCC.
Then after you've cloned this git repository, use a package manager to
download packages for the dependency libraries listed above. Convenience
scripts are provided for some popular systems:
First, make sure that you have git installed (often packaged as 'git-core'
or 'scmgit'). Once you've cloned this git repository, download and install
the dependency packages listed above using your system's package
manager. A convenience script is provided that can help with this
process on some systems:
Ubuntu, Debian: ./scripts/ubuntu-build-dependencies.sh
OpenSUSE: ./scripts/opensuse-build-dependencies.sh
Fedora: ./scripts/fedora-build-dependencies.sh
./scripts/uni-get-dependencies.sh
Check your library versions to make sure they meet the minimum
requirements listed above. After that follow the Compilation
instructions below.
After installing dependencies, check their versions. You can run this
script to help you:
### Building for older Linux or building without root access
./scripts/check-dependencies.sh
First, make sure that you have development tools installed to get GCC.
Then after you've cloned this git repository, run the script that sets
up the environment variables.
Take care that you don't have old local copies anywhere (/usr/local/).
If all dependencies are present and of a high enough version, skip ahead
to the Compilation instructions.
source ./scripts/setenv-linbuild.sh
### Building for Linux/BSD on systems with older or missing dependencies
Then run the script to download & compile all the prerequisite libraries above:
If some of your system dependency libraries are missing or old, then you
can download and build newer versions into $HOME/openscad_deps by
following this process. First, run the script that sets up the
environment variables.
./scripts/linux-build-dependencies.sh
source ./scripts/setenv-unibuild.sh
Then run the script to compile all the prerequisite libraries above:
./scripts/uni-build-dependencies.sh
This may take an hour or more, depending on your network and system. It
is recommended to have at least 1 gigabyte of free disk space. As a
special timesaver if you are only missing CGAL and OpenCSG, you can do
this instead:
./scripts/uni-build-dependencies.sh opencsg
./scripts/uni-build-dependencies.sh cgal
Note that huge dependencies like gcc or qt are not included here, only
the smaller ones (boost, CGAL, opencsg, etc). After the build, again
check dependencies.
./scripts/check-dependencies.sh
Then add LD_LIBRARY_PATH=$HOME/openscad_deps to your ~/.bashrc
After that, follow the Compilation instructions below.
### Building for Windows
@ -177,9 +195,9 @@ Then run the script to download & compile all the prerequisite libraries above:
./scripts/mingw-x-build-dependencies.sh
Then skip the compilation instructions below. Instead, build an installer:
Then, build OpenSCAD and package it to an installer:
OSTYPE=mingw-cross-env ./scripts/release-common.sh
./scripts/release-common.sh mingw32
### Compilation

View File

@ -1,4 +1,4 @@
OpenSCAD 2012.11
OpenSCAD 2013.01
================
Features:
@ -26,6 +26,8 @@ o cmd-line overrides using -D now also work for USEd modules
o Modifier characters can now be used in front of if statements
o rotate() with a vector argument with less that 3 elements used uninitialized variables, ending up being non-deterministic.
o .csg files will now have relative filenames whenever possible
o Don't just ignore geometric nodes having zero volume/area - when doing difference/intersection, they tend to turn negative objects into positive ones.
o Always use utf-8 file encoding, also under Windows
o A lot of build script fixes
o Some other crash bugs fixes

View File

@ -17,17 +17,26 @@ win32 {
QMAKE_EXTRA_COMPILERS += bison_header
}
unix:freebsd-g++ {
# on bsd /usr/bin/bison is outdated, dont use it
QMAKE_YACC = /usr/local/bin/bison
}
unix:netbsd* {
QMAKE_YACC = /usr/pkg/bin/bison
}
unix:linux* {
exists(/usr/bin/bison) {
QMAKE_YACC = /usr/bin/bison
}
}
freebsd* {
# on some BSD, /usr/local/bin/bison is newer than
# /usr/bin/bison, so try to prefer it.
exists(/usr/local/bin/bison) {
QMAKE_YACC = /usr/local/bin/bison
} else { # look in $PATH
QMAKE_YACC = bison
}
}
netbsd* {
exists(/usr/pkg/bin/bison) {
QMAKE_YACC = /usr/pkg/bin/bison
} else { # look in $PATH
QMAKE_YACC = bison
}
}

View File

@ -113,6 +113,7 @@ o Misc
for confirmation.
- Go through keyboard shortcuts and make them more conformant to platform standards
- Show design info/stats (sizes, caches etc.)
- Support Voice Over and related technologies for vision-impaired users
o Cmd-line
- Add verbose option (PRINT command from mainwin.cc and progress output)
@ -135,6 +136,7 @@ o Hollow donut problem
rendering keeps the hole, but renders slightly incorrect.
o CGAL issues
- CGAL doesn't handle almost planar polygons. Consider splitting into triangles ourselves. See WillamAdams/dodec.scad
o Look at the EPEC kernel for improved performance (suggested by Giles)
LANGUAGE && BUILTINS
--------------------

View File

@ -1,6 +1,8 @@
OpenSCAD Release Checklist
--------------------------
(See bottom of this file for how to build release binaries)
o Update VERSION environment variable
export VERSION=2012.08
@ -19,22 +21,7 @@ o Tag release
o build source package
scripts/git-archive-all.py --prefix=openscad-$VERSION/ openscad-$VERSION.src.tar.gz
o build binaries
tar xzf openscad-$VERSION.src.tar.gz
cd openscad-$VERSION
Mac OS X
(For Qt-4.7.3: Remove /Developers/Applications/Qt/plugins/qmltooling)
./scripts/publish-macosx.sh -> OpenSCAD-$VERSION.dmg
Linux:
32-bit: run on a 32-bit machine or VM
64-bit: run on a 64-bit machine or VM
./scripts/release-common.sh -> openscad-$VERSION.x86-ARCH.tar.gz
(where ARCH will be detected and set to 32 or 64)
Windows mingw cross-build: FIXME 32 vs. 64 bit
./scripts/publish-mingw-x.sh -> mingw32/Openscad-$VERSION.zip
-> mingw32/Openscad-$VERSION-Installer.exe
o FIXME: Run some tests
o Sanity check; build a binary or two and manually run some tests
o Remove VERSION environment variable
@ -42,10 +29,8 @@ o Remove VERSION environment variable
o git push --tags
o Upload
- Github
Upload manually here: https://github.com/openscad/openscad/downloads
FIXME: Write a script
o Upload Source package
$ ./scripts/googlecode_upload.py -s 'Source Code' -p openscad openscad-$VERSION.src.tar.gz -l Featured,Type-Source openscad-$VERSION.src.tar.gz
o Update web page
o Write email to mailing list
@ -53,3 +38,33 @@ o Update external resources:
- http://en.wikipedia.org/wiki/OpenSCAD
o Notify package managers
- Ubuntu: https://launchpad.net/~chrysn
- MacPorts:
Build and Upload Release Binaries
---------------------------------
$ export VERSION=<openscad version, e.g. 2013.01>
$ tar xzf openscad-$VERSION.src.tar.gz
$ cd openscad-$VERSION
Mac OS X:
$ ./scripts/publish-macosx.sh -> OpenSCAD-$VERSION.dmg
Linux:
32-bit: run on a 32-bit machine or VM
64-bit: run on a 64-bit machine or VM
$ ./scripts/release-common.sh -> openscad-$VERSION.x86-ARCH.tar.gz
(where ARCH will be detected and set to 32 or 64)
$ ./scripts/googlecode_upload.py -s 'Linux Binaries' -p openscad openscad-$VERSION.x86-ARCH.tar.gz -l Featured,OpSys-Linux,Type-Archive openscad-$VERSION.x86-ARCH.tar.gz
o Update web page with download links
Windows mingw cross-build: FIXME 32 vs. 64 bit
$ ./scripts/publish-mingw-x.sh -> mingw32/Openscad-$VERSION.zip
-> mingw32/Openscad-$VERSION-Installer.exe
$ ./scripts/googlecode_upload.py -s 'Windows Binaries' -p openscad OpenSCAD-$VERSION.zip -l Featured,OpSys-Windows,Type-Archive OpenSCAD-$VERSION.zip
$ ./scripts/googlecode_upload.py -s 'Windows Installer' -p openscad OpenSCAD-$VERSION-Installer.exe -l Featured,OpSys-Windows,Type-Installer OpenSCAD-$VERSION-Installer.exe
o Update web page with download links

View File

@ -48,14 +48,14 @@ CONFIG(mingw-cross-env) {
isEmpty(EIGEN_INCLUDEPATH) {
freebsd-g++: EIGEN_INCLUDEPATH = /usr/local/include/eigen3
macx: EIGEN_INCLUDEPATH = /opt/local/include/eigen3
linux*|hurd*: EIGEN_INCLUDEPATH = /usr/include/eigen3
netbsd*: EIGEN_INCLUDEPATH = /usr/pkg/include/eigen3
linux*|hurd*|unix: EIGEN_INCLUDEPATH = /usr/include/eigen3
macx: EIGEN_INCLUDEPATH = /opt/local/include/eigen3
!exists($$EIGEN_INCLUDEPATH) {
freebsd-g++: EIGEN_INCLUDEPATH = /usr/local/include/eigen2
macx: EIGEN_INCLUDEPATH = /opt/local/include/eigen2
linux*|hurd*: EIGEN_INCLUDEPATH = /usr/include/eigen2
netbsd*: EIGEN_INCLUDEPATH = /usr/pkg/include/eigen2
linux*|hurd*|unix*: EIGEN_INCLUDEPATH = /usr/include/eigen2
macx: EIGEN_INCLUDEPATH = /opt/local/include/eigen2
}
}
@ -69,4 +69,9 @@ isEmpty(EIGEN_INCLUDEPATH) {
# EIGEN being under 'include/eigen[2-3]' needs special prepending
QMAKE_INCDIR_QT = $$EIGEN_INCLUDEPATH $$QMAKE_INCDIR_QT
# qmakespecs on netbsd prepend system includes, we need eigen first.
netbsd* {
QMAKE_CXXFLAGS = -I$$EIGEN_INCLUDEPATH $$QMAKE_CXXFLAGS
}
} # eigen

View File

@ -9,16 +9,17 @@ win32 {
QMAKE_EXTRA_COMPILERS += flex
}
unix:freebsd-g++ {
QMAKE_LEX = /usr/local/bin/flex
}
unix:netbsd* {
QMAKE_LEX = /usr/pkg/bin/flex
}
unix:linux* {
exists(/usr/bin/flex) {
QMAKE_LEX = /usr/bin/flex
}
}
freebsd* {
QMAKE_LEX = /usr/local/bin/flex
}
netbsd* {
QMAKE_LEX = /usr/pkg/bin/flex
}

View File

@ -6,7 +6,6 @@ glew {
QMAKE_INCDIR += $$GLEW_DIR/include
QMAKE_LIBDIR += $$GLEW_DIR/lib
QMAKE_LIBDIR += $$GLEW_DIR/lib64
message("GLEW location: $$GLEW_DIR")
}
unix:LIBS += -lGLEW

View File

@ -90,14 +90,28 @@ unix:!macx {
}
netbsd* {
LIBS += -L/usr/X11R7/lib
QMAKE_LFLAGS += -L/usr/X11R7/lib
QMAKE_LFLAGS += -Wl,-R/usr/X11R7/lib
QMAKE_LFLAGS += -Wl,-R/usr/pkg/lib
!isEmpty(OPENSCAD_LIBDIR) {
QMAKE_LFLAGS += -Wl,-R$$OPENSCAD_LIBDIR/lib
QMAKE_CFLAGS = -I$$OPENSCAD_LIBDIR/include $$QMAKE_CFLAGS
QMAKE_CXXFLAGS = -I$$OPENSCAD_LIBDIR/include $$QMAKE_CXXFLAGS
QMAKE_LFLAGS = -L$$OPENSCAD_LIBDIR/lib $$QMAKE_LFLAGS
QMAKE_LFLAGS = -Wl,-R$$OPENSCAD_LIBDIR/lib $$QMAKE_LFLAGS
}
}
# Prevent LD_LIBRARY_PATH problems when running the openscad binary
# on systems where uni-build-dependencies.sh was used.
# Will not affect 'normal' builds.
!isEmpty(OPENSCAD_LIBDIR) {
unix:!macx {
QMAKE_LFLAGS = -Wl,-R$$OPENSCAD_LIBDIR/lib $$QMAKE_LFLAGS
# need /lib64 beause GLEW installs itself there on 64 bit machines
QMAKE_LFLAGS = -Wl,-R$$OPENSCAD_LIBDIR/lib64 $$QMAKE_LFLAGS
}
}
# See Dec 2011 OpenSCAD mailing list, re: CGAL/GCC bugs.
*g++* {
QMAKE_CXXFLAGS *= -fno-strict-aliasing

506
scripts/check-dependencies.sh Executable file
View File

@ -0,0 +1,506 @@
# Parse the minimum versions of dependencies from README.md, and compare
# with what is found on the system. Print results.
#
# usage
# check-dependencies.sh # check version of all dependencies
# check-dependencies.sh debug # debug this script
#
# output
# a table displaying the minimum version from README, the found version,
# and whether it is OK or not.
#
# design
# stage 1. search by parsing header files and/or binary output (_sysver)
# stage 2. search with pkg-config
#
# Code style is portability and simplicity. Plain sed, awk, grep, sh.
# Functions return strings under $function_name_result variable.
# tmp variables are named funcname_abbreviated_tmp.
# Local vars are not used.
#
# todo
# testing of non-bash shells
# if /usr/ and /usr/local/ on linux both hit, throw a warning
# print location found, how found???
# look at pkgconfig --exists & --modversion
# deal with deps like GLEW that don't have proper version strings?
#
DEBUG=
debug()
{
if [ $DEBUG ]; then echo check-dependencies.sh: $* ; fi
}
eigen_sysver()
{
debug eigen
eigpath=
eig3path=$1/include/eigen3/Eigen/src/Core/util/Macros.h
eig2path=$1/include/eigen2/Eigen/src/Core/util/Macros.h
if [ -e $eig3path ]; then eigpath=$eig3path; fi
if [ -e $eig2path ]; then eigpath=$eig2path; fi
debug $eig2path
if [ ! $eigpath ]; then return; fi
eswrld=`grep "define *EIGEN_WORLD_VERSION *[0-9]*" $eigpath | awk '{print $3}'`
esmaj=`grep "define *EIGEN_MAJOR_VERSION *[0-9]*" $eigpath | awk '{print $3}'`
esmin=`grep "define *EIGEN_MINOR_VERSION *[0-9]*" $eigpath | awk '{print $3}'`
eigen_sysver_result="$eswrld.$esmaj.$esmin"
}
opencsg_sysver()
{
debug opencsg_sysver
if [ ! -e $1/include/opencsg.h ]; then return; fi
ocsgver=`grep "define *OPENCSG_VERSION_STRING *[0-9x]*" $1/include/opencsg.h`
ocsgver=`echo $ocsgver | awk '{print $4}' | sed s/'"'//g | sed s/[^1-9.]//g`
opencsg_sysver_result=$ocsgver
}
cgal_sysver()
{
cgalpath=$1/include/CGAL/version.h
if [ ! -e $cgalpath ]; then return; fi
cgal_sysver_result=`grep "define *CGAL_VERSION *[0-9.]*" $cgalpath | awk '{print $3}'`
}
boost_sysver()
{
boostpath=$1/include/boost/version.hpp
if [ ! -e $boostpath ]; then return; fi
bsver=`grep 'define *BOOST_LIB_VERSION *[0-9_"]*' $boostpath | awk '{print $3}'`
bsver=`echo $bsver | sed s/'"'//g | sed s/'_'/'.'/g`
boost_sysver_result=$bsver
}
mpfr_sysver()
{
mpfrpath=$1/include/mpfr.h
if [ ! -e $mpfrpath ]; then return; fi
mpfrsver=`grep 'define *MPFR_VERSION_STRING *' $mpfrpath | awk '{print $3}'`
mpfrsver=`echo $mpfrsver | sed s/"-.*"// | sed s/'"'//g`
mpfr_sysver_result=$mpfrsver
}
gmp_sysver()
{
# on some systems you have VERSION in gmp-$arch.h not gmp.h. use gmp*.h
if [ ! -e $1/include ]; then return; fi
gmppaths=`ls $1/include | grep ^gmp`
if [ ! "$gmppaths" ]; then return; fi
for gmpfile in $gmppaths; do
gmppath=$1/include/$gmpfile
if [ "`grep __GNU_MP_VERSION $gmppath`" ]; then
gmpmaj=`grep "define *__GNU_MP_VERSION *[0-9]*" $gmppath | awk '{print $3}'`
gmpmin=`grep "define *__GNU_MP_VERSION_MINOR *[0-9]*" $gmppath | awk '{print $3}'`
gmppat=`grep "define *__GNU_MP_VERSION_PATCHLEVEL *[0-9]*" $gmppath | awk '{print $3}'`
fi
done
gmp_sysver_result="$gmpmaj.$gmpmin.$gmppat"
}
qt4_sysver()
{
qt4path=$1/include/qt4/QtCore/qglobal.h
if [ ! -e $qt4path ]; then
qt4path=$1/include/QtCore/qglobal.h
fi
if [ ! -e $qt4path ]; then
# netbsd
qt4path=$1/qt4/include/QtCore/qglobal.h
fi
if [ ! -e $qt4path ]; then return; fi
qt4ver=`grep 'define *QT_VERSION_STR *' $qt4path | awk '{print $3}'`
qt4ver=`echo $qt4ver | sed s/'"'//g`
qt4_sysver_result=$qt4ver
}
glew_sysver()
{
glewh=$1/include/GL/glew.h
if [ -e $glewh ]; then
# glew has no traditional version number in it's headers
# so we either test for what we need and 'guess', or assign it to 0.0
# the resulting number is a 'lower bound', not exactly what is installed
if [ "`grep __GLEW_VERSION_4_2 $glewh`" ]; then
glew_sysver_result=1.7.0
fi
if [ ! $glew_sysver_result ]; then
if [ "`grep __GLEW_ARB_occlusion_query2 $glewh`" ]; then
glew_sysver_result=1.5.4
fi
fi
if [ ! $glew_sysver_result ]; then
glew_sysver_result=0.0
fi
fi
}
imagemagick_sysver()
{
if [ ! -x $1/bin/convert ]; then return; fi
imver=`$1/bin/convert --version | grep -i version`
imagemagick_sysver_result=`echo $imver | sed s/"[^0-9. ]"/" "/g | awk '{print $1}'`
}
flex_sysver()
{
flexbin=$1/bin/flex
if [ -x $1/bin/gflex ]; then flexbin=$1/bin/gflex; fi # openbsd
if [ ! -x $flexbin ]; then return ; fi
flex_sysver_result=`$flexbin --version | sed s/"[^0-9.]"/" "/g`
}
bison_sysver()
{
if [ ! -x $1/bin/bison ]; then return ; fi
bison_sysver_result=`$1/bin/bison --version | grep bison | sed s/"[^0-9.]"/" "/g`
}
gcc_sysver()
{
bingcc=$1/bin/g++
if [ ! -x $1/bin/g++ ]; then
if [ "`command -v g++`" ]; then # fallback to $PATH
bingcc=g++;
fi
fi
debug using bingcc: $bingcc
if [ ! -x $bingcc ]; then return; fi
if [ ! "`$bingcc --version`" ]; then return; fi
gccver=`$bingcc --version| grep -i g++ | awk -F "(" ' { print $2 } '`
debug g++ output1: $gccver
gccver=`echo $gccver | awk -F ")" ' { print $2 } '`
debug g++ output2: $gccver
gccver=`echo $gccver | awk ' { print $1 } '`
debug g++ output3: $gccver
gcc_sysver_result=$gccver
}
git_sysver()
{
if [ ! -x $1/bin/git ]; then return ; fi
git_sysver_result=`$1/bin/git --version | grep git | sed s/"[^0-9.]"/" "/g`
}
curl_sysver()
{
if [ ! -x $1/bin/curl ]; then return; fi
curl_sysver_result=`$1/bin/curl --version | grep curl | sed s/"[^0-9. ]"/" "/g | awk '{print $1}'`
}
cmake_sysver()
{
if [ ! -x $1/bin/cmake ]; then return ; fi
cmake_sysver_result=`$1/bin/cmake --version | grep cmake | sed s/"[^0-9.]"/" "/g | awk '{ print $1 }'`
}
make_sysver()
{
make_sysver_tmp=
binmake=$1/bin/make
if [ -x $1/bin/gmake ]; then binmake=$1/bin/gmake ;fi
if [ ! -x $binmake ]; then return ;fi
make_sysver_tmp=`$binmake --version 2>&1`
debug finding gnu make: raw make response: $make_sysver_tmp
if [ ! "`echo $make_sysver_tmp | grep -i gnu`" ]; then
return;
fi
make_sysver_tmp=`$binmake --version 2>&1 | grep -i 'gnu make' | sed s/"[^0-9.]"/" "/g`
if [ "`echo $make_sysver_tmp | grep [0-9]`" ]; then
make_sysver_result=$make_sysver_tmp
fi
}
bash_sysver()
{
if [ -x /bin/bash ]; then binbash=/bin/bash ;fi
if [ -x /usr/bin/bash ]; then binbash=/usr/bin/bash ;fi
if [ -x $1/bin/bash ]; then binbash=$1/bin/bash ;fi
if [ ! -x $binbash ]; then return; fi
bash_sysver_result=`$binbash --version | grep bash | sed s/"[^0-9. ]"/" "/g|awk '{print $1}'`
}
python_sysver()
{
if [ ! -x $1/bin/python ]; then return; fi
python_sysver_result=`$1/bin/python --version 2>&1 | awk '{print $2}'`
}
pkg_config_search()
{
debug pkg_config_search $*
pkg_config_search_result=
pcstmp=
if [ ! $1 ]; then return; fi
pkgname=$1
pkg-config --exists $pkgname 2>&1
if [ $? = 0 ]; then
pkg_config_search_result=`pkg-config --modversion $pkgname`
else
debug pkg_config_search failed on $*, result of run was: $pcstmp
fi
}
get_minversion_from_readme()
{
if [ -e README.md ]; then READFILE=README.md; fi
if [ -e ../README.md ]; then READFILE=../README.md; fi
if [ ! $READFILE ]; then
if [ "`command -v dirname`" ]; then
READFILE=`dirname $0`/../README.md
fi
fi
if [ ! $READFILE ]; then echo "cannot find README.md"; exit 1; fi
debug get_minversion_from_readme $*
if [ ! $1 ]; then return; fi
depname=$1
local grv_tmp=
debug $depname
# example--> * [CGAL (3.6 - 3.9)] (www.cgal.org) becomes 3.6
# steps: eliminate *, find left (, find -, make 'x' into 0, delete junk
grv_tmp=`grep -i ".$depname.*([0-9]" $READFILE | sed s/"*"//`
debug $grv_tmp
grv_tmp=`echo $grv_tmp | awk -F"(" '{print $2}'`
debug $grv_tmp
grv_tmp=`echo $grv_tmp | awk -F"-" '{print $1}'`
debug $grv_tmp
grv_tmp=`echo $grv_tmp | sed s/"x"/"0"/g`
debug $grv_tmp
grv_tmp=`echo $grv_tmp | sed s/"[^0-9.]"//g`
debug $grv_tmp
get_minversion_from_readme_result=$grv_tmp
}
find_min_version()
{
find_min_version_result=
fmvtmp=
if [ ! $1 ] ; then return; fi
fmvdep=$1
get_minversion_from_readme $fmvdep
fmvtmp=$get_minversion_from_readme_result
# items not included in README.md
if [ $fmvdep = "git" ]; then fmvtmp=1.5 ; fi
if [ $fmvdep = "curl" ]; then fmvtmp=6 ; fi
if [ $fmvdep = "make" ]; then fmvtmp=3 ; fi
if [ $fmvdep = "python" ]; then fmvtmp=2 ; fi
find_min_version_result=$fmvtmp
}
vers_to_int()
{
# change x.y.z.p into an integer that can be compared using -lt or -gt
# 1.2.3.4 into 1020304
# 1.11.0.12 into 1110012
# 2011.2.3 into 20110020300
# it will work as long as the resulting int is less than 2.147 billion
# and y z and p are less than 99
vers_to_int_result=
if [ ! $1 ] ; then return ; fi
vtoi_ver=$1
vtoi_test=`echo $vtoi_ver | sed s/"[^0-9.]"//g`
debug vers_to_int $* :: vtoi_ver: $vtoi_ver vtoi_test: $vtoi_test
if [ ! "$vtoi_test" = "$vtoi_ver" ]; then
debug failure in version-to-integer conversion.
debug '"'$vtoi_ver'"' has letters, etc in it. setting to 0
vtoi_ver="0"
fi
vers_to_int_result=`echo $vtoi_ver | awk -F. '{print $1*1000000+$2*10000+$3*100+$4}'`
vtoi_ver=
vtoi_test=
}
version_less_than_or_equal()
{
if [ ! $1 ]; then return; fi
if [ ! $2 ]; then return; fi
v1=$1
v2=$2
vers_to_int $v1
v1int=$vers_to_int_result
vers_to_int $v2
v2int=$vers_to_int_result
debug "v1, v2, v1int, v2int" , $v1, $v2, $v1int, $v2int
if [ $v1int -le $v2int ]; then
debug "v1 <= v2"
return 0
else
debug "v1 > v2"
return 1
fi
v1=
v2=
v1int=
v2int=
}
compare_version()
{
debug compare_version $*
compare_version_result="NotOK"
if [ ! $1 ] ; then return; fi
if [ ! $2 ] ; then return; fi
cvminver=$1
cvinstver=$2
cvtmp=
version_less_than_or_equal $cvminver $cvinstver
if [ $? = 0 ]; then
cvtmp="OK"
else
cvtmp="NotOK"
fi
compare_version_result=$cvtmp
cvtmp=
}
pretty_print()
{
# there are four columns, passed as $1 $2 $3 and $4
# 1 = name of dependency
# 2 = version found in README
# 3 = version found on system
# 4 = whether it is OK or not
debug pretty_print $*
brightred="\033[40;31m"
red="\033[40;31m"
brown="\033[40;33m"
yellow="\033[40;33m"
white="\033[40;37m"
purple="\033[40;35m"
green="\033[40;32m"
cyan="\033[40;36m"
gray="\033[40;37m"
nocolor="\033[0m"
ppstr="%s%-12s"
pp_format='{printf("'$ppstr$ppstr$ppstr$ppstr$nocolor'\n",$1,$2,$3,$4,$5,$6,$7,$8)}'
pp_title="$gray depname $gray minimum $gray found $gray OKness"
if [ $1 ]; then pp_depname=$1; fi
if [ $pp_depname = "title" ]; then
echo -e $pp_title | awk $pp_format
return ;
fi
if [ $2 ]; then pp_minver=$2; else pp_minver="unknown"; fi
if [ $3 ]; then pp_foundver=$3; else pp_foundver="unknown"; fi
if [ $4 ]; then pp_okness=$4; else pp_okness="NotOK"; fi
if [ $pp_okness = "NotOK" ]; then
pp_foundcolor=$purple;
pp_cmpcolor=$purple;
else
pp_foundcolor=$gray;
pp_cmpcolor=$green;
fi
echo -e $cyan $pp_depname $gray $pp_minver $pp_foundcolor $pp_foundver $pp_cmpcolor $pp_okness | awk $pp_format
pp_depname=
pp_minver=
pp_foundver=
pp_okness=
}
find_installed_version()
{
debug find_installed_version $*
find_installed_version_result=unknown
fsv_tmp=
depname=$1
# try to find/parse headers and/or binary output
if [ ! $fsv_tmp ]; then
for syspath in "/opt" "/usr/pkg" "/usr" "/usr/local" $OPENSCAD_LIBRARIES; do
if [ -e $syspath ]; then
debug $depname"_sysver" $syspath
eval $depname"_sysver" $syspath
fsv_tmp=`eval echo "$"$depname"_sysver_result"`
fi
done
fi
# use pkg-config to search
if [ ! $fsv_tmp ]; then
if [ "`command -v pkg-config`" ]; then
debug plain search failed. trying pkg_config...
pkg_config_search $depname
fsv_tmp=$pkg_config_search_result
fi
fi
if [ $fsv_tmp ]; then
find_installed_version_result=$fsv_tmp
else
debug all searches failed. unknown version.
fi
}
check_old_local()
{
warnon=
if [ "`uname | grep -i linux`" ]; then
header_list="opencsg.h CGAL boost GL/glew.h gmp.h mpfr.h eigen2 eigen3"
liblist="libboost libopencsg libCGAL libglew"
for i in $header_list $liblist; do
if [ -e /usr/local/include/$i ]; then
echo "Warning: you have a copy of "$i" under /usr/local/include"
warnon=1
fi
if [ -e /usr/local/lib/$i.so ]; then
echo "Warning: you have a copy of "$i" under /usr/local/lib"
warnon=1
fi
done
fi
if [ $warnon ]; then
echo "Please verify these local copies don't conflict with the system"
fi
}
check_misc()
{
if [ "`uname -a|grep -i netbsd`" ]; then
echo "NetBSD: Please manually verify the X Sets have been installed"
fi
}
checkargs()
{
for i in $*; do
if [ $i = "debug" ]; then DEBUG=1 ; fi
done
}
main()
{
deps="qt4 cgal gmp mpfr boost opencsg glew eigen gcc bison flex make"
#deps="$deps curl git" # not technically necessary for build
#deps="$deps python cmake imagemagick" # only needed for tests
pretty_print title
for depname in $deps; do
debug "processing $dep"
find_installed_version $depname
dep_sysver=$find_installed_version_result
find_min_version $depname
dep_minver=$find_min_version_result
compare_version $dep_minver $dep_sysver
dep_compare=$compare_version_result
pretty_print $depname $dep_minver $dep_sysver $dep_compare
done
check_old_local
check_misc
}
checkargs $*
main
exit 0

View File

@ -1,29 +0,0 @@
echo "Tested on Fedora 17. If this fails try 'old linux' build (see README.md)"
sleep 2
# Fedora 17 has CGAL 4
#if [ "`yum list installed | grep -i cgal`" ]; then
# echo "Please make sure you have removed all cgal packages and retry"
# exit
#fi
if [ "`yum list installed | grep -i opencsg`" ]; then
echo "Please make sure you have removed all opencsg packages and retry"
exit
fi
sudo yum install qt-devel bison flex eigen2-devel \
boost-devel mpfr-devel gmp-devel glew-devel CGAL-devel gcc pkgconfig git
#echo "now copy/paste the following to install CGAL and OpenCSG from source:"
#echo "sudo BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh cgal-use-sys-libs"
echo
echo "Now copy/paste the following to install OpenCSG from source:"
echo
# https://bugzilla.redhat.com/show_bug.cgi?id=144967
echo "sudo echo /usr/local/lib | sudo tee -a /etc/ld.so.conf.d/local.conf"
echo "sudo ldconfig"
echo "sudo BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh opencsg"
echo

View File

@ -1,28 +0,0 @@
#!/usr/local/bin/bash -e
echo "Tested on FreeBSD 9. Please see README.md for info on older systems."
if [ "`pkg_info | grep -i cgal `" ]; then
echo Stopping. Please remove any CGAL packages you have installed and restart
exit
fi
if [ "`pkg_info | grep -i opencsg`" ]; then
echo Stopping. Please remove any OpenCSG packages you have installed and restart
exit
fi
OPENSCADDIR=$PWD
if [ ! -f $OPENSCADDIR/openscad.pro ]; then
echo "Must be run from the OpenSCAD source root directory"
exit 0
fi
. ./scripts/setenv-freebsdbuild.sh
pkg_add -r bison boost-libs cmake git bash eigen2 flex gmake gmp mpfr
pkg_add -r xorg libGLU libXmu libXi xorg-vfbserver glew
pkg_add -r qt4-corelib qt4-gui qt4-moc qt4-opengl qt4-qmake qt4-rcc qt4-uic
BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh cgal-use-sys-libs
BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh opencsg

296
scripts/googlecode_upload.py Executable file
View File

@ -0,0 +1,296 @@
#!/usr/bin/env python
# Google Code binary package uploader
# with Insturctions for uploading packages for OpenSCAD
#
# OpenSCAD Usage:
#
# 1. get a google account, get it added to the Google Code OpenSCAD project
# 2. go to https://code.google.com/hosting/settings for username & password
# -----
#
# security note -
#
# it's not advisable to use a ~/.netrc file to store your password
# keep your googlecode password secret
# only upload from a secure machine
# user's personal data can be at risk if your account
# is compromised and a fake openscad were to be uploaded.
# notify the OpenSCAD maintainer if your computer is stolen or
# your google account is ever compromised.
# -----
# 4. if you are making a Stable Release, check 'docs/release_checklist.txt'
# 5. create an OpenSCAD package (linux dev snapshot: ./scripts/release-common.sh)
# 6. Run this to do the upload:
# export SUMMARY="Linux x86-64 Snapshot" # replace as appropriate
# export PACKAGEFILE=openscad-2013.01.10.x86-64.tar.gz # replace as appropriate
# python ./scripts/googlecode_upload.py -s '$SUMMARY' -p openscad $PACKAGEFILE
# 7. It will ask for username. Use user.name@gmail.com (include the @ mail address)
# 8. It will ask for password. Copy/paste the password from the https google code settings page above
# Don't use the big bold password, use the 'plain font' password from the 'machine' line
# 9. Wait.... (there is no progress meter). It should say 'success' eventually.
#
# The rest of this file is original from Google with slight modifications by the
# OpenSCAD team. Modifications licensed under the same license as the
# original code from google - the Apache Software License 2.0:
# http://www.apache.org/licenses/LICENSE-2.0
#
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
# Author: danderson@google.com (David Anderson)
#
# Script for uploading files to a Google Code project.
#
# This is intended to be both a useful script for people who want to
# streamline project uploads and a reference implementation for
# uploading files to Google Code projects.
#
# To upload a file to Google Code, you need to provide a path to the
# file on your local machine, a small summary of what the file is, a
# project name, and a valid account that is a member or owner of that
# project. You can optionally provide a list of labels that apply to
# the file. The file will be uploaded under the same name that it has
# in your local filesystem (that is, the "basename" or last path
# component). Run the script with '--help' to get the exact syntax
# and available options.
#
# Note that the upload script requests that you enter your
# googlecode.com password. This is NOT your Gmail account password!
# This is the password you use on googlecode.com for committing to
# Subversion and uploading files. You can find your password by going
# to http://code.google.com/hosting/settings when logged in with your
# Gmail account. If you have already committed to your project's
# Subversion repository, the script will automatically retrieve your
# credentials from there (unless disabled, see the output of '--help'
# for details).
#
# If you are looking at this script as a reference for implementing
# your own Google Code file uploader, then you should take a look at
# the upload() function, which is the meat of the uploader. You
# basically need to build a multipart/form-data POST request with the
# right fields and send it to https://PROJECT.googlecode.com/files .
# Authenticate the request using HTTP Basic authentication, as is
# shown below.
#
# Licensed under the terms of the Apache Software License 2.0:
# http://www.apache.org/licenses/LICENSE-2.0
#
# Questions, comments, feature requests and patches are most welcome.
# Please direct all of these to the Google Code users group:
# http://groups.google.com/group/google-code-hosting
"""Google Code file uploader script.
"""
__author__ = 'danderson@google.com (David Anderson)'
import httplib
import os.path
import optparse
import getpass
import base64
import sys
def upload(file, project_name, user_name, password, summary, labels=None):
"""Upload a file to a Google Code project's file server.
Args:
file: The local path to the file.
project_name: The name of your project on Google Code.
user_name: Your Google account name.
password: The googlecode.com password for your account.
Note that this is NOT your global Google Account password!
summary: A small description for the file.
labels: an optional list of label strings with which to tag the file.
Returns: a tuple:
http_status: 201 if the upload succeeded, something else if an
error occured.
http_reason: The human-readable string associated with http_status
file_url: If the upload succeeded, the URL of the file on Google
Code, None otherwise.
"""
# The login is the user part of user@gmail.com. If the login provided
# is in the full user@domain form, strip it down.
if user_name.endswith('@gmail.com'):
user_name = user_name[:user_name.index('@gmail.com')]
form_fields = [('summary', summary)]
if labels is not None:
form_fields.extend([('label', l.strip()) for l in labels])
content_type, body = encode_upload_request(form_fields, file)
upload_host = '%s.googlecode.com' % project_name
upload_uri = '/files'
auth_token = base64.b64encode('%s:%s'% (user_name, password))
headers = {
'Authorization': 'Basic %s' % auth_token,
'User-Agent': 'Googlecode.com uploader v0.9.4',
'Content-Type': content_type,
}
server = httplib.HTTPSConnection(upload_host)
server.request('POST', upload_uri, body, headers)
resp = server.getresponse()
server.close()
if resp.status == 201:
location = resp.getheader('Location', None)
else:
location = None
return resp.status, resp.reason, location
def encode_upload_request(fields, file_path):
"""Encode the given fields and file into a multipart form body.
fields is a sequence of (name, value) pairs. file is the path of
the file to upload. The file will be uploaded to Google Code with
the same file name.
Returns: (content_type, body) ready for httplib.HTTP instance
"""
BOUNDARY = '----------Googlecode_boundary_reindeer_flotilla'
CRLF = '\r\n'
body = []
# Add the metadata about the upload first
for key, value in fields:
body.extend(
['--' + BOUNDARY,
'Content-Disposition: form-data; name="%s"' % key,
'',
value,
])
# Now add the file itself
file_name = os.path.basename(file_path)
f = open(file_path, 'rb')
file_content = f.read()
f.close()
body.extend(
['--' + BOUNDARY,
'Content-Disposition: form-data; name="filename"; filename="%s"'
% file_name,
# The upload server determines the mime-type, no need to set it.
'Content-Type: application/octet-stream',
'',
file_content,
])
# Finalize the form body
body.extend(['--' + BOUNDARY + '--', ''])
return 'multipart/form-data; boundary=%s' % BOUNDARY, CRLF.join(body)
def upload_find_auth(file_path, project_name, summary, labels=None,
user_name=None, password=None, tries=3):
"""Find credentials and upload a file to a Google Code project's file server.
file_path, project_name, summary, and labels are passed as-is to upload.
Args:
file_path: The local path to the file.
project_name: The name of your project on Google Code.
summary: A small description for the file.
labels: an optional list of label strings with which to tag the file.
config_dir: Path to Subversion configuration directory, 'none', or None.
user_name: Your Google account name.
tries: How many attempts to make.
"""
if user_name is None or password is None:
from netrc import netrc
authenticators = None
try:
authenticators = netrc().authenticators("code.google.com")
except:
print "Error accessing netrc authenticator. Trying alternate method"
if authenticators:
if user_name is None:
user_name = authenticators[0]
if password is None:
password = authenticators[2]
while tries > 0:
if user_name is None:
# Read username if not specified or loaded from svn config, or on
# subsequent tries.
sys.stdout.write('Please enter your googlecode.com username: ')
sys.stdout.flush()
user_name = sys.stdin.readline().rstrip()
if password is None:
# Read password if not loaded from svn config, or on subsequent tries.
print 'Please enter your googlecode.com password.'
print '** Note that this is NOT your Gmail account password! **'
print 'It is the password you use to access Subversion repositories,'
print 'and can be found here: http://code.google.com/hosting/settings'
password = getpass.getpass()
status, reason, url = upload(file_path, project_name, user_name, password,
summary, labels)
# Returns 403 Forbidden instead of 401 Unauthorized for bad
# credentials as of 2007-07-17.
if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]:
# Rest for another try.
user_name = password = None
tries = tries - 1
else:
# We're done.
break
return status, reason, url
def main():
parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY '
'-p PROJECT [options] FILE')
parser.add_option('-s', '--summary', dest='summary',
help='Short description of the file')
parser.add_option('-p', '--project', dest='project',
help='Google Code project name')
parser.add_option('-u', '--user', dest='user',
help='Your Google Code username')
parser.add_option('-w', '--password', dest='password',
help='Your Google Code password')
parser.add_option('-l', '--labels', dest='labels',
help='An optional list of comma-separated labels to attach '
'to the file')
options, args = parser.parse_args()
if not options.summary:
parser.error('File summary is missing.')
elif not options.project:
parser.error('Project name is missing.')
elif len(args) < 1:
parser.error('File to upload not provided.')
elif len(args) > 1:
parser.error('Only one file may be specified.')
file_path = args[0]
if options.labels:
labels = options.labels.split(',')
else:
labels = None
status, reason, url = upload_find_auth(file_path, options.project,
options.summary, labels,
options.user, options.password)
if url:
print 'The file was uploaded successfully.'
print 'URL: %s' % url
return 0
else:
print 'An error occurred. Your file was not uploaded.'
print 'Google Code upload server said: %s (%s)' % (reason, status)
return 1
if __name__ == '__main__':
sys.exit(main())

View File

@ -1,339 +0,0 @@
#!/bin/sh -e
# test_pretty_print copyright 2012 don bright. released under the GPL 2, or
# later, as described in the file named 'COPYING' in OpenSCAD's project root.
# permission to change this license is given to Marius Kintel & Clifford Wolf
#
# This script builds all library dependencies of OpenSCAD for Linux
#
# This script must be run from the OpenSCAD source root directory
#
# Usage: linux-build-dependencies.sh
#
# Prerequisites:
# - wget or curl
# - Qt4
#
printUsage()
{
echo "Usage: $0"
echo
}
build_git()
{
version=$1
echo "Building git" $version "..."
cd $BASEDIR/src
rm -rf git-$version
if [ ! -f git-$version.tar.gz ]; then
curl -O http://git-core.googlecode.com/files/git-$version.tar.gz
fi
tar zxf git-$version.tar.gz
cd git-$version
./configure --prefix=$DEPLOYDIR
make -j$NUMCPU
make install
}
build_cmake()
{
version=$1
echo "Building cmake" $version "..."
cd $BASEDIR/src
rm -rf cmake-$version
if [ ! -f cmake-$version.tar.gz ]; then
curl -O http://www.cmake.org/files/v2.8/cmake-$version.tar.gz
fi
tar zxf cmake-$version.tar.gz
cd cmake-$version
mkdir build
cd build
../configure --prefix=$DEPLOYDIR
make -j$NUMCPU
make install
}
build_curl()
{
version=$1
echo "Building curl" $version "..."
cd $BASEDIR/src
rm -rf curl-$version
if [ ! -f curl-$version.tar.bz2 ]; then
wget http://curl.haxx.se/download/curl-$version.tar.bz2
fi
tar xjf curl-$version.tar.bz2
cd curl-$version
mkdir build
cd build
../configure --prefix=$DEPLOYDIR
make -j$NUMCPU
make install
}
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
mkdir build
cd build
../configure --prefix=$DEPLOYDIR --enable-cxx
make install
}
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-$version/mpfr-$version.tar.bz2
fi
tar xjf mpfr-$version.tar.bz2
cd mpfr-$version
mkdir build
cd build
../configure --prefix=$DEPLOYDIR --with-gmp=$DEPLOYDIR
make install
cd ..
}
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 certain portions of boost
./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,system,regex
if [ $CXX ]; then
if [ $CXX = "clang++" ]; then
./b2 -j$NUMCPU toolset=clang install
# ./b2 -j$NUMCPU toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" install
fi
else
./b2 -j$NUMCPU
./b2 install
fi
}
build_cgal()
{
version=$1
echo "Building CGAL" $version "..."
cd $BASEDIR/src
rm -rf CGAL-$version
if [ ! -f CGAL-$version.tar.gz ]; then
#4.0.2
curl -O https://gforge.inria.fr/frs/download.php/31174/CGAL-$version.tar.bz2
# 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
tar jxf CGAL-$version.tar.bz2
cd CGAL-$version
if [ $2 = use-sys-libs ]; then
cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DCMAKE_BUILD_TYPE=Debug
else
cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.so -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.so -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.so -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBOOST_ROOT=$DEPLOYDIR -DCMAKE_BUILD_TYPE=Debug
fi
make -j$NUMCPU
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
# Fedora 64-bit
if [ -e /usr/lib64 ]; then
if [ "`ls /usr/lib64 | grep Xmu`" ]; then
echo "modifying glew makefile for 64 bit machine"
sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ config/Makefile.linux
fi
fi
if [ $CC ]; then
if [ $CC = "clang" ]; then
echo "modifying glew makefile for clang"
sed -i s/\$\(CC\)/clang/ Makefile
fi
fi
GLEW_DEST=$DEPLOYDIR make -j$NUMCPU
GLEW_DEST=$DEPLOYDIR make 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
sed -ibak s/example// opencsg.pro # examples might be broken without GLUT
# Fedora 64-bit
if [ -e /usr/lib64 ]; then
if [ "`ls /usr/lib64 | grep Xmu`" ]; then
echo "modifying opencsg makefile for 64 bit machine"
sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ src/Makefile
fi
fi
if [ `uname | grep FreeBSD` ]; then
sed -ibak s/X11R6/local/g src/Makefile
fi
if [ "`command -v qmake-qt4`" ]; then
OPENCSG_QMAKE=qmake-qt4
else
OPENCSG_QMAKE=qmake
fi
if [ $CXX ]; then
if [ $CXX = "clang++" ]; then
cd $BASEDIR/src/OpenCSG-$version/src
$OPENCSG_QMAKE
cd $BASEDIR/src/OpenCSG-$version
$OPENCSG_QMAKE
fi
else
$OPENCSG_QMAKE
fi
make
cp -av lib/* $DEPLOYDIR/lib
cp -av include/* $DEPLOYDIR/include
cd $OPENSCADDIR
}
build_eigen()
{
version=$1
echo "Building eigen" $version "..."
cd $BASEDIR/src
rm -rf eigen-$version
EIGENDIR="none"
if [ $version = "2.0.17" ]; then EIGENDIR=eigen-eigen-b23437e61a07; fi
if [ $version = "3.1.1" ]; then EIGENDIR=eigen-eigen-43d9075b23ef; fi
if [ $EIGENDIR = "none" ]; then
echo Unknown eigen version. Please edit script.
exit 1
fi
rm -rf ./$EIGENDIR
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
ln -s ./$EIGENDIR eigen-$version
cd eigen-$version
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR ..
make -j$NUMCPU
make install
}
OPENSCADDIR=$PWD
if [ ! -f $OPENSCADDIR/openscad.pro ]; then
echo "Must be run from the OpenSCAD source root directory"
exit 0
fi
. ./scripts/setenv-linbuild.sh # '.' is equivalent to 'source'
SRCDIR=$BASEDIR/src
if [ ! $NUMCPU ]; then
echo "Note: The NUMCPU environment variable can be set for paralell builds"
NUMCPU=1
fi
if [ ! -d $BASEDIR/bin ]; then
mkdir -p $BASEDIR/bin
fi
echo "Using basedir:" $BASEDIR
echo "Using deploydir:" $DEPLOYDIR
echo "Using srcdir:" $SRCDIR
echo "Number of CPUs for parallel builds:" $NUMCPU
mkdir -p $SRCDIR $DEPLOYDIR
if [ ! "`command -v curl`" ]; then
build_curl 7.26.0
fi
# NB! For cmake, also update the actual download URL in the function
if [ ! "`command -v cmake`" ]; then
build_cmake 2.8.8
fi
if [ "`cmake --version | grep 'version 2.[1-6][^0-9]'`" ]; then
build_cmake 2.8.8
fi
# build_git 1.7.10.3
# Singly build CGAL or OpenCSG
# (Most systems have all libraries available as packages except CGAL/OpenCSG)
# (They can be built singly here by passing a command line arg to the script)
if [ $1 ]; then
if [ $1 = "cgal-use-sys-libs" ]; then
build_cgal 4.0.2 use-sys-libs
exit
fi
if [ $1 = "opencsg" ]; then
build_opencsg 1.3.2
exit
fi
fi
#
# Main build of libraries
# edit version numbers here as needed.
#
build_eigen 3.1.1
build_gmp 5.0.5
build_mpfr 3.1.1
build_boost 1.47.0
# NB! For CGAL, also update the actual download URL in the function
build_cgal 4.0.2
build_glew 1.7.0
build_opencsg 1.3.2
echo "OpenSCAD dependencies built and installed to " $BASEDIR

View File

@ -284,7 +284,7 @@ build_eigen()
EIGENDIR="none"
if [ $version = "2.0.17" ]; then EIGENDIR=eigen-eigen-b23437e61a07; fi
if [ $version = "3.1.1" ]; then EIGENDIR=eigen-eigen-43d9075b23ef; fi
if [ $version = "3.1.2" ]; then EIGENDIR=eigen-eigen-5097c01bcdc4; fi
if [ $EIGENDIR = "none" ]; then
echo Unknown eigen version. Please edit script.
exit 1
@ -365,7 +365,7 @@ fi
echo "Using basedir:" $BASEDIR
mkdir -p $SRCDIR $DEPLOYDIR
build_eigen 3.1.1
build_eigen 3.1.2
build_gmp 5.0.5
build_mpfr 3.1.1
build_boost 1.51.0

View File

@ -41,8 +41,9 @@ if [ ! -e $BASEDIR ]; then
fi
if [ ! -e $MXEDIR ]; then
echo "Downloading MXE into " $MXEDIR
mkdir -p $MXEDIR
cd $MXEDIR/..
echo "Downloading MXE into " $PWD
git clone git://github.com/mxe/mxe.git
fi

View File

@ -1,8 +0,0 @@
echo "tested on OpenSUSE 12. If this fails try 'old linux' build (see README.md)"
sudo zypper install libeigen2-devel mpfr-devel gmp-devel boost-devel \
libqt4-devel glew-devel cmake git
echo "now copy/paste the following to install CGAL and OpenCSG from source:"
echo "sudo BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh cgal-use-sys-libs"
echo "sudo BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh opencsg"

View File

@ -6,6 +6,7 @@
if test -z "$VERSION"; then
VERSION=`date "+%Y.%m.%d"`
COMMIT=-c
SNAPSHOT=true
fi
# Turn off ccache, just for safety
@ -24,10 +25,11 @@ echo "Sanity check of the app bundle..."
if [[ $? != 0 ]]; then
exit 1
fi
cp OpenSCAD-$VERSION.dmg ~/Dropbox/Public
ln -sf OpenSCAD-$VERSION.dmg ~/Dropbox/Public/OpenSCAD-latest.dmg
echo "Upload in progress..."
echo "Uploading..."
LABELS=OpSys-OSX,Type-Executable
if ! $SNAPSHOT; then LABELS=$LABELS,Featured; fi
`dirname $0`/googlecode_upload.py -s 'Mac OS X Snapshot' -p openscad OpenSCAD-$VERSION.dmg -l $LABELS
# Update snapshot filename on wab page
`dirname $0`/update-web.sh OpenSCAD-$VERSION.dmg

View File

@ -31,7 +31,7 @@ if [ ! -f $OPENSCADDIR/openscad.pro ]; then
exit 1
fi
OSTYPE=mingw-cross-env ./scripts/release-common.sh -v $VERSION $COMMIT
./scripts/release-common.sh -v $VERSION $COMMIT mingw32
if [ $? != 0 ]; then
echo "release-common.sh returned error code: $?. build stopped."

View File

@ -1,25 +1,29 @@
#!/bin/bash
#
# This script creates a binary release of OpenSCAD.
# This should work under Mac OS X, Windows (msys), and Linux cross-compiling
# for windows using mingw-cross-env (use like: OSTYPE=mingw-cross-env release-common.sh).
# Linux support pending.
# The script will create a file called openscad-<versionstring>.zip
# in the current directory (or in the $DEPLOYDIR of a mingw cross build)
# This script creates a binary release of OpenSCAD. This should work
# under Mac OS X, Linux 32, Linux 64, and Linux->Win32 MXE cross-build.
# Windows under msys has not been tested recently.
#
# Usage: release-common.sh [-v <versionstring>] [-c]
# -v Version string (e.g. -v 2010.01)
# -c Build with commit info
# The script will create a file called openscad-<versionstring>.<extension> in
# the current directory (or under ./mingw32)
#
# Usage: release-common.sh [-v <versionstring>] [-c] [-x32]
# -v Version string (e.g. -v 2010.01)
# -c Build with commit info
# -mingw32 Cross-compile for win32 using MXE
#
# If no version string is given, todays date will be used (YYYY-MM-DD)
# If no make target is given, release will be used on Windows, none one Mac OS X
#
# The commit info will extracted from git and be passed to qmake as OPENSCAD_COMMIT
# to identify a build in the about box.
#
# The mingw32 cross compile depends on the MXE cross-build tools. Please
# see the README.md file on how to install these dependencies.
printUsage()
{
echo "Usage: $0 -v <versionstring> -c
echo "Usage: $0 -v <versionstring> -c -mingw32
echo
echo " Example: $0 -v 2010.01
}
@ -42,11 +46,18 @@ elif [[ $OSTYPE == "linux-gnu" ]]; then
ARCH=32
fi
echo "Detected ARCH: $ARCH"
elif [[ $OSTYPE == "mingw-cross-env" ]]; then
fi
if [ "`echo $* | grep mingw32`" ]; then
OS=LINXWIN
fi
echo "Detected OS: $OS"
if [ $OS ]; then
echo "Detected OS: $OS"
else
echo "Error: Couldn't detect OSTYPE"
exit
fi
while getopts 'v:c' c
do
@ -147,14 +158,19 @@ case $OS in
;;
esac
if [ ! $NUMCPU ]; then
echo "note: you can 'export NUMCPU=x' for multi-core compiles (x=number)";
NUMCPU=2
fi
case $OS in
LINXWIN)
# make -jx sometimes has problems with parser_yacc
# dont use paralell builds, it can error-out on parser_yacc.
cd $DEPLOYDIR && make $TARGET
cd $OPENSCADDIR
;;
*)
make -j2 $TARGET
make -j$NUMCPU $TARGET
;;
esac

View File

@ -1,6 +0,0 @@
# run with '. ./scripts/setenv-freebsdbuild.sh'
# use in conjuction with freebsd-build-dependencies.sh
QMAKESPEC=freebsd-g++
QTDIR=/usr/local/share/qt4

View File

@ -1,12 +0,0 @@
# build dependencies and/or openscad on linux with the clang compiler
export CC=clang
export CXX=clang++
export QMAKESPEC=unsupported/linux-clang
echo CC has been modified: $CC
echo CXX has been modified: $CXX
echo QMAKESPEC has been modified: $QMAKESPEC
. ./scripts/setenv-linbuild.sh

View File

@ -1,34 +0,0 @@
# setup environment variables for building OpenSCAD against custom built
# dependency libraries. called by linux-build-dependencies.sh
# run this file with 'source setenv-linbuild.sh' every time you re-login
# and want to build or run openscad against custom libraries installed
# into BASEDIR.
# copy this file to your .bashrc if desired.
if [ ! $BASEDIR ]; then
BASEDIR=$HOME/openscad_deps
fi
DEPLOYDIR=$BASEDIR
export PATH=$BASEDIR/bin:$PATH
export LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64
export LD_RUN_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64
export OPENSCAD_LIBRARIES=$DEPLOYDIR
export GLEWDIR=$DEPLOYDIR
echo BASEDIR: $BASEDIR
echo DEPLOYDIR: $DEPLOYDIR
echo PATH modified
echo LD_LIBRARY_PATH modified
echo LD_RUN_PATH modified
echo OPENSCAD_LIBRARIES modified
echo GLEWDIR modified
if [ "`command -v qmake-qt4`" ]; then
echo "Please re-run qmake-qt4 and run 'make clean' if necessary"
else
echo "Please re-run qmake and run 'make clean' if necessary"
fi

View File

@ -0,0 +1,89 @@
# setup environment variables for building OpenSCAD against custom built
# dependency libraries. works on Linux/BSD.
#
# Please see the 'uni-build-dependencies.sh' file for usage information
#
setenv_common()
{
if [ ! $BASEDIR ]; then
if [ -f openscad.pro ]; then
# if in main openscad dir, put under $HOME
BASEDIR=$HOME/openscad_deps
else
# otherwise, assume its being run 'out of tree'. treat it somewhat like
# "configure" or "cmake", so you can build dependencies where u wish.
echo "Warning: Not in OpenSCAD src dir... using current directory as base of build"
BASEDIR=$PWD/openscad_deps
fi
fi
DEPLOYDIR=$BASEDIR
export BASEDIR
export PATH=$BASEDIR/bin:$PATH
export LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64
export LD_RUN_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64
export OPENSCAD_LIBRARIES=$DEPLOYDIR
export GLEWDIR=$DEPLOYDIR
echo BASEDIR: $BASEDIR
echo DEPLOYDIR: $DEPLOYDIR
echo PATH modified
echo LD_LIBRARY_PATH modified
echo LD_RUN_PATH modified
echo OPENSCAD_LIBRARIES modified
echo GLEWDIR modified
if [ "`command -v qmake-qt4`" ]; then
echo "Please re-run qmake-qt4 and run 'make clean' if necessary"
else
echo "Please re-run qmake and run 'make clean' if necessary"
fi
}
setenv_freebsd()
{
setenv_common
QMAKESPEC=freebsd-g++
QTDIR=/usr/local/share/qt4
}
setenv_netbsd()
{
setenv_common
QMAKESPEC=netbsd-g++
QTDIR=/usr/pkg/qt4
PATH=/usr/pkg/qt4/bin:$PATH
LD_LIBRARY_PATH=/usr/pkg/qt4/lib:/usr/X11R7/lib:$LD_LIBRARY_PATH
export QMAKESPEC
export QTDIR
export PATH
export LD_LIBRARY_PATH
}
setenv_linux_clang()
{
export CC=clang
export CXX=clang++
export QMAKESPEC=unsupported/linux-clang
echo CC has been modified: $CC
echo CXX has been modified: $CXX
echo QMAKESPEC has been modified: $QMAKESPEC
}
if [ "`uname | grep -i 'linux\|debian'`" ]; then
setenv_common
if [ "`echo $* | grep clang`" ]; then
setenv_linux_clang
fi
elif [ "`uname | grep -i freebsd`" ]; then
setenv_freebsd
elif [ "`uname | grep -i netbsd`" ]; then
setenv_netbsd
else
# guess
setenv_common
echo unknown system. guessed env variables. see 'setenv-unibuild.sh'
fi

View File

@ -1,33 +0,0 @@
too_old()
{
echo "System version too low. Please try 'old linux' build (see README.md)"
exit
}
if [ "`cat /etc/issue | grep 'Debian GNU/Linux 6.0'`" ]; then
too_old
fi
if [ "`cat /etc/issue | grep 'Debian GNU/Linux 5'`" ]; then
too_old
fi
if [ "`cat /etc/issue | grep 'Ubunutu 10'`" ]; then
too_old
fi
if [ "`cat /etc/issue | grep 'Ubunutu 9'`" ]; then
too_old
fi
if [ "`cat /etc/issue | grep 'Ubunutu 8'`" ]; then
too_old
fi
if [ "`cat /etc/issue | grep 'Ubunutu 7'`" ]; then
too_old
fi
echo "tested on Ubuntu 12. If this fails try 'old linux' build (see README.md)"
sudo apt-get install build-essential libqt4-dev libqt4-opengl-dev \
libxmu-dev cmake bison flex libeigen2-dev git-core libboost-all-dev \
libXi-dev libmpfr-dev libgmp-dev libboost-dev libglew1.6-dev \
libcgal-dev libopencsg-dev

442
scripts/uni-build-dependencies.sh Executable file
View File

@ -0,0 +1,442 @@
#!/bin/sh -e
# uni-build-dependencies by don bright 2012. copyright assigned to
# Marius Kintel and Clifford Wolf, 2012. released under the GPL 2, or
# later, as described in the file named 'COPYING' in OpenSCAD's project root.
# This script builds most dependencies, both libraries and binary tools,
# of OpenSCAD for Linux/BSD. It is based on macosx-build-dependencies.sh
#
# By default it builds under $HOME/openscad_deps. You can alter this by
# setting the BASEDIR environment variable or with the 'out of tree'
# feature
#
# Usage:
# cd openscad
# . ./scripts/setenv-unibuild.sh
# ./scripts/uni-build-dependencies.sh
#
# Out-of-tree usage:
#
# cd somepath
# . /path/to/openscad/scripts/setenv-unibuild.sh
# /path/to/openscad/scripts/uni-build-dependencies.sh
#
# Prerequisites:
# - wget or curl
# - Qt4
# - gcc
#
# Enable Clang (experimental, only works on linux):
#
# . ./scripts/setenv-unibuild.sh clang
#
printUsage()
{
echo "Usage: $0"
echo
}
build_bison()
{
version=$1
echo "Building bison" $version
cd $BASEDIR/src
rm -rf bison-$version
if [ ! -f bison-$version.tar.gz ]; then
curl --insecure -O http://ftp.gnu.org/gnu/bison/bison-$version.tar.gz
fi
tar zxf bison-$version.tar.gz
cd bison-$version
./configure --prefix=$DEPLOYDIR
make -j$NUMCPU
make install
}
build_git()
{
version=$1
echo "Building git" $version "..."
cd $BASEDIR/src
rm -rf git-$version
if [ ! -f git-$version.tar.gz ]; then
curl --insecure -O http://git-core.googlecode.com/files/git-$version.tar.gz
fi
tar zxf git-$version.tar.gz
cd git-$version
./configure --prefix=$DEPLOYDIR
make -j$NUMCPU
make install
}
build_cmake()
{
version=$1
echo "Building cmake" $version "..."
cd $BASEDIR/src
rm -rf cmake-$version
if [ ! -f cmake-$version.tar.gz ]; then
curl --insecure -O http://www.cmake.org/files/v2.8/cmake-$version.tar.gz
fi
tar zxf cmake-$version.tar.gz
cd cmake-$version
mkdir build
cd build
../configure --prefix=$DEPLOYDIR
make -j$NUMCPU
make install
}
build_curl()
{
version=$1
echo "Building curl" $version "..."
cd $BASEDIR/src
rm -rf curl-$version
if [ ! -f curl-$version.tar.bz2 ]; then
wget http://curl.haxx.se/download/curl-$version.tar.bz2
fi
tar xjf curl-$version.tar.bz2
cd curl-$version
mkdir build
cd build
../configure --prefix=$DEPLOYDIR
make -j$NUMCPU
make install
}
build_gmp()
{
version=$1
if [ -e $DEPLOYDIR/include/gmp.h ]; then
echo "gmp already installed. not building"
return
fi
echo "Building gmp" $version "..."
cd $BASEDIR/src
rm -rf gmp-$version
if [ ! -f gmp-$version.tar.bz2 ]; then
curl --insecure -O ftp://ftp.gmplib.org/pub/gmp-$version/gmp-$version.tar.bz2
fi
tar xjf gmp-$version.tar.bz2
cd gmp-$version
mkdir build
cd build
../configure --prefix=$DEPLOYDIR --enable-cxx
make install
}
build_mpfr()
{
version=$1
if [ -e $DEPLOYDIR/include/mpfr.h ]; then
echo "mpfr already installed. not building"
return
fi
echo "Building mpfr" $version "..."
cd $BASEDIR/src
rm -rf mpfr-$version
if [ ! -f mpfr-$version.tar.bz2 ]; then
curl --insecure -O http://www.mpfr.org/mpfr-$version/mpfr-$version.tar.bz2
fi
tar xjf mpfr-$version.tar.bz2
cd mpfr-$version
mkdir build
cd build
../configure --prefix=$DEPLOYDIR --with-gmp=$DEPLOYDIR
make install
cd ..
}
build_boost()
{
if [ -e $DEPLOYDIR/include/boost ]; then
echo "boost already installed. not building"
return
fi
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 --insecure -LO http://downloads.sourceforge.net/project/boost/boost/$version/boost_$bversion.tar.bz2
fi
tar xjf boost_$bversion.tar.bz2
cd boost_$bversion
if [ "`gcc --version|grep 4.7`" ]; then
if [ "`echo $version | grep 1.47`" ]; then
echo gcc 4.7 incompatible with boost 1.47. edit boost version in $0
exit
fi
fi
# We only need certain portions of boost
./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,system,regex
if [ $CXX ]; then
if [ $CXX = "clang++" ]; then
./b2 -j$NUMCPU toolset=clang install
# ./b2 -j$NUMCPU toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" install
fi
else
./b2 -j$NUMCPU
./b2 install
fi
}
build_cgal()
{
if [ -e $DEPLOYDIR/include/CGAL/version.h ]; then
echo "CGAL already installed. not building"
return
fi
version=$1
echo "Building CGAL" $version "..."
cd $BASEDIR/src
rm -rf CGAL-$version
if [ ! -f CGAL-$version.tar.* ]; then
#4.0.2
curl --insecure -O https://gforge.inria.fr/frs/download.php/31174/CGAL-$version.tar.bz2
# 4.0 curl --insecure -O https://gforge.inria.fr/frs/download.php/30387/CGAL-$version.tar.gz
# 3.9 curl --insecure -O https://gforge.inria.fr/frs/download.php/29125/CGAL-$version.tar.gz
# 3.8 curl --insecure -O https://gforge.inria.fr/frs/download.php/28500/CGAL-$version.tar.gz
# 3.7 curl --insecure -O https://gforge.inria.fr/frs/download.php/27641/CGAL-$version.tar.gz
fi
tar jxf CGAL-$version.tar.bz2
cd CGAL-$version
if [ "`echo $2 | grep use-sys-libs`" ]; then
cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DCMAKE_BUILD_TYPE=Debug
else
cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.so -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.so -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.so -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBOOST_ROOT=$DEPLOYDIR -DCMAKE_BUILD_TYPE=Debug
fi
make -j$NUMCPU
make install
}
build_glew()
{
if [ -e $DEPLOYDIR/include/GL/glew.h ]; then
echo "glew already installed. not building"
return
fi
version=$1
echo "Building GLEW" $version "..."
cd $BASEDIR/src
rm -rf glew-$version
if [ ! -f glew-$version.tgz ]; then
curl --insecure -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
# Glew's makefile is not built for Linux Multiarch. We aren't trying
# to fix everything here, just the test machines OScad normally runs on
# Fedora 64-bit
if [ "`uname -m | grep 64`" ]; then
if [ -e /usr/lib64/libXmu.so.6 ]; then
sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ config/Makefile.linux
fi
fi
# debian hurd i386
if [ "`uname -m | grep 386`" ]; then
if [ -e /usr/lib/i386-gnu/libXi.so.6 ]; then
sed -ibak s/"-lXi"/"\-L\/usr\/lib\/i386-gnu\/libXi.so.6"/ config/Makefile.gnu
fi
fi
# clang linux
if [ $CC ]; then
sed -ibak s/"CC = cc"/"# CC = cc"/ config/Makefile.linux
fi
MAKER=make
if [ "`uname | grep BSD`" ]; then
if [ "`command -v gmake`" ]; then
MAKER=gmake
else
echo "building glew on BSD requires gmake (gnu make)"
exit
fi
fi
GLEW_DEST=$DEPLOYDIR $MAKER -j$NUMCPU
GLEW_DEST=$DEPLOYDIR $MAKER install
}
build_opencsg()
{
if [ -e $DEPLOYDIR/include/opencsg.h ]; then
echo "OpenCSG already installed. not building"
return
fi
version=$1
echo "Building OpenCSG" $version "..."
cd $BASEDIR/src
rm -rf OpenCSG-$version
if [ ! -f OpenCSG-$version.tar.gz ]; then
curl --insecure -O http://www.opencsg.org/OpenCSG-$version.tar.gz
fi
tar xzf OpenCSG-$version.tar.gz
cd OpenCSG-$version
# modify the .pro file for qmake, then use qmake to
# manually rebuild the src/Makefile (some systems don't auto-rebuild it)
cp opencsg.pro opencsg.pro.bak
cat opencsg.pro.bak | sed s/example// > opencsg.pro
if [ "`command -v qmake-qt4`" ]; then
OPENCSG_QMAKE=qmake-qt4
elif [ "`command -v qmake4`" ]; then
OPENCSG_QMAKE=qmake4
else
OPENCSG_QMAKE=qmake
fi
cd $BASEDIR/src/OpenCSG-$version/src
$OPENCSG_QMAKE
cd $BASEDIR/src/OpenCSG-$version
$OPENCSG_QMAKE
make
ls lib/* include/*
if [ -e lib/.libs ]; then ls lib/.libs/*; fi # netbsd
echo "installing to -->" $DEPLOYDIR
mkdir -p $DEPLOYDIR/lib
mkdir -p $DEPLOYDIR/include
install lib/* $DEPLOYDIR/lib
install include/* $DEPLOYDIR/include
if [ -e lib/.libs ]; then install lib/.libs/* $DEPLOYDIR/lib; fi #netbsd
cd $BASEDIR
}
build_eigen()
{
version=$1
if [ -e $DEPLOYDIR/include/eigen2 ]; then
if [ `echo $version | grep 2....` ]; then
echo "Eigen2 already installed. not building"
return
fi
fi
if [ -e $DEPLOYDIR/include/eigen3 ]; then
if [ `echo $version | grep 3....` ]; then
echo "Eigen3 already installed. not building"
return
fi
fi
echo "Building eigen" $version "..."
cd $BASEDIR/src
rm -rf eigen-$version
EIGENDIR="none"
if [ $version = "2.0.17" ]; then EIGENDIR=eigen-eigen-b23437e61a07; fi
if [ $version = "3.1.1" ]; then EIGENDIR=eigen-eigen-43d9075b23ef; fi
if [ $EIGENDIR = "none" ]; then
echo Unknown eigen version. Please edit script.
exit 1
fi
rm -rf ./$EIGENDIR
if [ ! -f eigen-$version.tar.bz2 ]; then
curl --insecure -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
ln -s ./$EIGENDIR eigen-$version
cd eigen-$version
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DEIGEN_TEST_NO_OPENGL=1 ..
make -j$NUMCPU
make install
}
# this section allows 'out of tree' builds, as long as the system has
# the 'dirname' command installed
if [ "`command -v dirname`" ]; then
OPENSCAD_SCRIPTDIR=`dirname $0`
else
if [ ! -f openscad.pro ]; then
echo "Must be run from the OpenSCAD source root directory (dont have 'dirname')"
exit 1
else
OPENSCAD_SCRIPTDIR=$PWD
fi
fi
. $OPENSCAD_SCRIPTDIR/setenv-unibuild.sh # '.' is equivalent to 'source'
SRCDIR=$BASEDIR/src
if [ ! $NUMCPU ]; then
echo "Note: The NUMCPU environment variable can be set for paralell builds"
NUMCPU=1
fi
if [ ! -d $BASEDIR/bin ]; then
mkdir -p $BASEDIR/bin
fi
echo "Using basedir:" $BASEDIR
echo "Using deploydir:" $DEPLOYDIR
echo "Using srcdir:" $SRCDIR
echo "Number of CPUs for parallel builds:" $NUMCPU
mkdir -p $SRCDIR $DEPLOYDIR
# this section builds some basic tools, if they are missing or outdated
# they are installed under $BASEDIR/bin which we have added to our PATH
if [ ! "`command -v curl`" ]; then
build_curl 7.26.0
fi
if [ ! "`command -v bison`" ]; then
build_bison 2.6.1
fi
# NB! For cmake, also update the actual download URL in the function
if [ ! "`command -v cmake`" ]; then
build_cmake 2.8.8
fi
if [ "`cmake --version | grep 'version 2.[1-6][^0-9]'`" ]; then
build_cmake 2.8.8
fi
# build_git 1.7.10.3
# Singly build CGAL or OpenCSG
# (Most systems have all libraries available as packages except CGAL/OpenCSG)
# (They can be built singly here by passing a command line arg to the script)
if [ $1 ]; then
if [ $1 = "cgal" ]; then
build_cgal 4.0.2 use-sys-libs
exit
fi
if [ $1 = "opencsg" ]; then
build_opencsg 1.3.2
exit
fi
fi
#
# Main build of libraries
# edit version numbers here as needed.
#
build_eigen 3.1.1
build_gmp 5.0.5
build_mpfr 3.1.1
build_boost 1.49.0
# NB! For CGAL, also update the actual download URL in the function
build_cgal 4.0.2
build_glew 1.9.0
build_opencsg 1.3.2
echo "OpenSCAD dependencies built and installed to " $BASEDIR

90
scripts/uni-get-dependencies.sh Executable file
View File

@ -0,0 +1,90 @@
# auto-install dependency packages using the systems package manager.
# after running this, run ./script/check-dependencies.sh. see README.md
#
# this assumes you have sudo installed or are running as root.
#
get_fedora_deps()
{
sudo yum install qt-devel bison flex eigen2-devel \
boost-devel mpfr-devel gmp-devel glew-devel CGAL-devel gcc pkgconfig git
}
get_altlinux_deps()
{
for i in boost-devel boost-filesystem-devel gcc4.5 gcc4.5-c++ boost-program_options-devel \
boost-thread-devel boost-system-devel boost-regex-devel eigen2 libmpfr libgmp libgmp_cxx-devel qt4-devel libcgal-devel git-core \
libglew-devel flex bison; do sudo apt-get install $i; done
}
get_freebsd_deps()
{
pkg_add -r bison boost-libs cmake git bash eigen2 flex gmake gmp mpfr \
xorg libGLU libXmu libXi xorg-vfbserver glew \
qt4-corelib qt4-gui qt4-moc qt4-opengl qt4-qmake qt4-rcc qt4-uic \
opencsg cgal
}
get_netbsd_deps()
{
sudo pkgin install bison boost cmake git bash eigen flex gmake gmp mpfr \
qt4 glew cgal opencsg modular-xorg
}
get_opensuse_deps()
{
sudo zypper install libeigen2-devel mpfr-devel gmp-devel boost-devel \
libqt4-devel glew-devel cmake git bison flex cgal-devel opencsg-devel
}
get_mageia_deps()
{
sudo urpmi ctags
sudo urpmi task-c-devel task-c++-devel libqt4-devel libgmp-devel \
libmpfr-devel libboost-devel eigen3-devel libglew-devel bison flex \
cmake imagemagick python curl git
}
get_debian_deps()
{
for pkg in build-essential libqt4-dev libqt4-opengl-dev \
libxmu-dev cmake bison flex git-core libboost-all-dev \
libXi-dev libmpfr-dev libboost-dev libglew-dev libeigen2-dev \
libeigen3-dev libcgal-dev libopencsg-dev libgmp3-dev libgmp-dev; do
sudo apt-get -y install $pkg;
done
}
unknown()
{
echo "Unknown system type. Please install the dependency packages listed"
echo "in README.md using your system's package manager."
}
if [ -e /etc/issue ]; then
if [ "`grep -i ubuntu /etc/issue`" ]; then
get_debian_deps
elif [ "`grep -i debian /etc/issue`" ]; then
get_debian_deps
elif [ "`grep -i suse /etc/issue`" ]; then
get_opensuse_deps
elif [ "`grep -i fedora /etc/issue`" ]; then
get_fedora_deps
elif [ "`grep -i red.hat /etc/issue`" ]; then
get_fedora_deps
elif [ "`grep -i mageia /etc/issue`" ]; then
get_mageia_deps
elif [ "`command -v rpm`" ]; then
if [ "`rpm -qa | grep altlinux`" ]; then
get_altlinux_deps
fi
fi
elif [ "`uname | grep -i freebsd `" ]; then
get_freebsd_deps
elif [ "`uname | grep -i netbsd`" ]; then
get_netbsd_deps
else
unknown
fi

View File

@ -16,6 +16,9 @@ public:
this->aboutText->setOpenExternalLinks(true);
QUrl flattr_qurl(":icons/flattr.png" );
this->aboutText->loadResource( QTextDocument::ImageResource, flattr_qurl );
QString tmp = this->aboutText->toHtml();
tmp.replace("__VERSION__",QString(TOSTRING(OPENSCAD_VERSION)));
this->aboutText->setHtml(tmp);
}
};

View File

@ -1,77 +1,143 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://flattr.com/submit/auto?user_id=openscad&amp;url=http://openscad.org&amp;title=OpenSCAD&amp;language=&amp;tags=github&amp;category=software"><img src=":icons/flattr.png" /></a></p>
<p align="right" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.openscad.org"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">OpenSCAD</span></a><span style=" font-size:10pt;"> is Copyright (C) 2009-2012 </span><a href="https://github.com/kintel"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Marius Kintel </span></a><span style=" font-size:10pt;"> &lt;marius@kintel.net&gt; and </span><a href="http://clifford.at"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Clifford Wolf</span></a><span style=" font-size:10pt;"> &lt;clifford@clifford.at&gt;</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600;">License</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">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.</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Please visit this link for a copy of the license: </span><a href="http://www.gnu.org/licenses/gpl-2.0.html"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">GPL 2.0</span></a></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600;">Tools &amp; Libraries used</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://gmplib.org/"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">GNU GMP</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.mpfr.org/"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">GNU MPFR</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.cgal.org"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">CGAL</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://eigen.tuxfamily.org"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Eigen2</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.opencsg.org"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">OpenCSG</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.opengl.org/"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">OpenGL</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://glew.sourceforge.net"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">GLEW</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://qt.nokia.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Qt Toolkit</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.boost.org"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Boost</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.gnu.org/software/bison/"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Bison</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://flex.sourceforge.net/"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Flex</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.cmake.org"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">CMake</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://lodev.org/lodepng/"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">LodePNG</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.mingw.org/"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">MingW</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.mxe.cc"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">MXE</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.linux.org"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Linux</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.apple.com/osx/"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Mac OSX</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.stroustrup.com/C++.html"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">C++</span></a><span style=" font-size:10pt; font-weight:600;">, </span><a href="http://gcc.gnu.org/"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">GCC</span></a><span style=" font-size:10pt; font-weight:600;">, </span><a href="http://clang.llvm.org/"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">clang</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.python.org"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">python</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://nsis.sourceforge.net/Main_Page"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Nullsoft installer</span></a></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600;">Acknowledgements</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.github.com/openscad"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">OpenSCAD Github Project</span></a><span style=" font-size:10pt;"> members (public):</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/kintel"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Marius Kintel </span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://clifford.at"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Clifford Wolf</span></a><span style=" font-size:10pt;"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.github.com/GilesBathgate"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Giles Bathgate</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/brad"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Brad Pitcher</span></a></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.debian.org"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Debian </span></a><span style=" font-family:'Ubuntu'; font-size:11pt;">maintainer:</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://christian.amsuess.com/"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Christian M. Amsüss</span></a></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Patches:</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/meta23"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">meta23</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/jasonblewis"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">jasonblewis</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/gregjurman"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">gregjurman</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/brianolson"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">brianolson</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/tjhowse"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">tjhowse</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/logxen"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">logxen</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;"> (Mark A Cooper)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/iamwilhelm"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">iamwilhelm</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;"> (Wil Chung)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/clothbot"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">clothbot</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;"> (Andrew Plumb)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/colah"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">colah</span></a><span style=" font-family:'Ubuntu'; font-size:11pt;"> (Christopher Olah)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Bug reports:</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">nop head, Triffid Hunter, Len Trigg, </span><span style=" font-family:'Ubuntu'; font-size:11pt;">Kliment Yanev, Christian Siefkes, Whosawhatsis, MichaelAtOz, mrhdias, ibyte8bits, Koen Kooi, Tomas Mudrunka, knuds, cadr, mshearn, Hans L, Brett Sutton, hmnapier, Eero af Heurlin, caliston, 5263, ghost, 42loop, uniqx, Michael Thomson, Michael Ivko, Pierre Doucet, myglc2, Alan Cox, Peter Falke, Michael Ambrus, Gordon Wrigley, Ed Nisley, Stony Smith, Pasca Andrei, David Goodenough, William A Adams ... and many others</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt; font-style:italic;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600;">Hosting &amp; resources</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.github.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Github</span></a><span style=" font-size:10pt;"> source repository</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://rocklinux.net/pipermail/openscad/"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Rock Linux</span></a><span style=" font-size:10pt;"> mailing list</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.thingiverse.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Thingiverse</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://guerby.org/"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Laurent Guerby</span></a><span style=" font-size:10pt;"> and the </span><a href="http://gcc.gnu.org/wiki/CompileFarm"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">GCC Compile Farm,</span></a><span style=" font-size:10pt;"> with </span><a href="http://osuosl.org/"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">OSUOSL,</span></a><span style=" font-size:10pt;"> </span><a href="http://www.ibm.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">IBM</span></a><span style=" font-size:10pt;">, </span><a href="http://www.irill.org"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">IRILL,</span></a><span style=" font-size:10pt;"> </span><a href="http://www.intel.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">Intel</span></a><span style=" font-size:10pt;">, </span><a href="http://www.fsffrance.org"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">FSF France,</span></a><span style=" font-size:10pt;"> and </span><a href="http://www.amd.com"><span style=" font-family:'Ubuntu'; font-size:11pt; text-decoration: underline; color:#0000ff;">AMD</span></a><span style=" font-size:10pt;">.</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Apologies to anyone accidentally left out. </span></p></body></html>
<html>
<!-- Please note that Qt's TextBrowser renders things slightly unusually, so
a normal browser alone is not a sufficient test. Just edit this file and rerun
make to do your testing. -->
<head>
<meta name="qrichtext" content="1" />
</head>
<body style="font-family:'Arial'; font-size:13pt;">
<p>
<a align=right href="https://flattr.com/submit/auto?user_id=openscad&amp;url=http://openscad.org&amp;title=OpenSCAD&amp;language=&amp;tags=github&amp;category=software"><img align=right src=":icons/flattr.png" /></a>
</p>
<p>
<a href="http://www.openscad.org">OpenSCAD</a> version __VERSION__
</p>
<p>
Copyright (C) 2009-2013 <a href="https://github.com/kintel">Marius Kintel</a> &lt;marius@kintel.net&gt; and <a href="http://clifford.at">Clifford Wolf</a> &lt;clifford@clifford.at&gt;
</p>
<p>
<b>License</b>
</p>
<p>
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.
</p>
<p>
Please visit this link for a copy of the license: <a href="http://www.gnu.org/licenses/gpl-2.0.html">GPL 2.0</a>
</p>
<p>
<b>Tools &amp; Libraries used</b>
</p>
<lu>
<li><a href="http://gmplib.org/">GNU GMP</a>
<li><a href="http://www.mpfr.org/">GNU MPFR</a>
<li><a href="http://www.cgal.org">CGAL</a>
<li><a href="http://eigen.tuxfamily.org">Eigen2</a>
<li><a href="http://www.opencsg.org">OpenCSG</a>
<li><a href="http://www.opengl.org/">OpenGL</a>
<li><a href="http://glew.sourceforge.net">GLEW</a>
<li><a href="http://qt.nokia.com">Qt Toolkit</a>
<li><a href="http://www.boost.org">Boost</a>
<li><a href="http://www.gnu.org/software/bison/">Bison</a>
<li><a href="http://flex.sourceforge.net/">Flex</a>
<li><a href="http://www.cmake.org">CMake</a>
<li><a href="http://www.mingw.org/">MingW</a>
<li><a href="http://lodev.org/lodepng/">LodePNG</a>
<li><a href="http://www.mxe.cc">MXE</a>
<li><a href="http://www.linux.org">Linux</a>
<li><a href="http://www.apple.com/osx/">Mac OSX</a>
<li><a href="http://www.stroustrup.com/C++.html">C++</a>, <a href="http://gcc.gnu.org/">GCC</a>, <a href="http://clang.llvm.org/">clang</a>
<li><a href="http://www.python.org">python</a>
<li><a href="http://nsis.sourceforge.net/Main_Page">Nullsoft installer</a>
</lu>
</p>
<p>
<b>Acknowledgements</b>
</p>
<p>
<b>OpenSCAD Github Project members (public)</b>
</p>
<lu>
<li><a href="https://github.com/kintel">Marius Kintel </a>
<li><a href="http://clifford.at">Clifford Wolf</a>
<li><a href="http://www.github.com/GilesBathgate">Giles Bathgate</a>
<li><a href="https://github.com/brad">Brad Pitcher</a>
<li><a href="https://github.com/donbright">Don Bright</a>
</lu>
<p>
<b><a href="http://www.debian.org">Debian</a> maintainer:</b>
<a href="http://christian.amsuess.com/">Christian M. Amsuess</a>
</p>
<p>
<b>Patches</b>
</p>
<lu>
<li><a href="https://github.com/meta23">meta23</a>
<li><a href="https://github.com/jasonblewis">jasonblewis</a>
<li><a href="https://github.com/gregjurman">gregjurman</a>
<li><a href="https://github.com/brianolson">brianolson</a>
<li><a href="https://github.com/tjhowse">tjhowse</a>
<li><a href="https://github.com/logxen">logxen</a>
<li><a href="https://github.com/iamwilhelm">iamwilhelm</a>
<li><a href="https://github.com/clothbot">clothbot</a>
<li><a href="https://github.com/colah">colah</a>
</lu>
<p>
<b>Mailing list, bug reports, testing, contribs, &c</b>
</p>
nop head, Triffid Hunter, Len Trigg, Kliment Yanev, Christian Siefkes,
Andrew Plumb, Whosawhatsis, MichaelAtOz, Tony Buser, mrhdias,
ibyte8bits, Koen Kooi, Tomas Mudrunka, knuds, cadr, mshearn, Hans L,
Brett Sutton, hmnapier, Eero af Heurlin, caliston, 5263, ghost, 42loop,
uniqx, Michael Thomson, Michael Ivko, Pierre Doucet, myglc2, Alan Cox,
Peter Falke, Michael Ambrus, Gordon Wrigley, Ed Nisley, Stony Smith,
Pasca Andrei, David Goodenough, William A Adams, mrrobinson, 1i7,
benhowes ... and many others
<p>
<b>Hosting &amp; resources</b>
</p>
<lu>
<li><a href="http://www.github.com">Github</a>
<li><a href="http://rocklinux.net/pipermail/openscad/">Rock Linux</a>
<li><a href="http://www.thingiverse.com">Thingiverse</a>
</lu>
<p>
<a href="http://guerby.org/">Laurent Guerby</a> and the
<a href="http://gcc.gnu.org/wiki/CompileFarm">GCC Compile Farm,</a> with
<a href="http://osuosl.org/">OSUOSL,</a> <a href="http://www.irill.org">IRILL,</a>
<a href="http://www.fsffrance.org">FSF France,</a> <a href="http://www.amd.com">AMD</a>,
<a href="http://www.intel.com">Intel</a>, <a href="http://www.ibm.com">IBM</a>, &c.
</p>
<p>
Apologies to anyone left out. Please file an issue on OpenSCAD's github if you know of someone who belongs here.
</p>
</body>
</html>

View File

@ -61,14 +61,16 @@ void CGALEvaluator::process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedr
if (target.dim != 2 && target.dim != 3) {
assert(false && "Dimension of Nef polyhedron must be 2 or 3");
}
if (src.empty()) return; // Empty polyhedron. This can happen for e.g. square([0,0])
if (src.isEmpty()) return; // Empty polyhedron. This can happen for e.g. square([0,0])
if (target.isEmpty() && op != CGE_UNION) return; // empty op <something> => empty
if (target.dim != src.dim) return; // If someone tries to e.g. union 2d and 3d objects
CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
try {
switch (op) {
case CGE_UNION:
target += src;
if (target.isEmpty()) target = src.copy();
else target += src;
break;
case CGE_INTERSECTION:
target *= src;
@ -110,7 +112,8 @@ CGAL_Nef_polyhedron CGALEvaluator::applyToChildren(const AbstractNode &node, CGA
if (!isCached(*chnode)) {
CGALCache::instance()->insert(this->tree.getIdString(*chnode), chN);
}
if (N.empty()) N = chN.copy();
// Initialize N on first iteration with first expected geometric object
if (N.isNull() && !N.isEmpty()) N = chN.copy();
else process(N, chN, op);
chnode->progress_report();
@ -130,6 +133,7 @@ CGAL_Nef_polyhedron CGALEvaluator::applyHull(const CgaladvNode &node)
const CGAL_Nef_polyhedron &chN = item.second;
// FIXME: Don't use deep access to modinst members
if (chnode->modinst->isBackground()) continue;
if (chN.dim == 0) continue; // Ignore object with dimension 0 (e.g. echo)
if (dim == 0) {
dim = chN.dim;
}
@ -244,7 +248,6 @@ Response CGALEvaluator::visit(State &state, const TransformNode &node)
if (!isCached(node)) {
// First union all children
N = applyToChildren(node, CGE_UNION);
if ( matrix_contains_infinity( node.matrix ) || matrix_contains_nan( node.matrix ) ) {
// due to the way parse/eval works we can't currently distinguish between NaN and Inf
PRINT("Warning: Transformation matrix contains Not-a-Number and/or Infinity - removing object.");
@ -252,51 +255,53 @@ Response CGALEvaluator::visit(State &state, const TransformNode &node)
}
// Then apply transform
// If there is no geometry under the transform, N will be empty and of dim 0,
// just just silently ignore such nodes
if (N.dim == 2) {
// Unfortunately CGAL provides no transform method for CGAL_Nef_polyhedron2
// 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!
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.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));
// If there is no geometry under the transform, N will be empty
// just silently ignore such nodes
if (!N.isNull()) {
if (N.dim == 2) {
// Unfortunately CGAL provides no transform method for CGAL_Nef_polyhedron2
// 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!
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.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) {
if (node.matrix.matrix().determinant() == 0) {
PRINT("Warning: Scaling a 3D object with 0 - removing object");
N.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 if (N.dim == 3) {
if (node.matrix.matrix().determinant() == 0) {
PRINT("Warning: Scaling a 3D object with 0 - removing object");
N.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);
}
}
}
}
@ -387,7 +392,7 @@ void CGALEvaluator::addToParent(const State &state, const AbstractNode &node, co
CGAL_Nef_polyhedron CGALEvaluator::evaluateCGALMesh(const PolySet &ps)
{
if (ps.empty()) return CGAL_Nef_polyhedron();
if (ps.empty()) return CGAL_Nef_polyhedron(ps.is2d ? 2 : 3);
if (ps.is2d)
{

View File

@ -43,7 +43,11 @@
CGALRenderer::CGALRenderer(const CGAL_Nef_polyhedron &root) : root(root)
{
if (root.dim == 2) {
if (this->root.isNull()) {
this->polyhedron = NULL;
this->polyset = NULL;
}
else if (root.dim == 2) {
DxfData *dd = root.convertToDxfData();
this->polyhedron = NULL;
this->polyset = new PolySet();
@ -67,10 +71,6 @@ CGALRenderer::CGALRenderer(const CGAL_Nef_polyhedron &root) : root(root)
CGAL::OGL::Nef3_Converter<CGAL_Nef_polyhedron3>::convert_to_OGLPolyhedron(*this->root.p3, this->polyhedron);
this->polyhedron->init();
}
else {
this->polyhedron = NULL;
this->polyset = NULL;
}
}
CGALRenderer::~CGALRenderer()
@ -81,6 +81,7 @@ CGALRenderer::~CGALRenderer()
void CGALRenderer::draw(bool showfaces, bool showedges) const
{
if (this->root.isNull()) return;
if (this->root.dim == 2) {
// Draw 2D polygons
glDisable(GL_LIGHTING);

View File

@ -61,7 +61,7 @@ CGAL_Nef_polyhedron &CGAL_Nef_polyhedron::minkowski(const CGAL_Nef_polyhedron &o
int CGAL_Nef_polyhedron::weight() const
{
if (this->empty()) return 0;
if (this->isNull()) return 0;
size_t memsize = sizeof(CGAL_Nef_polyhedron);
if (this->dim == 2) {
@ -84,8 +84,7 @@ int CGAL_Nef_polyhedron::weight() const
*/
PolySet *CGAL_Nef_polyhedron::convertToPolyset()
{
if (this->empty())
return new PolySet();
if (this->isNull()) return new PolySet();
PolySet *ps = NULL;
if (this->dim == 2) {
ps = new PolySet();

View File

@ -8,12 +8,15 @@
class CGAL_Nef_polyhedron
{
public:
CGAL_Nef_polyhedron() : dim(0) {}
CGAL_Nef_polyhedron(int dim = 0) : dim(dim) {}
CGAL_Nef_polyhedron(CGAL_Nef_polyhedron2 *p);
CGAL_Nef_polyhedron(CGAL_Nef_polyhedron3 *p);
~CGAL_Nef_polyhedron() {}
bool empty() const { return (dim == 0 || (!p2 && !p3)); }
// Empty means it is a geometric node which has zero area/volume
bool isEmpty() const { return (dim > 0 && !p2 && !p3); }
// Null means the node doesn't contain any geometry (for whatever reason)
bool isNull() const { return !p2 && !p3; }
void reset() { dim=0; p2.reset(); p3.reset(); }
CGAL_Nef_polyhedron &operator+=(const CGAL_Nef_polyhedron &other);
CGAL_Nef_polyhedron &operator*=(const CGAL_Nef_polyhedron &other);

View File

@ -217,7 +217,7 @@
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Help</string>
<string>&amp;Help</string>
</property>
<addaction name="helpActionAbout"/>
<addaction name="helpActionHomepage"/>

View File

@ -8,12 +8,12 @@ OpenCSGWarningDialog::OpenCSGWarningDialog(QWidget*)
connect(this->showBox, SIGNAL(toggled(bool)),
Preferences::inst()->openCSGWarningBox, SLOT(setChecked(bool)));
connect(this->showBox, SIGNAL(toggled(bool)),
Preferences::inst(), SLOT(openCSGWarningChanged(bool)));
Preferences::inst(), SLOT(on_openCSGWarningBox_toggled(bool)));
connect(this->enableOpenCSGBox, SIGNAL(toggled(bool)),
Preferences::inst()->enableOpenCSGBox, SLOT(setChecked(bool)));
connect(this->enableOpenCSGBox, SIGNAL(toggled(bool)),
Preferences::inst(), SLOT(enableOpenCSGChanged(bool)));
Preferences::inst(), SLOT(on_enableOpenCSGBox_toggled(bool)));
}
void OpenCSGWarningDialog::setText(const QString &text)

View File

@ -134,11 +134,11 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node)
if (v->modinst->isBackground()) continue;
CGAL_Nef_polyhedron N = this->cgalevaluator.evaluateCGALMesh(*v);
if (N.dim == 3) {
if (sum.empty()) sum = N.copy();
if (sum.isNull()) sum = N.copy();
else sum += N;
}
}
if (sum.empty()) return NULL;
if (sum.isNull()) return NULL;
if (!sum.p3->is_simple()) {
if (!node.cut_mode) {
PRINT("WARNING: Body of projection(cut = false) isn't valid 2-manifold! Modify your design..");
@ -149,7 +149,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node)
//std::cout << sum.dump();
//std::cout.flush();
CGAL_Nef_polyhedron nef_poly;
CGAL_Nef_polyhedron nef_poly(2);
if (node.cut_mode) {
CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
@ -180,7 +180,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node)
}
}
if ( sum.p3->is_empty() ) {
if (sum.p3->is_empty()) {
CGAL::set_error_behaviour(old_behaviour);
PRINT("WARNING: projection() failed.");
return NULL;
@ -204,7 +204,6 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node)
log << "<!-- volume end. -->\n";
}
nef_poly.p2 = zremover.output_nefpoly2d;
nef_poly.dim = 2;
} catch (const CGAL::Failure_exception &e) {
PRINTB("CGAL error in projection node while flattening: %s", e.what());
}
@ -284,8 +283,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node)
plist.push_back(p);
}
// FIXME: Should the CGAL_Nef_polyhedron2 be cached?
if (nef_poly.empty()) {
nef_poly.dim = 2;
if (nef_poly.isEmpty()) {
nef_poly.p2.reset(new CGAL_Nef_polyhedron2(plist.begin(), plist.end(), CGAL_Nef_polyhedron2::INCLUDED));
}
else {
@ -385,18 +383,18 @@ 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.empty()) {
if (!N.isNull()) {
if (N.dim != 2) {
PRINT("ERROR: linear_extrude() is not defined for 3D child objects!");
}
else {
if (sum.empty()) sum = N.copy();
if (sum.isNull()) sum = N.copy();
else sum += N;
}
}
}
if (sum.empty()) return NULL;
if (sum.isNull()) return NULL;
dxf = sum.convertToDxfData();;
} else {
dxf = new DxfData(node.fn, node.fs, node.fa, node.filename, node.layername, node.origin_x, node.origin_y, node.scale);
@ -485,18 +483,18 @@ 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.empty()) {
if (!N.isNull()) {
if (N.dim != 2) {
PRINT("ERROR: rotate_extrude() is not defined for 3D child objects!");
}
else {
if (sum.empty()) sum = N.copy();
if (sum.isNull()) sum = N.copy();
else sum += N;
}
}
}
if (sum.empty()) return NULL;
if (sum.isNull()) return NULL;
dxf = sum.convertToDxfData();
} else {
dxf = new DxfData(node.fn, node.fs, node.fa, node.filename, node.layername, node.origin_x, node.origin_y, node.scale);
@ -511,7 +509,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const CgaladvNode &node)
{
CGAL_Nef_polyhedron N = this->cgalevaluator.evaluateCGALMesh(node);
PolySet *ps = NULL;
if (!N.empty()) {
if (!N.isNull()) {
ps = N.convertToPolyset();
if (ps) ps->convexity = node.convexity;
}
@ -523,7 +521,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const RenderNode &node)
{
CGAL_Nef_polyhedron N = this->cgalevaluator.evaluateCGALMesh(node);
PolySet *ps = NULL;
if (!N.empty()) {
if (!N.isNull()) {
if (N.dim == 3 && !N.p3->is_simple()) {
PRINT("WARNING: Body of render() isn't valid 2-manifold!");
}

View File

@ -1,6 +1,6 @@
// boosty.h copyright 2012 don bright. released under the GPL 2, or later,
// as described in the file named 'COPYING' in OpenSCAD's project root.
// permission is given to Marius Kintel & Clifford Wolf to change this license.
// boosty.h by don bright 2012. Copyright assigned to Marius Kintel and
// Clifford Wolf 2012. Released under the GPL 2, or later, as described in
// the file named 'COPYING' in OpenSCAD's project root.
#ifndef boosty_h_
#define boosty_h_

View File

@ -588,7 +588,9 @@ void MainWindow::refreshDocument()
this->fileName.toStdString() % file.errorString().toStdString());
}
else {
QString text = QTextStream(&file).readAll();
QTextStream reader(&file);
reader.setCodec("UTF-8");
QString text = reader.readAll();
PRINTB("Loaded design '%s'.", this->fileName.toStdString());
editor->setPlainText(text);
}
@ -900,7 +902,9 @@ void MainWindow::actionSave()
PRINTB("Failed to open file for writing: %s (%s)", this->fileName.toStdString() % file.errorString().toStdString());
}
else {
QTextStream(&file) << this->editor->toPlainText();
QTextStream writer(&file);
writer.setCodec("UTF-8");
writer << this->editor->toPlainText();
PRINTB("Saved design '%s'.", this->fileName.toStdString());
this->editor->setContentModified(false);
}
@ -1232,35 +1236,37 @@ void MainWindow::actionRenderCGALDone(CGAL_Nef_polyhedron *root_N)
PolySetCache::instance()->print();
CGALCache::instance()->print();
if (root_N->dim == 2) {
PRINT(" Top level object is a 2D object:");
PRINTB(" Empty: %6s", (root_N->p2->is_empty() ? "yes" : "no"));
PRINTB(" Plane: %6s", (root_N->p2->is_plane() ? "yes" : "no"));
PRINTB(" Vertices: %6d", root_N->p2->explorer().number_of_vertices());
PRINTB(" Halfedges: %6d", root_N->p2->explorer().number_of_halfedges());
PRINTB(" Edges: %6d", root_N->p2->explorer().number_of_edges());
PRINTB(" Faces: %6d", root_N->p2->explorer().number_of_faces());
PRINTB(" FaceCycles: %6d", root_N->p2->explorer().number_of_face_cycles());
PRINTB(" ConnComp: %6d", root_N->p2->explorer().number_of_connected_components());
}
if (root_N->dim == 3) {
PRINT(" Top level object is a 3D object:");
PRINTB(" Simple: %6s", (root_N->p3->is_simple() ? "yes" : "no"));
PRINTB(" Valid: %6s", (root_N->p3->is_valid() ? "yes" : "no"));
PRINTB(" Vertices: %6d", root_N->p3->number_of_vertices());
PRINTB(" Halfedges: %6d", root_N->p3->number_of_halfedges());
PRINTB(" Edges: %6d", root_N->p3->number_of_edges());
PRINTB(" Halffacets: %6d", root_N->p3->number_of_halffacets());
PRINTB(" Facets: %6d", root_N->p3->number_of_facets());
PRINTB(" Volumes: %6d", root_N->p3->number_of_volumes());
if (!root_N->isNull()) {
if (root_N->dim == 2) {
PRINT(" Top level object is a 2D object:");
PRINTB(" Empty: %6s", (root_N->p2->is_empty() ? "yes" : "no"));
PRINTB(" Plane: %6s", (root_N->p2->is_plane() ? "yes" : "no"));
PRINTB(" Vertices: %6d", root_N->p2->explorer().number_of_vertices());
PRINTB(" Halfedges: %6d", root_N->p2->explorer().number_of_halfedges());
PRINTB(" Edges: %6d", root_N->p2->explorer().number_of_edges());
PRINTB(" Faces: %6d", root_N->p2->explorer().number_of_faces());
PRINTB(" FaceCycles: %6d", root_N->p2->explorer().number_of_face_cycles());
PRINTB(" ConnComp: %6d", root_N->p2->explorer().number_of_connected_components());
}
if (root_N->dim == 3) {
PRINT(" Top level object is a 3D object:");
PRINTB(" Simple: %6s", (root_N->p3->is_simple() ? "yes" : "no"));
PRINTB(" Valid: %6s", (root_N->p3->is_valid() ? "yes" : "no"));
PRINTB(" Vertices: %6d", root_N->p3->number_of_vertices());
PRINTB(" Halfedges: %6d", root_N->p3->number_of_halfedges());
PRINTB(" Edges: %6d", root_N->p3->number_of_edges());
PRINTB(" Halffacets: %6d", root_N->p3->number_of_halffacets());
PRINTB(" Facets: %6d", root_N->p3->number_of_facets());
PRINTB(" Volumes: %6d", root_N->p3->number_of_volumes());
}
}
int s = this->progresswidget->elapsedTime() / 1000;
PRINTB("Total rendering time: %d hours, %d minutes, %d seconds", (s / (60*60)) % ((s / 60) % 60) % (s % 60));
this->root_N = root_N;
if (!this->root_N->empty()) {
if (!this->root_N->isNull()) {
this->cgalRenderer = new CGALRenderer(*this->root_N);
// Go to CGAL view mode
if (viewActionCGALGrid->isChecked()) {

View File

@ -304,8 +304,19 @@ int main(int argc, char **argv)
fs::current_path(original_path);
if (deps_output_file) {
if (!write_deps(deps_output_file,
stl_output_file ? stl_output_file : off_output_file)) {
std::string deps_out( deps_output_file );
std::string geom_out;
if ( stl_output_file ) geom_out = std::string(stl_output_file);
else if ( off_output_file ) geom_out = std::string(off_output_file);
else if ( dxf_output_file ) geom_out = std::string(dxf_output_file);
else {
PRINTB("Output file:%s\n",output_file);
PRINT("Sorry, don't know how to write deps for that file type. Exiting\n");
exit(1);
}
int result = write_deps( deps_out, geom_out );
if ( !result ) {
PRINT("error writing deps");
exit(1);
}
}

View File

@ -157,7 +157,8 @@ void PolySet::render_surface(csgmode_e csgmode, const Transform3d &m, GLint *sha
}
#endif /* ENABLE_OPENCSG */
if (this->is2d) {
double zbase = csgmode;
// Render 2D objects 1mm thick, but differences slightly larger
double zbase = 1 + (csgmode & CSGMODE_DIFFERENCE_FLAG) * 0.1;
glBegin(GL_TRIANGLES);
for (double z = -zbase/2; z < zbase; z += zbase)
{
@ -248,7 +249,8 @@ void PolySet::render_edges(csgmode_e csgmode) const
{
glDisable(GL_LIGHTING);
if (this->is2d) {
double zbase = csgmode;
// Render 2D objects 1mm thick, but differences slightly larger
double zbase = 1 + (csgmode & CSGMODE_DIFFERENCE_FLAG) * 0.1;
for (double z = -zbase/2; z < zbase; z += zbase)
{
for (size_t i = 0; i < borders.size(); i++) {

View File

@ -29,14 +29,15 @@ public:
BoundingBox getBoundingBox() const;
#define CSGMODE_DIFFERENCE_FLAG 0x10
enum csgmode_e {
CSGMODE_NONE,
CSGMODE_NORMAL = 1,
CSGMODE_DIFFERENCE = 2,
CSGMODE_BACKGROUND = 11,
CSGMODE_BACKGROUND_DIFFERENCE = 12,
CSGMODE_HIGHLIGHT = 21,
CSGMODE_HIGHLIGHT_DIFFERENCE = 22
CSGMODE_NONE = 0x00,
CSGMODE_NORMAL = 0x01,
CSGMODE_DIFFERENCE = CSGMODE_NORMAL | CSGMODE_DIFFERENCE_FLAG,
CSGMODE_BACKGROUND = 0x02,
CSGMODE_BACKGROUND_DIFFERENCE = CSGMODE_BACKGROUND | CSGMODE_DIFFERENCE_FLAG,
CSGMODE_HIGHLIGHT = 0x03,
CSGMODE_HIGHLIGHT_DIFFERENCE = CSGMODE_HIGHLIGHT | CSGMODE_DIFFERENCE_FLAG
};
void render_surface(csgmode_e csgmode, const Transform3d &m, GLint *shaderinfo = NULL) const;

View File

@ -1,12 +1,12 @@
// version_check.h copyright 2012 don bright. released under the GPL 2, or
// later, as described in the file named 'COPYING' in OpenSCAD's project root.
// permission to change this license is given to Marius Kintel & Clifford Wolf
// version_check.h by don bright 2012. Copyright assigned to Marius Kintel and
// Clifford Wolf 2012. Released under the GPL 2, or later, as described in
// the file named 'COPYING' in OpenSCAD's project root.
/* This file will check versions of libraries at compile time. If they
are too old, the user will be warned. If the user wishes to force
compilation, they can run
qmake CONFIG=skip-version-check
qmake CONFIG+=skip-version-check
Otherwise they will be guided to README.md and an -build-dependencies script.
@ -66,6 +66,9 @@ a time, to avoid confusion.
#warning "."
#warning "."
#warning "======================="
#ifdef __clang__
#error For Clang to work, CGAL must be >= 4.0.2
#endif
#endif // CGAL_VERSION_NR < 10400010000
#endif //ENABLE_CGAL

View File

@ -0,0 +1,4 @@
hull() {
circle(1);
echo(1);
}

View File

@ -29,6 +29,7 @@ translate([24,0,0]) difference() {
translate([0,0,6.99]) cylinder(r=4, h=4, center=true);
}
// Subtracting something from nothing
translate([24,12,0]) difference() {
cube([0,10,10], center=true);
# cylinder(r=4, h=20, center=true);

View File

@ -773,7 +773,6 @@ set_test_config(Heavy opencsgtest_minkowski3-tests
cgalpngtest_minkowski3-tests
cgalpngtest_for-tests
cgalpngtest_for-nested-tests
cgalpngtest_difference-tests
cgalpngtest_intersection-tests)
foreach(FILE ${EXAMPLE_FILES})

View File

@ -153,30 +153,30 @@ int main(int argc, char **argv)
exit(1);
}
CGALRenderer cgalRenderer(N);
CGALRenderer cgalRenderer(N);
BoundingBox bbox;
if (cgalRenderer.polyhedron) {
CGAL::Bbox_3 cgalbbox = cgalRenderer.polyhedron->bbox();
bbox = BoundingBox(Vector3d(cgalbbox.xmin(), cgalbbox.ymin(), cgalbbox.zmin()),
Vector3d(cgalbbox.xmax(), cgalbbox.ymax(), cgalbbox.zmax()));
Vector3d(cgalbbox.xmax(), cgalbbox.ymax(), cgalbbox.zmax()));
}
else if (cgalRenderer.polyset) {
bbox = cgalRenderer.polyset->getBoundingBox();
}
Vector3d center = getBoundingCenter(bbox);
double radius = getBoundingRadius(bbox);
Vector3d cameradir(1, 1, -0.5);
Vector3d camerapos = center - radius*2*cameradir;
csgInfo.glview->setCamera(camerapos, center);
csgInfo.glview->setRenderer(&cgalRenderer);
csgInfo.glview->paintGL();
csgInfo.glview->save(outfile);
delete root_node;
delete root_module;

View File

@ -129,7 +129,7 @@ int main(int argc, char **argv)
CGAL_Nef_polyhedron N = cgalevaluator.evaluateCGALMesh(*root_node);
current_path(original_path);
if (!N.empty()) {
if (!N.isNull()) {
std::ofstream outfile;
outfile.open(outfilename);

View File

@ -122,7 +122,7 @@ int main(int argc, char **argv)
CGAL_Nef_polyhedron N = cgalevaluator.evaluateCGALMesh(*root_node);
current_path(original_path);
if (!N.empty()) {
if (!N.isNull()) {
export_stl(&N, std::cout);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -0,0 +1,5 @@
hull() {
circle($fn = 0, $fa = 12, $fs = 2, r = 1);
group();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -1,8 +1,8 @@
#!/usr/bin/python
# test_pretty_print copyright 2012 don bright. released under the GPL 2, or
# later, as described in the file named 'COPYING' in OpenSCAD's project root.
# permission to change this license is given to Marius Kintel & Clifford Wolf
# test_pretty_print by don bright 2012. Copyright assigned to Marius Kintel and
# Clifford Wolf 2012. Released under the GPL 2, or later, as described in
# the file named 'COPYING' in OpenSCAD's project root.
#
# This program 'pretty prints' the ctest output, namely