summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2013-01-31 02:58:34 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2013-01-31 02:58:34 (GMT)
commit997a0afac3f9b3a7aa2c4a8d351c3697bc91f7aa (patch)
tree3b3816d1557746f5f2e3e86a9239821472012024
parentd0de384a7e1642d09726579fdd75f1588cfaada7 (diff)
parentaf0658a8fe441ebb0eb3d238e7055fd592343605 (diff)
Merge branch 'master' and fix bugs
Conflicts: src/openscad.cc tests/CMakeLists.txt
-rw-r--r--doc/TODO.txt7
-rw-r--r--doc/release-checklist.txt4
-rw-r--r--openscad.pro5
-rwxr-xr-xscripts/check-dependencies.sh2
-rw-r--r--scripts/installer.nsi1
-rwxr-xr-xscripts/release-common.sh9
-rwxr-xr-xscripts/uni-build-dependencies.sh20
-rw-r--r--setenv_mjau.sh2
-rw-r--r--src/AboutDialog.html2
-rw-r--r--src/Preferences.cc8
-rw-r--r--src/dxftess-cgal.cc10
-rw-r--r--src/func.cc8
-rw-r--r--src/import.cc17
-rw-r--r--src/mainwin.cc17
-rw-r--r--src/openscad.cc6
-rw-r--r--src/svg.cc3
-rw-r--r--src/winconsole.c84
-rw-r--r--testdata/scad/features/import_bin_solid.stlbin0 -> 2384 bytes
-rw-r--r--testdata/scad/templates/import_stl-tests-template.scad2
-rw-r--r--tests/CMakeLists.txt89
-rw-r--r--tests/CTestCustom.template68
-rw-r--r--tests/FindGLEW.cmake92
-rw-r--r--tests/guicgalpngtest.cc8
-rw-r--r--tests/regression/cgalpngtest/import_stl-tests-expected.pngbin5758 -> 10193 bytes
-rw-r--r--tests/regression/cgalpngtest/polygon-intersect-expected.pngbin5170 -> 3012 bytes
-rw-r--r--tests/regression/cgalpngtest/polygon-mesh-expected.pngbin5170 -> 3448 bytes
-rw-r--r--tests/regression/cgalpngtest/polygon-self-intersect-expected.pngbin5170 -> 2918 bytes
-rw-r--r--tests/regression/dumptest/import_stl-tests-expected.txt3
-rw-r--r--tests/regression/opencsgtest/import_stl-tests-expected.pngbin6207 -> 10720 bytes
-rw-r--r--tests/regression/opencsgtest/polygon-intersect-expected.pngbin5170 -> 2901 bytes
-rw-r--r--tests/regression/opencsgtest/polygon-mesh-expected.pngbin5170 -> 4597 bytes
-rw-r--r--tests/regression/opencsgtest/polygon-self-intersect-expected.pngbin5170 -> 2405 bytes
-rw-r--r--tests/regression/throwntogethertest/import_stl-tests-expected.pngbin6207 -> 10720 bytes
-rw-r--r--tests/regression/throwntogethertest/polygon-intersect-expected.pngbin1810 -> 3006 bytes
-rw-r--r--tests/regression/throwntogethertest/polygon-mesh-expected.pngbin1810 -> 4682 bytes
-rw-r--r--tests/regression/throwntogethertest/polygon-self-intersect-expected.pngbin1810 -> 2403 bytes
-rwxr-xr-xtests/test_pretty_print.py17
-rwxr-xr-xtests/virtualfb.sh22
-rw-r--r--winconsole.pri28
39 files changed, 421 insertions, 113 deletions
diff --git a/doc/TODO.txt b/doc/TODO.txt
index 62db614..be03e98 100644
--- a/doc/TODO.txt
+++ b/doc/TODO.txt
@@ -137,6 +137,8 @@ o Hollow donut problem
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)
+o Look at performance: Is CGAL doing proper bounding box calculation before testing all primitives?
+
LANGUAGE && BUILTINS
--------------------
@@ -190,6 +192,7 @@ o DXF Import/Export
- Support for LEADER entity
- Support for MTEXT entity ?
- idea: DXF inline - convert from dxf to OpenSCAD syntax -> parametrize dxf content
+ - Progress when exporting large STLs
o Mesh optimization on STL export
- Remove super small triangles (all sides are short)
- Replace super thin triangles (one h is short)
@@ -220,10 +223,6 @@ o Consider decoupling DXF-specific functionality from the 2D subsystem
o Visitation refactoring
- Make AbstractNode members private/protected?
-BUILD SYSTEM
-------------
-o Fedora is reported to ship with byacc, which doesn't support bison extensions (e.g. %debuig). Look into this, either be yacc-compatible or force the build system to use bison.
-
DOCUMENTATION
-------------
o Auto-generate API documentation instead of, in addition to or combined with, the wikibooks docs.
diff --git a/doc/release-checklist.txt b/doc/release-checklist.txt
index 6d53ad9..c51c919 100644
--- a/doc/release-checklist.txt
+++ b/doc/release-checklist.txt
@@ -5,7 +5,7 @@ OpenSCAD Release Checklist
o Update VERSION environment variable
- export VERSION=2012.08
+ export VERSION=2013.01
It will be used by the commands below, as well as these files:
@@ -24,7 +24,7 @@ o build source package
o Sanity check; build a binary or two and manually run some tests
-o git push --tags
+o git push --tags
o Upload Source package
$ ./scripts/googlecode_upload.py -s 'Source Code' -p openscad -l Featured,Type-Source openscad-$VERSION.src.tar.gz
diff --git a/openscad.pro b/openscad.pro
index b5190ed..ead5d1f 100644
--- a/openscad.pro
+++ b/openscad.pro
@@ -372,3 +372,8 @@ INSTALLS += applications
icons.path = $$PREFIX/share/pixmaps
icons.files = icons/openscad.png
INSTALLS += icons
+
+CONFIG(winconsole) {
+ include(winconsole.pri)
+}
+
diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh
index eaed556..6a3e637 100755
--- a/scripts/check-dependencies.sh
+++ b/scripts/check-dependencies.sh
@@ -449,7 +449,7 @@ 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"
+ liblist="libboost_system libboost_system-mt 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"
diff --git a/scripts/installer.nsi b/scripts/installer.nsi
index 87ec18d..1841431 100644
--- a/scripts/installer.nsi
+++ b/scripts/installer.nsi
@@ -6,6 +6,7 @@ DirText "This will install OpenSCAD on your computer. Choose a directory"
Section "install"
SetOutPath $INSTDIR
File openscad.exe
+File openscad.com
File /r /x mingw-cross-env examples
File /r /x mingw-cross-env libraries
${registerExtension} "$INSTDIR\openscad.exe" ".scad" "OpenSCAD_File"
diff --git a/scripts/release-common.sh b/scripts/release-common.sh
index ae856df..de14cb1 100755
--- a/scripts/release-common.sh
+++ b/scripts/release-common.sh
@@ -166,7 +166,14 @@ fi
case $OS in
LINXWIN)
# dont use paralell builds, it can error-out on parser_yacc.
+
+ # make main openscad.exe
cd $DEPLOYDIR && make $TARGET
+
+ # make console pipe-able openscad.com - see winconsole.pri for info
+ i686-pc-mingw32-qmake CONFIG+=winconsole ../openscad.pro
+ make
+
cd $OPENSCADDIR
;;
*)
@@ -232,6 +239,7 @@ case $OS in
#package
cp win32deps/* openscad-$VERSION
cp $TARGET/openscad.exe openscad-$VERSION
+ cp $TARGET/openscad.com openscad-$VERSION
rm -f openscad-$VERSION.zip
"$ZIP" $ZIPARGS openscad-$VERSION.zip openscad-$VERSION
rm -rf openscad-$VERSION
@@ -242,6 +250,7 @@ case $OS in
echo "Creating binary package"
cd $DEPLOYDIR
cp $TARGET/openscad.exe openscad-$VERSION
+ cp $TARGET/openscad.com openscad-$VERSION
rm -f OpenSCAD-$VERSION.zip
"$ZIP" $ZIPARGS OpenSCAD-$VERSION.zip openscad-$VERSION
cd $OPENSCADDIR
diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh
index 0c37605..3da11ec 100755
--- a/scripts/uni-build-dependencies.sh
+++ b/scripts/uni-build-dependencies.sh
@@ -176,15 +176,27 @@ build_boost()
fi
fi
# We only need certain portions of boost
- ./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,system,regex
+ if [ -e ./bootstrap.sh ]; then
+ BSTRAPBIN=./bootstrap.sh
+ else
+ BSTRAPBIN=./configure
+ fi
+ $BSTRAPBIN --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,system,regex
+ if [ -e ./b2 ]; then
+ BJAMBIN=./b2;
+ elif [ -e ./bjam ]; then
+ BJAMBIN=./bjam
+ elif [ -e ./Makefile ]; then
+ BJAMBIN=make
+ fi
if [ $CXX ]; then
if [ $CXX = "clang++" ]; then
- ./b2 -j$NUMCPU toolset=clang install
+ $BJAMBIN -j$NUMCPU toolset=clang install
# ./b2 -j$NUMCPU toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" install
fi
else
- ./b2 -j$NUMCPU
- ./b2 install
+ $BJAMBIN -j$NUMCPU
+ $BJAMBIN install
fi
}
diff --git a/setenv_mjau.sh b/setenv_mjau.sh
index 677a47a..943ae6b 100644
--- a/setenv_mjau.sh
+++ b/setenv_mjau.sh
@@ -6,7 +6,7 @@ export QMAKESPEC=macx-g++
#export CGALDIR=$PWD/../install/CGAL-3.6
#export DYLD_LIBRARY_PATH=$OPENCSGDIR/lib
-# Own own Qt
+# Our own Qt
export PATH=$OPENSCAD_LIBRARIES/bin:$PATH
# ccache:
diff --git a/src/AboutDialog.html b/src/AboutDialog.html
index 34e8127..6203e83 100644
--- a/src/AboutDialog.html
+++ b/src/AboutDialog.html
@@ -115,7 +115,7 @@ 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
+benhowes, 5263, Craig Trader, Miro HronĨok, ... and many others
<p>
<b>Hosting &amp; resources</b>
diff --git a/src/Preferences.cc b/src/Preferences.cc
index e70a2a1..ec66094 100644
--- a/src/Preferences.cc
+++ b/src/Preferences.cc
@@ -30,7 +30,9 @@
#include <QKeyEvent>
#include <QSettings>
#include "PolySetCache.h"
+#ifdef ENABLE_CGAL
#include "CGALCache.h"
+#endif
Preferences *Preferences::instance = NULL;
@@ -75,7 +77,9 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent)
this->defaultmap["advanced/opencsg_show_warning"] = true;
this->defaultmap["advanced/enable_opencsg_opengl1x"] = true;
this->defaultmap["advanced/polysetCacheSize"] = uint(PolySetCache::instance()->maxSize());
+#ifdef ENABLE_CGAL
this->defaultmap["advanced/cgalCacheSize"] = uint(CGALCache::instance()->maxSize());
+#endif
this->defaultmap["advanced/openCSGLimit"] = 2000;
this->defaultmap["advanced/forceGoldfeather"] = false;
@@ -126,7 +130,9 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent)
// Advanced pane
QValidator *validator = new QIntValidator(this);
+#ifdef ENABLE_CGAL
this->cgalCacheSizeEdit->setValidator(validator);
+#endif
this->polysetCacheSizeEdit->setValidator(validator);
this->opencsgLimitEdit->setValidator(validator);
@@ -198,7 +204,9 @@ void Preferences::on_cgalCacheSizeEdit_textChanged(const QString &text)
{
QSettings settings;
settings.setValue("advanced/cgalCacheSize", text);
+#ifdef ENABLE_CGAL
CGALCache::instance()->setMaxSize(text.toULong());
+#endif
}
void Preferences::on_polysetCacheSizeEdit_textChanged(const QString &text)
diff --git a/src/dxftess-cgal.cc b/src/dxftess-cgal.cc
index d01c1d5..0197473 100644
--- a/src/dxftess-cgal.cc
+++ b/src/dxftess-cgal.cc
@@ -24,7 +24,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_vertex_base_2<K> Vb;
typedef CGAL::Delaunay_mesh_face_base_2<K> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb, Fb> Tds;
-typedef CGAL::Constrained_Delaunay_triangulation_2<K, Tds> CDT;
+typedef CGAL::Constrained_Delaunay_triangulation_2<K, Tds, CGAL::Exact_predicates_tag > CDT;
//typedef CGAL::Delaunay_mesh_criteria_2<CDT> Criteria;
typedef CDT::Vertex_handle Vertex_handle;
@@ -109,6 +109,7 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool /* do_tr
Grid2d<point_info_t> point_info(GRID_FINE);
boost::unordered_map<edge_t,int> edge_to_triangle;
boost::unordered_map<edge_t,int> edge_to_path;
+ int duplicate_vertices = 0;
CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
try {
@@ -131,7 +132,7 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool /* do_tr
// ..maybe it would be better to assert here. But this would
// break compatibility with the glu tesselator that handled such
// cases just fine.
- PRINT( "WARNING: Duplicate vertex found during Tessellation. Render may be incorrect." );
+ duplicate_vertices++;
continue;
}
@@ -165,6 +166,11 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool /* do_tr
}
}
+ if ( duplicate_vertices > 0 ) {
+ PRINT( "WARNING: Duplicate vertices and/or intersecting lines found during DXF Tessellation." );
+ PRINT( "WARNING: Modify the polygon to be a Simple Polygon. Render is incomplete." );
+ }
+
}
catch (const CGAL::Assertion_exception &e) {
PRINTB("CGAL error in dxf_tesselate(): %s", e.what());
diff --git a/src/func.cc b/src/func.cc
index 5dcb3e9..791e957 100644
--- a/src/func.cc
+++ b/src/func.cc
@@ -43,7 +43,7 @@
*/
#include <boost/random/mersenne_twister.hpp>
-#include <boost/random/uniform_real_distribution.hpp>
+#include <boost/random/uniform_real.hpp>
#ifdef __WIN32__
#include <process.h>
@@ -54,8 +54,8 @@ int process_id = _getpid();
int process_id = getpid();
#endif
-boost::random::mt19937 deterministic_rng;
-boost::random::mt19937 lessdeterministic_rng( std::time(0) + process_id );
+boost::mt19937 deterministic_rng;
+boost::mt19937 lessdeterministic_rng( std::time(0) + process_id );
AbstractFunction::~AbstractFunction()
{
@@ -167,7 +167,7 @@ Value builtin_rands(const Context *, const std::vector<std::string>&, const std:
double min = std::min( args[0].toDouble(), args[1].toDouble() );
double max = std::max( args[0].toDouble(), args[1].toDouble() );
- boost::random::uniform_real_distribution<> distributor( min, max );
+ boost::uniform_real<> distributor( min, max );
Value::VectorType vec;
for (int i=0; i<args[2].toDouble(); i++) {
if ( deterministic ) {
diff --git a/src/import.cc b/src/import.cc
index 40d34fa..6a6d925 100644
--- a/src/import.cc
+++ b/src/import.cc
@@ -119,7 +119,8 @@ PolySet *ImportNode::evaluate_polyset(class PolySetEvaluator *) const
if (this->type == TYPE_STL)
{
handle_dep((std::string)this->filename);
- std::ifstream f(this->filename.c_str(), std::ios::in | std::ios::binary);
+ // Open file and position at the end
+ std::ifstream f(this->filename.c_str(), std::ios::in | std::ios::binary | std::ios::ate);
if (!f.good()) {
PRINTB("WARNING: Can't open import file '%s'.", this->filename);
return p;
@@ -132,9 +133,20 @@ PolySet *ImportNode::evaluate_polyset(class PolySetEvaluator *) const
boost::regex ex_vertex("vertex");
boost::regex ex_vertices("\\s*vertex\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)");
+ bool binary = false;
+ int file_size = f.tellg();
+ f.seekg(80);
+ if (!f.eof()) {
+ int facenum = 0;
+ // FIXME: Assumes little endian
+ f.read((char *)&facenum, sizeof(int));
+ if (file_size == 80 + 4 + 50*facenum) binary = true;
+ }
+ f.seekg(0);
+
char data[5];
f.read(data, 5);
- if (!f.eof() && !memcmp(data, "solid", 5)) {
+ if (!binary && !f.eof() && !memcmp(data, "solid", 5)) {
int i = 0;
double vdata[3][3];
std::string line;
@@ -174,6 +186,7 @@ PolySet *ImportNode::evaluate_polyset(class PolySetEvaluator *) const
else
{
f.ignore(80-5+4);
+ // FIXME: Assumes little endian
while (1) {
#ifdef _MSC_VER
#pragma pack(push,1)
diff --git a/src/mainwin.cc b/src/mainwin.cc
index cf79b5a..d5af643 100644
--- a/src/mainwin.cc
+++ b/src/mainwin.cc
@@ -89,6 +89,10 @@
#include "cgal.h"
#include "cgalworker.h"
+#else
+
+#include "PolySetEvaluator.h"
+
#endif // ENABLE_CGAL
#ifndef OPENCSG_VERSION_STRING
@@ -153,9 +157,11 @@ MainWindow::MainWindow(const QString &filename)
{
setupUi(this);
+#ifdef ENABLE_CGAL
this->cgalworker = new CGALWorker();
connect(this->cgalworker, SIGNAL(done(CGAL_Nef_polyhedron *)),
this, SLOT(actionRenderCGALDone(CGAL_Nef_polyhedron *)));
+#endif
register_builtin(root_ctx);
@@ -410,8 +416,10 @@ MainWindow::loadDesignSettings()
}
uint polySetCacheSize = Preferences::inst()->getValue("advanced/polysetCacheSize").toUInt();
PolySetCache::instance()->setMaxSize(polySetCacheSize);
+#ifdef ENABLE_CGAL
uint cgalCacheSize = Preferences::inst()->getValue("advanced/cgalCacheSize").toUInt();
CGALCache::instance()->setMaxSize(cgalCacheSize);
+#endif
}
MainWindow::~MainWindow()
@@ -668,8 +676,12 @@ void MainWindow::compileCSG(bool procevents)
progress_report_prep(this->root_node, report_func, this);
try {
+#ifdef ENABLE_CGAL
CGALEvaluator cgalevaluator(this->tree);
PolySetCGALEvaluator psevaluator(cgalevaluator);
+#else
+ PolySetEvaluator psevaluator(this->tree);
+#endif
CSGTermEvaluator csgrenderer(this->tree, &psevaluator);
this->root_raw_term = csgrenderer.evaluateCSGTerm(*root_node, highlight_terms, background_terms);
if (!root_raw_term) {
@@ -678,7 +690,9 @@ void MainWindow::compileCSG(bool procevents)
QApplication::processEvents();
}
PolySetCache::instance()->print();
+#ifdef ENABLE_CGAL
CGALCache::instance()->print();
+#endif
}
catch (const ProgressCancelException &e) {
PRINT("CSG generation cancelled.");
@@ -1187,8 +1201,9 @@ void MainWindow::actionRenderCGALDone(CGAL_Nef_polyhedron *root_N)
if (root_N) {
PolySetCache::instance()->print();
+#ifdef ENABLE_CGAL
CGALCache::instance()->print();
-
+#endif
if (!root_N->isNull()) {
if (root_N->dim == 2) {
PRINT(" Top level object is a 2D object:");
diff --git a/src/openscad.cc b/src/openscad.cc
index 0770558..7ebad33 100644
--- a/src/openscad.cc
+++ b/src/openscad.cc
@@ -258,7 +258,6 @@ int main(int argc, char **argv)
if (!filename) help(argv[0]);
-#ifdef ENABLE_CGAL
Context root_ctx;
register_builtin(root_ctx);
@@ -309,6 +308,7 @@ int main(int argc, char **argv)
}
}
else {
+#ifdef ENABLE_CGAL
CGAL_Nef_polyhedron root_N = cgalevaluator.evaluateCGALMesh(*tree.root());
fs::current_path(original_path);
@@ -402,8 +402,8 @@ int main(int argc, char **argv)
}
delete root_node;
#else
- fprintf(stderr, "OpenSCAD has been compiled without CGAL support!\n");
- exit(1);
+ fprintf(stderr, "OpenSCAD has been compiled without CGAL support!\n");
+ exit(1);
#endif
}
else if (useGUI)
diff --git a/src/svg.cc b/src/svg.cc
index e5130b0..66e5797 100644
--- a/src/svg.cc
+++ b/src/svg.cc
@@ -1,3 +1,4 @@
+#ifdef ENABLE_CGAL
#include "cgalutils.h"
#include "svg.h"
#include <boost/algorithm/string.hpp>
@@ -246,4 +247,4 @@ std::string dump_svg( const CGAL_Nef_polyhedron3 &N )
} // namespace
-
+#endif // ENABLE_CGAL
diff --git a/src/winconsole.c b/src/winconsole.c
new file mode 100644
index 0000000..de8e682
--- /dev/null
+++ b/src/winconsole.c
@@ -0,0 +1,84 @@
+/*
+ Enable easy piping under Windows(TM) command line.
+
+ We use the 'devenv'(TM) method, which means we have two binary files:
+
+ openscad.com, with IMAGE_SUBSYSTEM_WINDOWS_CUI flag set
+ openscad.exe, with IMAGE_SUBSYSTEM_WINDOWS_GUI flag set
+
+ The .com version is a 'wrapper' for the .exe version. If you call
+ 'openscad' with no extension from a script or shell, the .com version
+ is prioritized by the OS and feeds the GUI stdout to the console. We use
+ pure C to minimize binary size when cross-compiling (~10kbytes). See Also:
+
+ http://stackoverflow.com/questions/493536/can-one-executable-be-both-a-console-and-gui-app
+ http://blogs.msdn.com/b/oldnewthing/archive/2009/01/01/9259142.aspx
+ http://blogs.msdn.com/b/junfeng/archive/2004/02/06/68531.aspx
+ http://msdn.microsoft.com/en-us/library/aa298534%28v=vs.60%29.aspx
+ http://cournape.wordpress.com/2008/07/29/redirecting-stderrstdout-in-cmdexe/
+ Open Group popen() documentation
+ inkscapec by Jos Hirth work at http://kaioa.com
+ Nop Head's OpenSCAD_cl at github.com
+
+ TODO:
+ Work with unicode: http://www.i18nguy.com/unicode/c-unicode.html
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define MAXCMDLEN 64000
+#define BUFFSIZE 42
+
+int main( int argc, char * argv[] )
+{
+ FILE *cmd_stdout;
+ char cmd[MAXCMDLEN];
+ char buffer[BUFFSIZE];
+ char *fgets_result;
+ int eof = 0;
+ int pclose_result;
+ int i;
+ int result = 0;
+
+ strcat( cmd, "\0" );
+ strcat( cmd, "openscad.exe" );
+ for ( i = 1 ; i < argc ; ++i ) {
+ strcat( cmd, " " );
+ strcat( cmd, argv[i] );
+ }
+ strcat( cmd, " ");
+ strcat( cmd, " 2>&1"); // capture stderr and stdout
+
+ cmd_stdout = _popen( cmd, "rt" );
+ if ( cmd_stdout == NULL ) {
+ printf( "Error opening _popen for command: %s", cmd );
+ perror( "Error message:" );
+ return 1;
+ }
+
+ while ( !eof )
+ {
+ fgets_result = fgets( buffer, BUFFSIZE, cmd_stdout );
+ if ( fgets_result == NULL ) {
+ if ( ferror( cmd_stdout ) ) {
+ printf("Error reading from stdout of %s\n", cmd);
+ result = 1;
+ }
+ if ( feof( cmd_stdout ) ) {
+ eof = 1;
+ }
+ } else {
+ fprintf( stdout, "%s", buffer );
+ }
+ }
+
+ pclose_result = _pclose( cmd_stdout );
+ if ( pclose_result < 0 ) {
+ perror("Error while closing stdout for command:");
+ result = 1;
+ }
+
+ return result;
+}
diff --git a/testdata/scad/features/import_bin_solid.stl b/testdata/scad/features/import_bin_solid.stl
new file mode 100644
index 0000000..c1886db
--- /dev/null
+++ b/testdata/scad/features/import_bin_solid.stl
Binary files differ
diff --git a/testdata/scad/templates/import_stl-tests-template.scad b/testdata/scad/templates/import_stl-tests-template.scad
index 685b868..2cc886d 100644
--- a/testdata/scad/templates/import_stl-tests-template.scad
+++ b/testdata/scad/templates/import_stl-tests-template.scad
@@ -1,4 +1,6 @@
import_stl("import.stl");
translate([2,0,0]) import("import.stl");
translate([4,0,0]) import("import_bin.stl");
+// Test binary STLs which happen to start with the string "solid"
+translate([0,4,0]) import("import_bin_solid.stl");
translate([0,2,0]) import("@CMAKE_SOURCE_DIR@/../testdata/scad/features/import.stl");
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c606d22..d0e5075 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -42,6 +42,11 @@ if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG")
endif()
+# MCAD
+if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../libraries/MCAD/__init__.py)
+ message(FATAL_ERROR "MCAD not found. You can install from the OpenSCAD root as follows: \n git submodule update --init")
+endif()
+
#
# Windows
#
@@ -289,8 +294,7 @@ if (NOT $ENV{GLEWDIR} STREQUAL "")
elseif (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "")
set(GLEW_DIR "$ENV{OPENSCAD_LIBRARIES}")
endif()
-if (NOT GLEW_INCLUDE_DIR)
- message(STATUS "OPENCSG_DIR: " ${OPENCSG_DIR})
+if (GLEW_DIR)
find_path(GLEW_INCLUDE_DIR
GL/glew.h
HINTS ${GLEW_DIR}/include
@@ -299,16 +303,18 @@ if (NOT GLEW_INCLUDE_DIR)
NAMES GLEW glew
HINTS ${GLEW_DIR}/lib ${GLEW_DIR}/lib64
NO_DEFAULT_PATH)
- if (NOT GLEW_LIBRARY)
- find_package(GLEW REQUIRED)
- if (NOT GLEW_LIBRARY)
- message(FATAL_ERROR "GLEW not found")
- endif()
+ if (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
+ set(GLEW_FOUND 1)
endif()
- message(STATUS "GLEW include: " ${GLEW_INCLUDE_DIR})
- message(STATUS "GLEW library: " ${GLEW_LIBRARY})
endif()
+if (NOT GLEW_FOUND)
+ find_package(GLEW REQUIRED)
+endif()
+
+message(STATUS "GLEW include: " ${GLEW_INCLUDE_DIR})
+message(STATUS "GLEW library: " ${GLEW_LIBRARY})
+
inclusion(GLEW_DIR GLEW_INCLUDE_DIR)
# Flex/Bison
@@ -370,6 +376,19 @@ if (NOT SKIP_IMAGEMAGICK)
endif()
endif()
+if ( "${ImageMagick_VERSION_STRING}" VERSION_LESS "6.5.9.4" )
+ message(STATUS "ImageMagick version less than 6.5.9.4, cannot use -morphology comparison")
+ message(STATUS "ImageMagick Using older image comparison method")
+ set(COMPARATOR "old")
+endif()
+
+execute_process(COMMAND ${ImageMagick_convert_EXECUTABLE} --version OUTPUT_VARIABLE IM_OUT )
+if ( ${IM_OUT} MATCHES "OpenMP" )
+ # http://www.daniloaz.com/en/617/systems/high-cpu-load-when-converting-images-with-imagemagick
+ message(STATUS "ImageMagick: OpenMP bug workaround - setting MAGICK_THREAD_LIMIT=1")
+ set(CTEST_ENVIRONMENT "${CTEST_ENVIRONMENT};MAGICK_THREAD_LIMIT=1")
+endif()
+
# Internal includes
include_directories(../src)
@@ -627,12 +646,6 @@ function(get_test_fullname TESTCMD FILENAME FULLNAME)
set(${FULLNAME} ${${FULLNAME}} PARENT_SCOPE)
endfunction()
-# comparison method to use
-if (NOT $ENV{COMPARATOR} STREQUAL "")
- set(COMPARATOR "$ENV{COMPARATOR}")
- message(STATUS "ImageMagick method modified with COMPARATOR: " ${COMPARATOR})
-endif()
-
#
# This functions adds cmd-line tests given files.
# Files are sent as the parameters following TESTSUFFIX
@@ -667,27 +680,13 @@ macro(add_cmdline_test TESTCMD TESTSUFFIX)
set( MINGW_CROSS_ARG "--mingw-cross-env" )
endif()
add_test(NAME ${TEST_FULLNAME} ${CONFARG} ${CONFVAL} COMMAND ${PYTHON_EXECUTABLE} ${tests_SOURCE_DIR}/test_cmdline_tool.py ${MINGW_CROSS_ARG} --comparator=${COMPARATOR} -c ${ImageMagick_convert_EXECUTABLE} -s ${TESTSUFFIX} ${CMAKE_BINARY_DIR}/${TESTCMD} "${SCADFILE}")
+ set_property(TEST ${TEST_FULLNAME} PROPERTY ENVIRONMENT "${CTEST_ENVIRONMENT}")
endif()
endforeach()
endmacro()
enable_testing()
-# set up custom pretty printing of results
-
-set(INFOCMD "execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/opencsgtest --info OUTPUT_FILE sysinfo.txt)")
-if (MINGW_CROSS_ENV_DIR)
- set(INFOCMD "execute_process(COMMAND wine ${CMAKE_CURRENT_BINARY_DIR}/opencsgtest --info OUTPUT_FILE sysinfo.txt)")
-endif()
-set(PRETTYCMD "\"${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_pretty_print.py --builddir=${CMAKE_CURRENT_BINARY_DIR}\"")
-set(CTEST_CUSTOM_FILE ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake)
-set(CTEST_CUSTOM_TXT "\n
- message(\"running 'opencsgtest --info' to generate sysinfo.txt\")\n
- ${INFOCMD}\n
- set(CTEST_CUSTOM_POST_TEST ${PRETTYCMD})\n
-")
-file(WRITE ${CTEST_CUSTOM_FILE} ${CTEST_CUSTOM_TXT})
-
set_directory_properties(PROPERTIES TEST_INCLUDE_FILE "${CMAKE_SOURCE_DIR}/EnforceConfig.cmake")
# Subst files
@@ -804,6 +803,36 @@ foreach(FILE ${EXAMPLE_FILES})
set_test_config(Examples ${TEST_FULLNAME})
endforeach()
+# Workaround Gallium bugs
+if ( ${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc")
+ message(STATUS "Workaround PPC bug https://bugs.freedesktop.org/show_bug.cgi?id=42540")
+ set(CTEST_ENVIRONMENT "${CTEST_ENVIRONMENT};GALLIUM_DRIVER=softpipe")
+ set(CTEST_ENVIRONMENT "${CTEST_ENVIRONMENT};DRAW_USE_LLVM=no")
+endif()
+
+# Set up custom commands to run before & after Ctest run.
+# 1. Start/stop Virtual Framebuffer for linux/bsd. 2. Pretty Print
+# Please see the CTestCustom.template file for more info.
+
+file(READ ${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.template TMP)
+string(REPLACE __cmake_current_binary_dir__ ${CMAKE_CURRENT_BINARY_DIR} TMP ${TMP})
+string(REPLACE __cmake_current_source_dir__ ${CMAKE_CURRENT_SOURCE_DIR} TMP ${TMP})
+string(REPLACE __python__ ${PYTHON_EXECUTABLE} TMP ${TMP})
+string(REPLACE __header__ "Generated by cmake from ${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.template" TMP ${TMP})
+string(REPLACE __cmake_system_name__ ${CMAKE_SYSTEM_NAME} TMP ${TMP})
+
+if (MINGW_CROSS_ENV_DIR)
+ string(REPLACE __wine__ wine TMP ${TMP})
+else()
+ string(REPLACE __wine__ " " TMP ${TMP})
+endif()
+
+message(STATUS "creating CTestCustom.cmake")
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake ${TMP})
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test_pretty_print.py
+ ${CMAKE_CURRENT_BINARY_DIR}/test_pretty_print.py COPYONLY)
+
# Add tests
add_cmdline_test(echotest txt ${ECHO_FILES})
diff --git a/tests/CTestCustom.template b/tests/CTestCustom.template
new file mode 100644
index 0000000..72e6443
--- /dev/null
+++ b/tests/CTestCustom.template
@@ -0,0 +1,68 @@
+# __header__
+#
+# This template enables ctest to do things before and after the test runs.
+# In our case, 1. Setup a virtual framebuffer, 2. pretty-print results
+#
+# As a template, this file is read inside of CMakeList.txt and certain
+# words (__word__) are replaced with the cmake build dir/etc, at the time that
+# cmake itself is run. Typically these are signified by two underscores (__)
+# before and after the word in smallcase.
+#
+# The file then becomes CTestCustom.cmake inside the cmake build
+# directory. It is 'run' at the time that ctest is run.
+
+
+# Part 0. X11 and Virtual Framebuffer, for Linux/BSD. This is not used by
+# Windows or Mac because they have alternate means of accessing OpenGL.
+
+set(debug_openscad_template 0)
+
+if( __cmake_system_name__ MATCHES "Linux|BSD")
+ set(DISPLAY_ENV $ENV{DISPLAY})
+ if(DISPLAY_ENV)
+ message("X11 DISPLAY environment variable found. Assuming framebuffer exists at DISPLAY=${DISPLAY_ENV}")
+ else()
+ message("X11 DISPLAY environment variable not found. Calling virtualfb.sh")
+ execute_process(
+ COMMAND __cmake_current_source_dir__/virtualfb.sh start
+ OUTPUT_VARIABLE SVFB_OUT)
+ string(REGEX MATCH "DISPLAY=:[0-9.]*" VFB_DISPLAY_STR "${SVFB_OUT}")
+ string(REGEX MATCH ":[0-9.]*" VFB_DISPLAY "${VFB_DISPLAY_STR}")
+ string(REGEX MATCH "PID=[0-9.]*" VFB_PID_STR "${SVFB_OUT}")
+ string(REPLACE "PID=" "" VFB_PID "${VFB_PID_STR}")
+
+ if (debug_openscad_template)
+ message("Output from virtualfb.sh script: ${SVFB_OUT}")
+ message("Display: ${VFB_DISPLAY}")
+ message("Process ID of vfb: ${VFB_PID}")
+ endif()
+ if ("${VFB_DISPLAY}" STREQUAL "" OR "${VFB_PID}" STREQUAL "")
+ message("Virtual framebuffer had a problem starting.")
+ execute_process("cat virtualfblog")
+ else()
+ message("Virtual framebuffer started. DISPLAY=${VFB_DISPLAY}, PID=${VFB_PID}")
+ endif()
+
+
+ # This line is the heart of the mechanism by which ctest is able to take
+ # the DISPLAY env variable of the Virtual Framebuffer it just started, and
+ # pass it on to its child processes (the tests from CTestTestfile.cmake
+ # in the build directory).
+ set(ENV{DISPLAY} "${VFB_DISPLAY}")
+
+ set(CTEST_CUSTOM_POST_TEST "kill ${VFB_PID}")
+ endif()
+endif()
+
+
+# Part 1. Pretty Printing
+
+message("running 'opencsgtest --info' to generate sysinfo.txt")
+execute_process(COMMAND __wine__ __cmake_current_binary_dir__/opencsgtest --info OUTPUT_FILE sysinfo.txt)
+set(CTEST_CUSTOM_POST_TEST ${CTEST_CUSTOM_POST_TEST} "__python__ __cmake_current_source_dir__/test_pretty_print.py --builddir=__cmake_current_binary_dir__")
+
+if ( ${debug_openscad_template} )
+ foreach(post_test ${CTEST_CUSTOM_POST_TEST} )
+ message("Post test:" ${post_test})
+ endforeach()
+endif()
diff --git a/tests/FindGLEW.cmake b/tests/FindGLEW.cmake
index 1d94ca2..674741d 100644
--- a/tests/FindGLEW.cmake
+++ b/tests/FindGLEW.cmake
@@ -10,56 +10,56 @@
# a few lines of this file are based on the LGPL code found at
# http://openlibraries.org/browser/trunk/FindGLEW.cmake?rev=1383
-include(FindPkgConfig)
+if (WIN32 AND MSVC)
+ if (WIN32_STATIC_BUILD) # passed from caller
+ set(GLEW_LIB_SEARCH_NAME glew32s.lib) # static, non-debug (Release)
+ else ()
+ set(GLEW_LIB_SEARCH_NAME glew32.lib) # other. untested with OpenSCAD
+ endif()
+else () # GCC
+ set(GLEW_LIB_SEARCH_NAME "libglew32s.a")
+endif ()
-if (PKG_CONFIG_FOUND)
- message("Doing pkg config glew check...")
- pkg_check_modules(GLEW glew>=1.6)
+if (WIN32)
+ find_path(GLEW_INCLUDE_DIR GL/glew.h
+ $ENV{PROGRAMFILES}/GLEW/include
+ ${PROJECT_SOURCE_DIR}/src/nvgl/glew/include
+ DOC "The directory where GL/glew.h resides")
+ find_library(GLEW_LIBRARY
+ NAMES ${GLEW_LIB_SEARCH_NAME}
+ PATHS
+ $ENV{PROGRAMFILES}/GLEW/lib
+ ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
+ ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
+ DOC "The GLEW library")
+else()
+ find_path(GLEW_INCLUDE_DIR GL/glew.h
+ PATHS /usr/include /usr/local/include /usr/pkg/include
+ DOC "The directory where GL/glew.h resides")
+ find_library(GLEW_LIBRARY
+ NAMES GLEW glew
+ PATHS /usr/lib /usr/local/lib /usr/pkg/lib /lib /lib64 /usr/lib64
+ DOC "The GLEW library")
endif()
-if (GLEW_LIBRARIES)
- set(GLEW_INCLUDE_DIR "${GLEW_INCLUDE_DIRS}")
- set(GLEW_LIBRARY ${GLEW_LDFLAGS})
+if ("${GLEW_INCLUDE_DIR}" STREQUAL "" AND "${GLEW_LIBRARY}" STREQUAL "")
+ set(GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
else()
- if (WIN32 AND MSVC)
- if (WIN32_STATIC_BUILD) # passed from caller
- set(GLEW_LIB_SEARCH_NAME glew32s.lib) # static, non-debug (Release)
- else ()
- set(GLEW_LIB_SEARCH_NAME glew32.lib) # other. untested with OpenSCAD
- endif()
- else () # GCC
- set(GLEW_LIB_SEARCH_NAME "libglew32s.a")
- endif ()
-
- if (WIN32)
- find_path(GLEW_INCLUDE_DIR GL/glew.h
- $ENV{PROGRAMFILES}/GLEW/include
- ${PROJECT_SOURCE_DIR}/src/nvgl/glew/include
- DOC "The directory where GL/glew.h resides")
- find_library(GLEW_LIBRARY
- NAMES ${GLEW_LIB_SEARCH_NAME}
- PATHS
- $ENV{PROGRAMFILES}/GLEW/lib
- ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
- ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
- DOC "The GLEW library")
- else (WIN32)
- find_path(GLEW_INCLUDE_DIR GL/glew.h
- PATHS /usr/include /usr/local/include /usr/pkg/include
- NO_DEFAULT_PATH
- DOC "The directory where GL/glew.h resides")
- find_library(GLEW_LIBRARY
- NAMES GLEW glew
- PATHS /usr/lib /usr/local/lib /usr/pkg/lib
- NO_DEFAULT_PATH
- DOC "The GLEW library")
- endif (WIN32)
+ set(GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
+endif()
- if (GLEW_INCLUDE_DIR)
- set(GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
- message(STATUS "GLEW include found in " ${GLEW_INCLUDE_DIR} )
- message(STATUS "GLEW library found in " ${GLEW_LIBRARY} )
- else()
- set(GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
+if (NOT GLEW_FOUND)
+ find_package(PkgConfig REQUIRED)
+ if (PKG_CONFIG_FOUND)
+ message(STATUS "Doing pkg config glew check...")
+ pkg_search_module(GLEW glew)
+ if (GLEW_FOUND)
+ set(GLEW_INCLUDE_DIR "${GLEW_INCLUDEDIR}")
+ set(GLEW_LIBRARY "-L${GLEW_LIBRARY_DIRS} -l${GLEW_LIBRARIES}")
+ endif()
endif()
endif()
+
+if (NOT GLEW_FOUND)
+ message(FATAL_ERROR "GLEW not found")
+endif()
diff --git a/tests/guicgalpngtest.cc b/tests/guicgalpngtest.cc
index 8c4f6de..dd4441c 100644
--- a/tests/guicgalpngtest.cc
+++ b/tests/guicgalpngtest.cc
@@ -9,15 +9,15 @@
#define QUOTE(x) PREQUOTE(x)
int main( int argc, char * argv[] )
{
- printf("%s: wrapper for OpenSCAD at %s\n", argv[0], QUOTE( BINPATH ) );
- if (argc<2 || argc>2) {
- printf("%s: bad number of arguments: %i\n", argv[0], argc);
+ fprintf(stderr,"%s: wrapper for OpenSCAD at %s\n", argv[0], QUOTE( BINPATH ) );
+ if (argc<3 || argc>3) {
+ fprintf(stderr,"%s: bad number of arguments: %i\n", argv[0], argc);
return 1;
}
char *newargs[6];
char *scadfilename = argv[1];
char *pngfile = argv[2];
- newargs[0] = argv[0];
+ newargs[0] = const_cast<char *>(QUOTE( BINPATH ));
newargs[1] = scadfilename;
newargs[2] = const_cast<char *>("-o");
newargs[3] = pngfile;
diff --git a/tests/regression/cgalpngtest/import_stl-tests-expected.png b/tests/regression/cgalpngtest/import_stl-tests-expected.png
index de7638a..c6a4b2d 100644
--- a/tests/regression/cgalpngtest/import_stl-tests-expected.png
+++ b/tests/regression/cgalpngtest/import_stl-tests-expected.png
Binary files differ
diff --git a/tests/regression/cgalpngtest/polygon-intersect-expected.png b/tests/regression/cgalpngtest/polygon-intersect-expected.png
index 6f4f437..54e8d6b 100644
--- a/tests/regression/cgalpngtest/polygon-intersect-expected.png
+++ b/tests/regression/cgalpngtest/polygon-intersect-expected.png
Binary files differ
diff --git a/tests/regression/cgalpngtest/polygon-mesh-expected.png b/tests/regression/cgalpngtest/polygon-mesh-expected.png
index 6f4f437..a8fe41a 100644
--- a/tests/regression/cgalpngtest/polygon-mesh-expected.png
+++ b/tests/regression/cgalpngtest/polygon-mesh-expected.png
Binary files differ
diff --git a/tests/regression/cgalpngtest/polygon-self-intersect-expected.png b/tests/regression/cgalpngtest/polygon-self-intersect-expected.png
index 6f4f437..b93b5fb 100644
--- a/tests/regression/cgalpngtest/polygon-self-intersect-expected.png
+++ b/tests/regression/cgalpngtest/polygon-self-intersect-expected.png
Binary files differ
diff --git a/tests/regression/dumptest/import_stl-tests-expected.txt b/tests/regression/dumptest/import_stl-tests-expected.txt
index 947f137..0d46a6f 100644
--- a/tests/regression/dumptest/import_stl-tests-expected.txt
+++ b/tests/regression/dumptest/import_stl-tests-expected.txt
@@ -5,6 +5,9 @@
multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
import(file = "import_bin.stl", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
}
+ multmatrix([[1, 0, 0, 0], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ import(file = "import_bin_solid.stl", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
+ }
multmatrix([[1, 0, 0, 0], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) {
import(file = "import.stl", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
}
diff --git a/tests/regression/opencsgtest/import_stl-tests-expected.png b/tests/regression/opencsgtest/import_stl-tests-expected.png
index 0bd9ab6..583f3f6 100644
--- a/tests/regression/opencsgtest/import_stl-tests-expected.png
+++ b/tests/regression/opencsgtest/import_stl-tests-expected.png
Binary files differ
diff --git a/tests/regression/opencsgtest/polygon-intersect-expected.png b/tests/regression/opencsgtest/polygon-intersect-expected.png
index 6f4f437..c0a3cc9 100644
--- a/tests/regression/opencsgtest/polygon-intersect-expected.png
+++ b/tests/regression/opencsgtest/polygon-intersect-expected.png
Binary files differ
diff --git a/tests/regression/opencsgtest/polygon-mesh-expected.png b/tests/regression/opencsgtest/polygon-mesh-expected.png
index 6f4f437..b907a74 100644
--- a/tests/regression/opencsgtest/polygon-mesh-expected.png
+++ b/tests/regression/opencsgtest/polygon-mesh-expected.png
Binary files differ
diff --git a/tests/regression/opencsgtest/polygon-self-intersect-expected.png b/tests/regression/opencsgtest/polygon-self-intersect-expected.png
index 6f4f437..899bb6f 100644
--- a/tests/regression/opencsgtest/polygon-self-intersect-expected.png
+++ b/tests/regression/opencsgtest/polygon-self-intersect-expected.png
Binary files differ
diff --git a/tests/regression/throwntogethertest/import_stl-tests-expected.png b/tests/regression/throwntogethertest/import_stl-tests-expected.png
index 0bd9ab6..583f3f6 100644
--- a/tests/regression/throwntogethertest/import_stl-tests-expected.png
+++ b/tests/regression/throwntogethertest/import_stl-tests-expected.png
Binary files differ
diff --git a/tests/regression/throwntogethertest/polygon-intersect-expected.png b/tests/regression/throwntogethertest/polygon-intersect-expected.png
index 81eb514..d889f06 100644
--- a/tests/regression/throwntogethertest/polygon-intersect-expected.png
+++ b/tests/regression/throwntogethertest/polygon-intersect-expected.png
Binary files differ
diff --git a/tests/regression/throwntogethertest/polygon-mesh-expected.png b/tests/regression/throwntogethertest/polygon-mesh-expected.png
index 81eb514..1c2751c 100644
--- a/tests/regression/throwntogethertest/polygon-mesh-expected.png
+++ b/tests/regression/throwntogethertest/polygon-mesh-expected.png
Binary files differ
diff --git a/tests/regression/throwntogethertest/polygon-self-intersect-expected.png b/tests/regression/throwntogethertest/polygon-self-intersect-expected.png
index 81eb514..ebce31e 100644
--- a/tests/regression/throwntogethertest/polygon-self-intersect-expected.png
+++ b/tests/regression/throwntogethertest/polygon-self-intersect-expected.png
Binary files differ
diff --git a/tests/test_pretty_print.py b/tests/test_pretty_print.py
index a2a04ed..ed86b65 100755
--- a/tests/test_pretty_print.py
+++ b/tests/test_pretty_print.py
@@ -62,13 +62,16 @@ def ezsearch(pattern,str):
def read_gitinfo():
# won't work if run from outside of branch.
- data = subprocess.Popen(['git','remote','-v'],stdout=subprocess.PIPE).stdout.read()
- origin = ezsearch('^origin *?(.*?)\(fetch.*?$',data)
- upstream = ezsearch('^upstream *?(.*?)\(fetch.*?$',data)
- data = subprocess.Popen(['git','branch'],stdout=subprocess.PIPE).stdout.read()
- branch = ezsearch('^\*(.*?)$',data)
- out = 'Git branch: ' + branch + ' from origin ' + origin + '\n'
- out += 'Git upstream: ' + upstream + '\n'
+ try:
+ data = subprocess.Popen(['git','remote','-v'],stdout=subprocess.PIPE).stdout.read()
+ origin = ezsearch('^origin *?(.*?)\(fetch.*?$',data)
+ upstream = ezsearch('^upstream *?(.*?)\(fetch.*?$',data)
+ data = subprocess.Popen(['git','branch'],stdout=subprocess.PIPE).stdout.read()
+ branch = ezsearch('^\*(.*?)$',data)
+ out = 'Git branch: ' + branch + ' from origin ' + origin + '\n'
+ out += 'Git upstream: ' + upstream + '\n'
+ except:
+ out = 'Problem running git'
return out
def read_sysinfo(filename):
diff --git a/tests/virtualfb.sh b/tests/virtualfb.sh
new file mode 100755
index 0000000..3c0cf0e
--- /dev/null
+++ b/tests/virtualfb.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+if [ "`command -v Xvfb`" ]; then
+ VFB_BINARY=Xvfb
+fi
+
+if [ "`command -v Xvnc`" ]; then
+ VFB_BINARY=Xvnc
+fi
+
+if [ ! $VFB_BINARY ]; then
+ echo "$0 Failed, cannot find Xvfb or Xvnc"
+ exit 1
+fi
+
+DISPLAY=:98
+$VFB_BINARY $DISPLAY -screen 0 800x600x24 &> virtualfblog &
+echo PID=$! " "
+echo DISPLAY=$DISPLAY
+# trap "kill -KILL $xpid ||:" EXIT
+export DISPLAY
+sleep 3
diff --git a/winconsole.pri b/winconsole.pri
new file mode 100644
index 0000000..a3991ae
--- /dev/null
+++ b/winconsole.pri
@@ -0,0 +1,28 @@
+# Windows console issues workaround stub.
+#
+# Usage: put at the end of .pro file, then run qmake CONFIG+=winconsole
+#
+# This attempts to solve the problem of piping OpenSCAD under windows
+# command line (GUI mode programs in Windows dont allow this). We use
+# the 'devenv' solution, which means building two binaries:
+# openscad.exe, and openscad.com, the latter being a wrapper for the
+# former. See src/winconsole.c for more details.
+#
+# Qmake doesn't like building two binaries in the same directory so we
+# depend on release-common.sh to call qmake twice and package the file properly
+
+CONFIG(winconsole) {
+ TEMPLATE = app
+ TARGET = openscad_winconsole
+ FORMS =
+ HEADERS =
+ FLEXSOURCES =
+ BISONSOURCES =
+ RESOURCES =
+ SOURCES = src/winconsole.c
+ CONFIG += console # sets IMAGE_SUBSYSTEM_WINDOWS_CUI in binary
+ LIBS -= $$LIBS
+ RC_FILE -= $$RC_FILE
+ QMAKE_POST_LINK = cd $(DESTDIR) && mv openscad_winconsole.exe openscad.com
+}
+
contact: Jan Huwald // Impressum