more windows build tweaks, warnings and linking

This commit is contained in:
Brad Hefta-Gaub 2014-01-13 11:48:16 -08:00
parent 3f03145386
commit 483ac66518
5 changed files with 42 additions and 4 deletions

View file

@ -3,7 +3,9 @@ cmake_minimum_required(VERSION 2.8)
project(hifi)
IF (WIN32)
add_definitions( -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS )
add_definitions( -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -DTEST)
#MESSAGE(${CMAKE_PREFIX_PATH})
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A")
ENDIF(WIN32)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} $ENV{QT_CMAKE_PREFIX_PATH})

View file

@ -34,9 +34,13 @@ if (UNIX AND NOT APPLE)
endif (UNIX AND NOT APPLE)
if (WIN32)
MESSAGE(${CMAKE_PREFIX_PATH})
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A")
MESSAGE(${CMAKE_PREFIX_PATH})
add_definitions( -D_USE_MATH_DEFINES -DWINDOWS_LEAN_AND_MEAN ) # apparently needed to get M_PI and other defines from cmath/math.h
#set(GLUT_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/glut)
set(GLUT_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/glut)
#set(GL_HEADERS "#define GLEW_STATIC\n#define FREEGLUT_STATIC\n#define FREEGLUT_LIB_PRAGMAS 0\n#include <GL/glew.h>\n#include <GL/wglew.h>\n#include <GL/freeglut_std.h>\n#include <GL/freeglut_ext.h>")
# this bit of #define GLdouble GLdouble is to fix up a mismatch between windows and the Qt versions of open GL.
@ -233,7 +237,7 @@ if (WIN32)
target_link_libraries(
${TARGET_NAME}
#${CMAKE_CURRENT_SOURCE_DIR}/external/glut/Release/glew32.lib
#${CMAKE_CURRENT_SOURCE_DIR}/external/glut/Release/freeglut.lib
${CMAKE_CURRENT_SOURCE_DIR}/external/glut/Release/freeglut.lib
#${CMAKE_CURRENT_SOURCE_DIR}/external/glut/Release/pthread_lib.lib
wsock32.lib
)

View file

@ -318,11 +318,19 @@ public:
/// Declares the metatype and the streaming operators. The last lines
/// ensure that the generated file will be included in the link phase.
#define STRINGIFY(x) #x
#ifdef _WIN32
#define DECLARE_STREAMABLE_METATYPE(X) Q_DECLARE_METATYPE(X) \
Bitstream& operator<<(Bitstream& out, const X& obj); \
Bitstream& operator>>(Bitstream& in, X& obj); \
static const int* _TypePtr##X = &X::Type;
#else
#define STRINGIFY(x) #x
#define DECLARE_STREAMABLE_METATYPE(X) Q_DECLARE_METATYPE(X) \
Bitstream& operator<<(Bitstream& out, const X& obj); \
Bitstream& operator>>(Bitstream& in, X& obj); \
static const int* _TypePtr##X = &X::Type; \
_Pragma(STRINGIFY(unused(_TypePtr##X)))
_Pragma(STRINGIFY(unused(_TypePtr##X)))
#endif
/// Registers a streamable type and its streamer.
template<class T> int registerStreamableMetaType() {

View file

@ -36,6 +36,12 @@ Assignment::Type Assignment::typeForNodeType(NODE_TYPE nodeType) {
}
}
#ifdef WIN32
//warning C4351: new behavior: elements of array 'Assignment::_payload' will be default initialized
// We're disabling this warning because the new behavior which is to initialize the array with 0 is acceptable to us.
#pragma warning(disable:4351)
#endif
Assignment::Assignment() :
_uuid(),
_command(Assignment::RequestCommand),
@ -106,6 +112,11 @@ Assignment::Assignment(const unsigned char* dataBuffer, int numBytes) :
}
}
#ifdef WIN32
#pragma warning(default:4351)
#endif
Assignment::Assignment(const Assignment& otherAssignment) {
_uuid = otherAssignment._uuid;

View file

@ -51,6 +51,13 @@ NodeList* NodeList::getInstance() {
return _sharedInstance;
}
#ifdef WIN32
//warning C4351: new behavior: elements of array 'NodeList::_nodeBuckets' will be default initialized
// We're disabling this warning because the new behavior which is to initialize the array with 0 is acceptable to us.
#pragma warning(disable:4351)
#endif
NodeList::NodeList(char newOwnerType, unsigned short int newSocketListenPort) :
_domainHostname(DEFAULT_DOMAIN_HOSTNAME),
_domainSockAddr(HifiSockAddr(QHostAddress::Null, DEFAULT_DOMAIN_SERVER_PORT)),
@ -70,6 +77,12 @@ NodeList::NodeList(char newOwnerType, unsigned short int newSocketListenPort) :
qDebug() << "NodeList socket is listening on" << _nodeSocket.localPort() << "\n";
}
#ifdef WIN32
//warning C4351: new behavior: elements of array 'NodeList::_nodeBuckets' will be default initialized
#pragma warning(default:4351)
#endif
NodeList::~NodeList() {
delete _nodeTypesOfInterest;