From c71e70c0f9997716025cad24f094c25632dce3fa Mon Sep 17 00:00:00 2001 From: Torsten Paul Date: Sun, 22 Mar 2015 14:17:12 +0100 Subject: [PATCH] Build fixes to compile on MXE with C++11 enabled. --- src/GLView.cc | 2 +- src/PlatformUtils.cc | 4 ++-- src/QGLView.cc | 13 +++++-------- src/func.cc | 2 +- src/grid.h | 2 +- src/mathc99.h | 5 ++++- src/modcontext.cc | 1 + 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/GLView.cc b/src/GLView.cc index 4ea00abd..c7bd88c3 100644 --- a/src/GLView.cc +++ b/src/GLView.cc @@ -216,7 +216,7 @@ void GLView::enable_opencsg_shaders() else if (GLEW_EXT_framebuffer_object && GLEW_EXT_packed_depth_stencil) { this->is_opencsg_capable = true; } -#ifdef WIN32 +#ifdef _WIN32 else if (WGLEW_ARB_pbuffer && WGLEW_ARB_pixel_format) this->is_opencsg_capable = true; #elif !defined(__APPLE__) else if (GLXEW_SGIX_pbuffer && GLXEW_SGIX_fbconfig) this->is_opencsg_capable = true; diff --git a/src/PlatformUtils.cc b/src/PlatformUtils.cc index e4d80225..1615878e 100644 --- a/src/PlatformUtils.cc +++ b/src/PlatformUtils.cc @@ -33,7 +33,7 @@ static std::string lookupResourcesPath() NULL }; #else -#ifdef WIN32 +#ifdef _WIN32 const char *searchpath[] = { ".", // Release location RESOURCE_FOLDER("../share/openscad"), // MSYS2 location @@ -185,7 +185,7 @@ fs::path PlatformUtils::resourcePath(const std::string &resource) int PlatformUtils::setenv(const char *name, const char *value, int overwrite) { -#if defined(WIN32) +#if defined(_WIN32) const char *ptr = getenv(name); if ((overwrite == 0) && (ptr != NULL)) { return 0; diff --git a/src/QGLView.cc b/src/QGLView.cc index 549e14d9..1f0009fe 100644 --- a/src/QGLView.cc +++ b/src/QGLView.cc @@ -135,14 +135,11 @@ void QGLView::display_opencsg_warning_dialog() message += _("It is highly recommended to use OpenSCAD on a system with " "OpenGL 2.0 or later.\n" "Your renderer information is as follows:\n"); - QString rendererinfo; - rendererinfo.sprintf(_("GLEW version %s\n" - "%s (%s)\n" - "OpenGL version %s\n"), - glewGetString(GLEW_VERSION), - glGetString(GL_RENDERER), glGetString(GL_VENDOR), - glGetString(GL_VERSION)); - message += rendererinfo; + QString rendererinfo(_("GLEW version %1\n%2 (%3)\nOpenGL version %4\n")); + message += rendererinfo.arg((const char *)glewGetString(GLEW_VERSION), + (const char *)glGetString(GL_RENDERER), + (const char *)glGetString(GL_VENDOR), + (const char *)glGetString(GL_VERSION)); dialog->setText(message); dialog->enableOpenCSGBox->setChecked(Preferences::inst()->getValue("advanced/enable_opencsg_opengl1x").toBool()); diff --git a/src/func.cc b/src/func.cc index bdbd7ed8..fbece878 100644 --- a/src/func.cc +++ b/src/func.cc @@ -24,13 +24,13 @@ * */ +#include "mathc99.h" #include "function.h" #include "expression.h" #include "evalcontext.h" #include "builtin.h" #include #include -#include "mathc99.h" #include #include #include "stl-utils.h" diff --git a/src/grid.h b/src/grid.h index 55010aaf..d55ca0be 100644 --- a/src/grid.h +++ b/src/grid.h @@ -3,7 +3,7 @@ #include "mathc99.h" #include "linalg.h" -#ifdef WIN32 +#ifdef _WIN32 typedef __int64 int64_t; #else #include diff --git a/src/mathc99.h b/src/mathc99.h index 1a1d0a66..f24c6e98 100644 --- a/src/mathc99.h +++ b/src/mathc99.h @@ -1,6 +1,8 @@ #pragma once -#ifdef WIN32 +#if defined(_MSC_VER) + +// only for native windows builds, not MXE #include //for native win32 builds we need to provide C99 math functions by ourselves @@ -11,6 +13,7 @@ float fmax(float a, float b); #else +#define _USE_MATH_DEFINES #include #endif diff --git a/src/modcontext.cc b/src/modcontext.cc index 90f04700..5b8f2b09 100644 --- a/src/modcontext.cc +++ b/src/modcontext.cc @@ -1,3 +1,4 @@ +#include "mathc99.h" #include "modcontext.h" #include "module.h" #include "expression.h"