make GUI compile on MSVC

This commit is contained in:
Miodrag Milanovic 2018-07-05 10:14:19 +02:00
parent fcff203c23
commit 2fe13e7a07
5 changed files with 15 additions and 11 deletions

View File

@ -28,7 +28,7 @@ THE SOFTWARE.
#include <memory> #include <memory>
#include "ParseMessage.h" #include "ParseMessage.h"
class ParseListener; struct ParseListener;
/** /**
Helps chunk lines of Python code into compilable statements. Helps chunk lines of Python code into compilable statements.
@ -94,7 +94,7 @@ public:
// return if there was an error // return if there was an error
bool initializeIndent(const std::string& str); bool initializeIndent(const std::string& str);
}; };
friend class BlockParseState; friend struct BlockParseState;
struct BracketParseState : public ParseState struct BracketParseState : public ParseState
{ {

View File

@ -95,7 +95,7 @@ void PythonConsole::parseEvent( const ParseMessage& message )
} }
// interpret valid user input // interpret valid user input
int errorCode; int errorCode = 0;
std::string res; std::string res;
if ( message.message.size() ) if ( message.message.size() )
res = pyinterpreter_execute( message.message, &errorCode ); res = pyinterpreter_execute( message.message, &errorCode );

View File

@ -38,9 +38,9 @@ static std::list<std::string> m_suggestions;
template <typename... Args> std::string string_format(const std::string &format, Args... args) template <typename... Args> std::string string_format(const std::string &format, Args... args)
{ {
size_t size = std::snprintf(nullptr, 0, format.c_str(), args...) + 1; // Extra space for '\0' size_t size = snprintf(nullptr, 0, format.c_str(), args...) + 1; // Extra space for '\0'
std::unique_ptr<char[]> buf(new char[size]); std::unique_ptr<char[]> buf(new char[size]);
std::snprintf(buf.get(), size, format.c_str(), args...); snprintf(buf.get(), size, format.c_str(), args...);
return std::string(buf.get(), buf.get() + size - 1); // We don't want the '\0' inside return std::string(buf.get(), buf.get() + size - 1); // We don't want the '\0' inside
} }

View File

@ -11,8 +11,8 @@ set(FAMILIES generic ice40)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
if (MSVC) if (MSVC)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE) set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /W4 /wd4100 /wd4244 /wd4125 /wd4800 /wd4456 /wd4458 /wd4305 /wd4459 /wd4121") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /W4 /wd4100 /wd4244 /wd4125 /wd4800 /wd4456 /wd4458 /wd4305 /wd4459 /wd4121 /wd4996")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W4 /wd4100 /wd4244 /wd4125 /wd4800 /wd4456 /wd4458 /wd4305 /wd4459 /wd4121") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W4 /wd4100 /wd4244 /wd4125 /wd4800 /wd4456 /wd4458 /wd4305 /wd4459 /wd4121 /wd4996")
else() else()
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -fPIC -ggdb") set(CMAKE_CXX_FLAGS_DEBUG "-Wall -fPIC -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -fPIC -O3 -g") set(CMAKE_CXX_FLAGS_RELEASE "-Wall -fPIC -O3 -g")
@ -21,6 +21,10 @@ set(CMAKE_DEFIN)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/3rdparty/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH}) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/3rdparty/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
if(NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
endif()
find_package(Sanitizers) find_package(Sanitizers)
# List of Boost libraries to include # List of Boost libraries to include

View File

@ -34,17 +34,17 @@ NEXTPNR_NAMESPACE_BEGIN
// Vertex2DPOD is a structure of X, Y coordinates that can be passed to OpenGL // Vertex2DPOD is a structure of X, Y coordinates that can be passed to OpenGL
// directly. // directly.
struct Vertex2DPOD NPNR_PACKED_STRUCT(struct Vertex2DPOD
{ {
GLfloat x; GLfloat x;
GLfloat y; GLfloat y;
Vertex2DPOD(GLfloat X, GLfloat Y) : x(X), y(Y) {} Vertex2DPOD(GLfloat X, GLfloat Y) : x(X), y(Y) {}
} __attribute__((packed)); });
// Vertex2DPOD is a structure of R, G, B, A values that can be passed to OpenGL // Vertex2DPOD is a structure of R, G, B, A values that can be passed to OpenGL
// directly. // directly.
struct ColorPOD NPNR_PACKED_STRUCT(struct ColorPOD
{ {
GLfloat r; GLfloat r;
GLfloat g; GLfloat g;
@ -53,7 +53,7 @@ struct ColorPOD
ColorPOD(GLfloat R, GLfloat G, GLfloat B, GLfloat A) : r(R), g(G), b(B), a(A) {} ColorPOD(GLfloat R, GLfloat G, GLfloat B, GLfloat A) : r(R), g(G), b(B), a(A) {}
ColorPOD(const QColor &color) : r(color.redF()), g(color.greenF()), b(color.blueF()), a(color.alphaF()) {} ColorPOD(const QColor &color) : r(color.redF()), g(color.greenF()), b(color.blueF()), a(color.alphaF()) {}
} __attribute__((packed)); });
// LineShaderData is a built set of vertices that can be rendered by the // LineShaderData is a built set of vertices that can be rendered by the
// LineShader. // LineShader.