Merge remote-tracking branch 'origin/master' into c++11

This commit is contained in:
Marius Kintel 2016-01-10 18:36:05 -05:00
commit a2ba33de7f
10 changed files with 53 additions and 34 deletions

4
.gitignore vendored
View file

@ -11,8 +11,8 @@ objects
.qmake.stash
parser_yacc.h
**/#*#
testdata/scad/features/import_dxf-tests.scad
testdata/scad/features/import_stl-tests.scad
testdata/scad/2D/features/import_dxf-tests.scad
testdata/scad/3D/features/import_stl-tests.scad
testdata/scad/misc/include-tests.scad
testdata/scad/misc/use-tests.scad
**/project.xcworkspace

View file

@ -8,6 +8,7 @@ include(flex.pri)
include(bison.pri)
include(cgal.pri)
include(opencsg.pri)
include(opengl.pri)
include(glew.pri)
include(eigen.pri)
include(boost.pri)

22
opengl.pri Normal file
View file

@ -0,0 +1,22 @@
# Prefer QOpenGLWidget for non-Windows platforms
# To explicitly enable QOpenGLWidget: qmake CONFIG += qopenglwidget
# To explicitly enable QGLWidget: qmake CONFIG += qglwidget
!win*: CONFIG += qopenglwidget
qopenglwidget:!qglwidget:!lessThan(QT_VERSION, 5.4): CONFIG += using_qopenglwidget
using_qopenglwidget {
message("Using QOpenGLWidget")
DEFINES += USE_QOPENGLWIDGET
}
else {
message("Using QGLWidget")
QT += opengl
}
# see http://fedoraproject.org/wiki/UnderstandingDSOLinkChange
# and https://github.com/openscad/openscad/pull/119
# ( QT += opengl does not automatically link glu on some DSO systems. )
unix:!macx {
QMAKE_LIBS_OPENGL *= -lGLU
QMAKE_LIBS_OPENGL *= -lX11
}

View file

@ -116,21 +116,7 @@ mingw* {
}
CONFIG += qt
QT += opengl concurrent
qopenglwidget {
!lessThan(QT_VERSION, 5.4) {
DEFINES += USE_QOPENGLWIDGET
}
}
# see http://fedoraproject.org/wiki/UnderstandingDSOLinkChange
# and https://github.com/openscad/openscad/pull/119
# ( QT += opengl does not automatically link glu on some DSO systems. )
unix:!macx {
QMAKE_LIBS_OPENGL *= -lGLU
QMAKE_LIBS_OPENGL *= -lX11
}
QT += concurrent
netbsd* {
QMAKE_LFLAGS += -L/usr/X11R7/lib

View file

@ -416,8 +416,10 @@ build_cgal()
# older cmakes have buggy FindBoost that can result in
# finding the system libraries but OPENSCAD_LIBRARIES include paths
FINDBOOST_CMAKE=$OPENSCAD_SCRIPTDIR/../tests/FindBoost.cmake
cp $FINDBOOST_CMAKE ./cmake/modules/
# NB! This was removed 2015-12-02 - if this problem resurfaces, fix it only for the relevant platforms as this
# messes up more recent installations of cmake and CGAL.
# FINDBOOST_CMAKE=$OPENSCAD_SCRIPTDIR/../tests/FindBoost.cmake
# cp $FINDBOOST_CMAKE ./cmake/modules/
mkdir bin
cd bin

View file

@ -201,7 +201,12 @@ void QGLView::mouseDoubleClickEvent (QMouseEvent *event) {
double y = viewport[3] - event->pos().y() * this->getDPI();
GLfloat z = 0;
glGetError(); // clear error state so we don't pick up previous errors
glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z);
GLenum glError = glGetError();
if (glError != GL_NO_ERROR) {
return;
}
if (z == 1) return; // outside object

View file

@ -78,7 +78,7 @@ void export_svg(const shared_ptr<const Geometry> &geom, std::ostream &output)
output
<< "<?xml version=\"1.0\" standalone=\"no\"?>\n"
<< "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n"
<< "\" viewBox=\"" << minx << " " << miny << " " << width << " " << height
<< "<svg viewBox=\"" << minx << " " << miny << " " << width << " " << height
<< "\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n"
<< "<title>OpenSCAD Model</title>\n";

View file

@ -119,8 +119,8 @@ include[ \t\r\n>]*"<" { BEGIN(cond_include); filepath = filename = ""; }
use[ \t\r\n>]*"<" { BEGIN(cond_use); }
<cond_use>{
[^\t\r\n>]+ { filename = yytext; }
">" {
BEGIN(INITIAL);
">" {
BEGIN(INITIAL);
fs::path fullpath = find_valid_path(sourcepath(), fs::path(filename), &openfilenames);
if (fullpath.empty()) {
PRINTB("WARNING: Can't open library '%s'.", filename);
@ -167,7 +167,7 @@ use[ \t\r\n>]*"<" { BEGIN(cond_use); }
{UNICODE}+ { parser_error_pos -= strlen(yytext); return TOK_ERROR; }
{D}+{E}? |
{D}+{E}? |
{D}*\.{D}+{E}? |
{D}+\.{D}*{E}? {
try {
@ -188,8 +188,8 @@ use[ \t\r\n>]*"<" { BEGIN(cond_use); }
\\x[0-7]{H} { unsigned long i = strtoul(lexertext + 2, NULL, 16); stringcontents += (i == 0 ? ' ' : (unsigned char)(i & 0xff)); }
\\u{H}{4}|\\U{H}{6} { char buf[8]; to_utf8(lexertext + 2, buf); stringcontents += buf; }
[^\\\n\"] { stringcontents += lexertext; }
\" { BEGIN(INITIAL);
parserlval.text = strdup(stringcontents.c_str());
\" { BEGIN(INITIAL);
parserlval.text = strdup(stringcontents.c_str());
return TOK_STRING; }
}
@ -239,7 +239,7 @@ void to_utf8(const char *str, char *out)
fs::path sourcepath()
{
if (!path_stack.empty()) return path_stack.back();
return fs::path(parser_source_path);
}
@ -280,18 +280,18 @@ void includefile()
openfiles.push_back(yyin);
openfilenames.push_back(fullname);
filename.clear();
yypush_buffer_state(yy_create_buffer(yyin, YY_BUF_SIZE));
}
/*!
In case of an error, this will make sure we clean up our custom data structures
In case of an error, this will make sure we clean up our custom data structures
and close all files.
*/
void lexerdestroy()
{
for (auto f : openfiles) fclose(f);
openfiles.clear();
openfilenames.clear();
path_stack.clear();
for (auto f : openfiles) fclose(f);
openfiles.clear();
openfilenames.clear();
path_stack.clear();
}

View file

@ -704,7 +704,7 @@ int gui(vector<string> &inputFiles, const fs::path &original_path, int argc, cha
updater->init();
#endif
#if !(QT_VERSION >= 0x050400)
#ifndef USE_QOPENGLWIDGET
// This workaround appears to only be needed when QGLWidget is used QOpenGLWidget
// available in Qt 5.4 is much better.
QGLFormat fmt;

View file

@ -139,7 +139,10 @@ std::string parser_source_path;
input: /* empty */
| TOK_USE
{ rootmodule->registerUse(std::string($1)); }
{
rootmodule->registerUse(std::string($1));
free($1);
}
input
| statement input
;