diff options
author | Don Bright <hugh.m.bright@gmail.com> | 2013-11-30 21:30:40 (GMT) |
---|---|---|
committer | Don Bright <hugh.m.bright@gmail.com> | 2013-11-30 21:30:40 (GMT) |
commit | 75692592e49da1af2b1c8857298ca7085cd5b3d5 (patch) | |
tree | 33e5ee1aae1b9eb4514d735f00281a21f17325a0 | |
parent | fd715c6526e961cb7f3d6ba6a0563788d7d1674d (diff) | |
parent | f175bae46a8f15823780c5a9c89b11476acb3107 (diff) |
Merge branch 'master' into issue410x
26 files changed, 212 insertions, 64 deletions
diff --git a/scripts/builder.sh b/scripts/builder.sh index 552d559..ca7e5b2 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -1,11 +1,41 @@ #!/usr/bin/env bash # build&upload script for linux & windows snapshot binaries -# tested under linux +# +# Usage: +# +# Start with a clean directory. For example: +# +# mkdir builder +# cd builder +# +# Then run this script, or optionally the 'build only' or 'upload only' version +# +# /some/path/openscad/builder.sh # standard build & upload +# /some/path/openscad/builder.sh buildonly # only do build, dont upload +# /some/path/openscad/builder.sh uploadonly # only upload, dont build +# Notes: +# +# This script is designed to build a 'clean' version of openscad directly +# from the openscad github master source code. It will then optionally +# upload the build to the OpenSCAD official file repository, and modify +# the OpenSCAD website with links to the most recently built files. +# +# +# For the mingw- cross build for Windows(TM) this script does a massive +# 'from nothing' build, including downloading and building an MXE cross +# environment, and dependencies, into $HOME/openscad_deps. This can take +# many many many hours and use several gigabytes of disk space. +# +# This script itself is designed to call other scripts that do the heavy +# lifting. This script itself should be kept relatively simple. +# + +# # requirements - # see http://mxe.cc for required tools (scons, perl, yasm, etc etc etc) - +# # todo - can we build 32 bit linux from within 64 bit linux? # # todo - make linux work @@ -19,18 +49,24 @@ init_variables() { STARTPATH=$PWD export STARTPATH + DOBUILD=1 + DOUPLOAD=1 + DRYRUN= if [ "`echo $* | grep uploadonly`" ]; then - UPLOADONLY=1 + DOUPLOAD=1 + DOBUILD= + DATECODE=`date +"%Y.%m.%d"` + fi + if [ "`echo $* | grep buildonly`" ]; then + DOUPLOAD= + DOBUILD=1 DATECODE=`date +"%Y.%m.%d"` - else - UPLOADONLY= fi if [ "`echo $* | grep dry`" ]; then DRYRUN=1 - else - DRYRUN= fi - export UPLOADONLY + export DOBUILD + export DOUPLOAD export DRYRUN export DATECODE } @@ -43,9 +79,15 @@ check_starting_path() fi } -get_source_code() +get_openscad_source_code() { git clone http://github.com/openscad/openscad.git + if [ "`echo $? | grep 0`" ]; then + echo clone of source code is ok + else + echo clone of openscad source code failed. exiting + exit 1 + fi cd openscad git submodule update --init # MCAD #git checkout branch ##debugging @@ -80,7 +122,7 @@ build_lin32() export DATECODE } -upload_win_generic() +upload_win_common() { summary="$1" username=$2 @@ -110,8 +152,8 @@ upload_win32() BASEDIR=./mingw32/ WIN32_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-32-Installer.exe WIN32_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-32.zip - upload_win_generic "$SUMMARY1" $USERNAME $BASEDIR/$WIN32_PACKAGEFILE1 - upload_win_generic "$SUMMARY2" $USERNAME $BASEDIR/$WIN32_PACKAGEFILE2 + upload_win_common "$SUMMARY1" $USERNAME $BASEDIR/$WIN32_PACKAGEFILE1 + upload_win_common "$SUMMARY2" $USERNAME $BASEDIR/$WIN32_PACKAGEFILE2 export WIN32_PACKAGEFILE1 export WIN32_PACKAGEFILE2 WIN32_PACKAGEFILE1_SIZE=`ls -sh $BASEDIR/$WIN32_PACKAGEFILE1 | awk ' {print $1} ';` @@ -129,8 +171,8 @@ upload_win64() BASEDIR=./mingw64/ WIN64_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-64-Installer.exe WIN64_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-64.zip - upload_win_generic "$SUMMARY1" $USERNAME $BASEDIR/$WIN64_PACKAGEFILE1 - upload_win_generic "$SUMMARY2" $USERNAME $BASEDIR/$WIN64_PACKAGEFILE2 + upload_win_common "$SUMMARY1" $USERNAME $BASEDIR/$WIN64_PACKAGEFILE1 + upload_win_common "$SUMMARY2" $USERNAME $BASEDIR/$WIN64_PACKAGEFILE2 export WIN64_PACKAGEFILE1 export WIN64_PACKAGEFILE2 WIN64_PACKAGEFILE1_SIZE=`ls -sh $BASEDIR/$WIN64_PACKAGEFILE1 | awk ' {print $1} ';` @@ -188,6 +230,7 @@ update_win_www_download_links() BASEURL='http://files.openscad.org/' DATECODE=`date +"%Y.%m.%d"` + mv win_snapshot_links.js win_snapshot_links.js.backup rm win_snapshot_links.js echo "fileinfo['WIN64_SNAPSHOT1_URL'] = '$BASEURL$WIN64_PACKAGEFILE1'" >> win_snapshot_links.js echo "fileinfo['WIN64_SNAPSHOT2_URL'] = '$BASEURL$WIN64_PACKAGEFILE2'" >> win_snapshot_links.js @@ -229,19 +272,20 @@ check_ssh_agent() } init_variables $* -check_ssh_agent +if [ $DOUPLOAD ]; then + check_ssh_agent +fi check_starting_path read_username_from_user read_password_from_user -get_source_code - -if [ ! $UPLOADONLY ]; then +get_openscad_source_code +if [ $DOBUILD ]; then build_win32 build_win64 fi -upload_win32 -upload_win64 -update_win_www_download_links - - +if [ $DOUPLOAD ]; then + upload_win32 + upload_win64 + update_win_www_download_links +fi diff --git a/scripts/mingw-x-build-dependencies.sh b/scripts/mingw-x-build-dependencies.sh index df8572f..c0f658d 100755 --- a/scripts/mingw-x-build-dependencies.sh +++ b/scripts/mingw-x-build-dependencies.sh @@ -6,8 +6,13 @@ # This script must be run from the OpenSCAD source root directory # # Usage: -# ./scripts/mingw-x-build-dependencies.sh # 32 bit -# ./scripts/mingw-x-build-dependencies.sh 64 # 64 bit +# ./scripts/mingw-x-build-dependencies.sh # 32 bit +# ./scripts/mingw-x-build-dependencies.sh 64 # 64 bit +# +# If you just want to download, and build later: +# +# ./scripts/mingw-x-build-dependencies.sh download # 32 bit download +# ./scripts/mingw-x-build-dependencies.sh 64 download # 64 bit download # # Prerequisites: # @@ -54,11 +59,19 @@ fi echo "entering" $MXEDIR cd $MXEDIR if [ "`echo $* | grep 64`" ]; then - MXE_TARGETS='x86_64-w64-mingw32' + MXE_TARGETS='x86_64-w64-mingw32' + if [ "`echo $* | grep download`" ]; then + PACKAGES='download-mpfr download-eigen download-opencsg download-cgal download-qt' + else PACKAGES='mpfr eigen opencsg cgal qt' + fi else - MXE_TARGETS= + MXE_TARGETS='i686-pc-mingw32' # fixme - does this work? test it. + if [ "`echo $* | grep download`" ]; then + PACKAGES='download-mpfr download-eigen download-opencsg download-cgal download-qt download-nsis' + else PACKAGES='mpfr eigen opencsg cgal qt nsis' + fi fi echo make $PACKAGES MXE_TARGETS=$MXE_TARGETS -j $NUMCPU JOBS=$NUMJOBS make $PACKAGES MXE_TARGETS=$MXE_TARGETS -j $NUMCPU JOBS=$NUMJOBS diff --git a/src/editor.cc b/src/editor.cc index 08bf005..069101f 100644 --- a/src/editor.cc +++ b/src/editor.cc @@ -108,3 +108,17 @@ void Editor::wheelEvent ( QWheelEvent * event ) } } +void Editor::setPlainText(const QString &text) +{ + int y = verticalScrollBar()->sliderPosition(); + // Save current cursor position + QTextCursor cursor = textCursor(); + int n = cursor.position(); + QTextEdit::setPlainText(text); + // Restore cursor position + if (n < text.length()) { + cursor.setPosition(n); + setTextCursor(cursor); + verticalScrollBar()->setSliderPosition(y); + } +} diff --git a/src/editor.h b/src/editor.h index 09484f5..8d092a9 100644 --- a/src/editor.h +++ b/src/editor.h @@ -2,6 +2,7 @@ #include <QString> #include <QWidget> #include <QWheelEvent> +#include <QScrollBar> #include <QTextEdit> class Editor : public QTextEdit @@ -9,6 +10,7 @@ class Editor : public QTextEdit Q_OBJECT public: Editor(QWidget *parent) : QTextEdit(parent) { setAcceptRichText(false); } + void setPlainText(const QString &text); public slots: void zoomIn(); void zoomOut(); diff --git a/src/mainwin.cc b/src/mainwin.cc index 5b986b1..1ad8bc8 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -504,6 +504,7 @@ MainWindow::openFile(const QString &new_filename) } #endif setFileName(actual_filename); + editor->setPlainText(""); fileChangedOnDisk(); // force cached autoReloadId to update refreshDocument(); diff --git a/src/version_check.h b/src/version_check.h index 86e769c..fbea077 100644 --- a/src/version_check.h +++ b/src/version_check.h @@ -108,5 +108,13 @@ a time, to avoid confusion. #endif // MPFR #endif // GMP +// see github issue #552 +#define GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) +#if GCC_VERSION == 40802 +#error OpenSCAD isn't compatible with gcc 4.8.2. Please try a different version +#endif + #endif // OPENSCAD_SKIP_VERSION_CHECK diff --git a/testdata/scad/features/polygon-tests.scad b/testdata/scad/features/polygon-tests.scad index b4e92b6..0cd259f 100644 --- a/testdata/scad/features/polygon-tests.scad +++ b/testdata/scad/features/polygon-tests.scad @@ -15,4 +15,10 @@ translate([-2,0,0]) polygon(points); translate([-2,-2,0]) polygon(points=points, paths=[[0,1,2,3], [4,5,6,7]]); translate([2,-4,0]) polygon([[0,0], [1,0], [1,1], [0,0]]); +// With hole +translate([-2,-4,0]) + polygon(points=[[0,0], [1,0], [1,1], [0,1], [0.2,0.2], [0.8,0.2], [0.8,0.8], [0.2,0.8]], + paths=[[0,1,2,3],[4,5,6,7]] +); + // FIXME: convexity diff --git a/testdata/scad/features/projection-cut-tests.scad b/testdata/scad/features/projection-cut-tests.scad new file mode 100644 index 0000000..0409a3e --- /dev/null +++ b/testdata/scad/features/projection-cut-tests.scad @@ -0,0 +1,15 @@ +// 2D child +projection(cut=true) { square(); } + +projection(cut=true) translate([20,0,0]) cube(10, center=true); + +// Boundary case: clipping the top of a cube +translate([0,20,0]) projection(cut=true) translate([0,0,-4.999999]) cube(10, center=true); + +// holes +translate([0,-10,0]) projection(cut=true) { + union() { + difference() { cube(5,center=true); cube(4,center=true); } + translate([2.1,2.1]) difference() { cube(5,center=true); cube(4,center=true); } + } +} diff --git a/testdata/scad/features/projection-tests.scad b/testdata/scad/features/projection-tests.scad index bc2111c..27d03fe 100644 --- a/testdata/scad/features/projection-tests.scad +++ b/testdata/scad/features/projection-tests.scad @@ -3,17 +3,25 @@ projection(); // No children projection() { } // 2D child -projection(cut=true) { square(); } +projection() { square(); } +// Simple projection(cut=false) cube(10); -projection(cut=true) translate([20,0,0]) cube(10, center=true); -// Boundary case: clipping the top of a cube -translate([0,20,0]) projection(cut=true) translate([0,0,-4.999999]) cube(10, center=true); -// holes -translate([0,-10,0]) projection(cut=true) { - union() { - difference() { cube(5,center=true); cube(4,center=true); } - translate([2.1,2.1]) difference() { cube(5,center=true); cube(4,center=true); } - } +// Two children +translate([-12,0]) projection(cut=false) { + cube(10); + difference() { + sphere(10); + cylinder(h=30, r=5, center=true); + } +} + +// Holes +translate([6,-12]) projection(cut=false) { + cube(10); + difference() { + sphere(10); + cylinder(h=30, r=5, center=true); + } } diff --git a/testdata/scad/features/render-2d-tests.scad b/testdata/scad/features/render-2d-tests.scad index 683ffe4..f8df115 100644 --- a/testdata/scad/features/render-2d-tests.scad +++ b/testdata/scad/features/render-2d-tests.scad @@ -1,6 +1,11 @@ render() { difference() { - square(100, center=true); - circle(r=30); + square(10, center=true); + circle(r=3); } } + +translate([12,0,0]) render() { + square(10, center=true); + circle(r=3); +} diff --git a/tests/regression/cgalpngtest/polygon-tests-expected.png b/tests/regression/cgalpngtest/polygon-tests-expected.png Binary files differindex 5ceabe8..28e4e9f 100644 --- a/tests/regression/cgalpngtest/polygon-tests-expected.png +++ b/tests/regression/cgalpngtest/polygon-tests-expected.png diff --git a/tests/regression/cgalpngtest/projection-cut-tests-expected.png b/tests/regression/cgalpngtest/projection-cut-tests-expected.png Binary files differnew file mode 100644 index 0000000..7189447 --- /dev/null +++ b/tests/regression/cgalpngtest/projection-cut-tests-expected.png diff --git a/tests/regression/cgalpngtest/projection-tests-expected.png b/tests/regression/cgalpngtest/projection-tests-expected.png Binary files differindex 3be3654..c0d5289 100644 --- a/tests/regression/cgalpngtest/projection-tests-expected.png +++ b/tests/regression/cgalpngtest/projection-tests-expected.png diff --git a/tests/regression/cgalpngtest/render-2d-tests-expected.png b/tests/regression/cgalpngtest/render-2d-tests-expected.png Binary files differindex 19ea16a..2418968 100644 --- a/tests/regression/cgalpngtest/render-2d-tests-expected.png +++ b/tests/regression/cgalpngtest/render-2d-tests-expected.png diff --git a/tests/regression/dumptest/polygon-tests-expected.csg b/tests/regression/dumptest/polygon-tests-expected.csg index 56995a5..e19bcb0 100644 --- a/tests/regression/dumptest/polygon-tests-expected.csg +++ b/tests/regression/dumptest/polygon-tests-expected.csg @@ -33,4 +33,7 @@ group() { multmatrix([[1, 0, 0, 2], [0, 1, 0, -4], [0, 0, 1, 0], [0, 0, 0, 1]]) { polygon(points = [[0, 0], [1, 0], [1, 1], [0, 0]], paths = undef, convexity = 1); } + multmatrix([[1, 0, 0, -2], [0, 1, 0, -4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[0, 0], [1, 0], [1, 1], [0, 1], [0.2, 0.2], [0.8, 0.2], [0.8, 0.8], [0.2, 0.8]], paths = [[0, 1, 2, 3], [4, 5, 6, 7]], convexity = 1); + } } diff --git a/tests/regression/dumptest/projection-cut-tests-expected.csg b/tests/regression/dumptest/projection-cut-tests-expected.csg new file mode 100644 index 0000000..4c37fa2 --- /dev/null +++ b/tests/regression/dumptest/projection-cut-tests-expected.csg @@ -0,0 +1,33 @@ +group() { + projection(cut = true, convexity = 0) { + square(size = [1, 1], center = false); + } + projection(cut = true, convexity = 0) { + multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [10, 10, 10], center = true); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) { + projection(cut = true, convexity = 0) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -4.999999], [0, 0, 0, 1]]) { + cube(size = [10, 10, 10], center = true); + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + projection(cut = true, convexity = 0) { + union() { + difference() { + cube(size = [5, 5, 5], center = true); + cube(size = [4, 4, 4], center = true); + } + multmatrix([[1, 0, 0, 2.1], [0, 1, 0, 2.1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + difference() { + cube(size = [5, 5, 5], center = true); + cube(size = [4, 4, 4], center = true); + } + } + } + } + } +} diff --git a/tests/regression/dumptest/projection-tests-expected.csg b/tests/regression/dumptest/projection-tests-expected.csg index da3e5ce..04cd404 100644 --- a/tests/regression/dumptest/projection-tests-expected.csg +++ b/tests/regression/dumptest/projection-tests-expected.csg @@ -1,37 +1,27 @@ group() { projection(cut = false, convexity = 0); projection(cut = false, convexity = 0); - projection(cut = true, convexity = 0) { + projection(cut = false, convexity = 0) { square(size = [1, 1], center = false); } projection(cut = false, convexity = 0) { cube(size = [10, 10, 10], center = false); } - projection(cut = true, convexity = 0) { - multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { - cube(size = [10, 10, 10], center = true); - } - } - multmatrix([[1, 0, 0, 0], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) { - projection(cut = true, convexity = 0) { - multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -4.999999], [0, 0, 0, 1]]) { - cube(size = [10, 10, 10], center = true); + multmatrix([[1, 0, 0, -12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + projection(cut = false, convexity = 0) { + cube(size = [10, 10, 10], center = false); + difference() { + sphere($fn = 0, $fa = 12, $fs = 2, r = 10); + cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 5, r2 = 5, center = true); } } } - multmatrix([[1, 0, 0, 0], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { - projection(cut = true, convexity = 0) { - union() { - difference() { - cube(size = [5, 5, 5], center = true); - cube(size = [4, 4, 4], center = true); - } - multmatrix([[1, 0, 0, 2.1], [0, 1, 0, 2.1], [0, 0, 1, 0], [0, 0, 0, 1]]) { - difference() { - cube(size = [5, 5, 5], center = true); - cube(size = [4, 4, 4], center = true); - } - } + multmatrix([[1, 0, 0, 6], [0, 1, 0, -12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + projection(cut = false, convexity = 0) { + cube(size = [10, 10, 10], center = false); + difference() { + sphere($fn = 0, $fa = 12, $fs = 2, r = 10); + cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 5, r2 = 5, center = true); } } } diff --git a/tests/regression/dumptest/render-2d-tests-expected.csg b/tests/regression/dumptest/render-2d-tests-expected.csg index 75739b3..bcc5e96 100644 --- a/tests/regression/dumptest/render-2d-tests-expected.csg +++ b/tests/regression/dumptest/render-2d-tests-expected.csg @@ -1,8 +1,14 @@ group() { render(convexity = 1) { difference() { - square(size = [100, 100], center = true); - circle($fn = 0, $fa = 12, $fs = 2, r = 30); + square(size = [10, 10], center = true); + circle($fn = 0, $fa = 12, $fs = 2, r = 3); + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + render(convexity = 1) { + square(size = [10, 10], center = true); + circle($fn = 0, $fa = 12, $fs = 2, r = 3); } } } diff --git a/tests/regression/opencsgtest/polygon-tests-expected.png b/tests/regression/opencsgtest/polygon-tests-expected.png Binary files differindex fe84a80..94bd131 100644 --- a/tests/regression/opencsgtest/polygon-tests-expected.png +++ b/tests/regression/opencsgtest/polygon-tests-expected.png diff --git a/tests/regression/opencsgtest/projection-cut-tests-expected.png b/tests/regression/opencsgtest/projection-cut-tests-expected.png Binary files differnew file mode 100644 index 0000000..5063301 --- /dev/null +++ b/tests/regression/opencsgtest/projection-cut-tests-expected.png diff --git a/tests/regression/opencsgtest/projection-tests-expected.png b/tests/regression/opencsgtest/projection-tests-expected.png Binary files differindex b808ffe..b3af1e1 100644 --- a/tests/regression/opencsgtest/projection-tests-expected.png +++ b/tests/regression/opencsgtest/projection-tests-expected.png diff --git a/tests/regression/opencsgtest/render-2d-tests-expected.png b/tests/regression/opencsgtest/render-2d-tests-expected.png Binary files differindex 0bf6288..47e57dd 100644 --- a/tests/regression/opencsgtest/render-2d-tests-expected.png +++ b/tests/regression/opencsgtest/render-2d-tests-expected.png diff --git a/tests/regression/throwntogethertest/polygon-tests-expected.png b/tests/regression/throwntogethertest/polygon-tests-expected.png Binary files differindex 779b878..2ce6b75 100644 --- a/tests/regression/throwntogethertest/polygon-tests-expected.png +++ b/tests/regression/throwntogethertest/polygon-tests-expected.png diff --git a/tests/regression/throwntogethertest/projection-cut-tests-expected.png b/tests/regression/throwntogethertest/projection-cut-tests-expected.png Binary files differnew file mode 100644 index 0000000..5063301 --- /dev/null +++ b/tests/regression/throwntogethertest/projection-cut-tests-expected.png diff --git a/tests/regression/throwntogethertest/projection-tests-expected.png b/tests/regression/throwntogethertest/projection-tests-expected.png Binary files differindex b808ffe..b3af1e1 100644 --- a/tests/regression/throwntogethertest/projection-tests-expected.png +++ b/tests/regression/throwntogethertest/projection-tests-expected.png diff --git a/tests/regression/throwntogethertest/render-2d-tests-expected.png b/tests/regression/throwntogethertest/render-2d-tests-expected.png Binary files differindex 0bf6288..47e57dd 100644 --- a/tests/regression/throwntogethertest/render-2d-tests-expected.png +++ b/tests/regression/throwntogethertest/render-2d-tests-expected.png |