- few tweaks to get things compiling under mingw

This commit is contained in:
Mark Vejvoda 2011-12-25 03:09:39 +00:00
parent 7d0cf06fe1
commit 835c886705
13 changed files with 324 additions and 268 deletions

View File

@ -6,6 +6,7 @@
# FTGL_FOUND - system has ftgl
# FTGL_INCLUDE_DIR - path to FTGL/FTGL.h
# FTGL_LIBRARY - the library that must be included
# FTGL_LIBRARY_PATH - the library path
#
#
@ -14,17 +15,34 @@ IF(WANT_STATIC_LIBS)
OPTION(FTGL_STATIC "Set to ON to link your project with static library (instead of DLL)." ON)
ENDIF()
#message(STATUS "!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #1 Searching for FTGL lib in custom path: [${FTGL_LIBRARY_PATH}]")
IF (FTGL_LIBRARY AND FTGL_INCLUDE_DIR)
SET(FTGL_FOUND "YES")
message(STATUS "!!!!!!!!!!!!!!!!!!!!!!!!!!!!! FTGL lib ALREADY FOUND in: [${FTGL_LIBRARY}]")
ELSE (FTGL_LIBRARY AND FTGL_INCLUDE_DIR)
FIND_PATH(FTGL_INCLUDE_DIR FTGL/ftgl.h PATHS /usr/local/include /usr/include)
IF(FTGL_LIBRARY_PATH)
message(STATUS "!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Searching for FTGL lib in custom path: [${FTGL_LIBRARY_PATH}]")
ENDIF()
IF (FTGL_STATIC AND NOT FTGL_LIBRARY)
FIND_LIBRARY(FTGL_LIBRARY NAMES libftgl.a ftgl PATHS /usr/local/lib /usr/lib)
ELSE()
FIND_LIBRARY(FTGL_LIBRARY NAMES ftgl PATHS /usr/local/lib /usr/lib)
ENDIF()
FIND_PATH(FTGL_INCLUDE_DIR FTGL/ftgl.h
PATHS /usr/local/include
/usr/include)
IF (FTGL_STATIC AND NOT FTGL_LIBRARY)
FIND_LIBRARY(FTGL_LIBRARY
NAMES libftgl.a ftgl libftgl libftgl.dll
PATHS /usr/local/lib
/usr/lib
${FTGL_LIBRARY_PATH})
ELSE()
FIND_LIBRARY(FTGL_LIBRARY
NAMES ftgl libftgl libftgl.dll libftgl.a
PATHS /usr/local/lib
/usr/lib
${FTGL_LIBRARY_PATH})
ENDIF()
IF (FTGL_INCLUDE_DIR AND FTGL_LIBRARY)
SET(FTGL_FOUND "YES")

View File

@ -18,6 +18,8 @@ macro(special_check_for_sse _max_sse_level_desired)
# check for SSE extensions
include(CheckCXXSourceRuns)
include(CheckCSourceRuns)
if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )
set(SSE_FLAGS)
@ -107,6 +109,8 @@ endmacro(special_check_for_sse)
macro(special_check_for_x87)
# check for X87 support
include(CheckCXXSourceRuns)
include(CheckCSourceRuns)
if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )
check_cxx_source_runs("

View File

@ -2,12 +2,23 @@
SET(CMAKE_SYSTEM_NAME Windows)
# which compilers to use for C and C++
SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)
SET(CMAKE_RC_COMPILER i586-mingw32msvc-windres)
#SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
#SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)
#SET(CMAKE_RC_COMPILER i586-mingw32msvc-windres)
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc ${PROJECT_SOURCE_DIR}/source/win32_deps/lib)
#SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc ${PROJECT_SOURCE_DIR}/source/win32_deps/lib)
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 ${PROJECT_SOURCE_DIR}/source/win32_deps/lib)
include_directories(${PROJECT_SOURCE_DIR}/source/win32_deps/freetype-2.4.8/include)
include_directories(${PROJECT_SOURCE_DIR}/source/win32_deps/glew-1.7.0/include)
include_directories(${PROJECT_SOURCE_DIR}/source/win32_deps/ftgl-2.1.3~rc5/src)
#add_definitions(-std=c++0x)
add_definitions( -std=gnu++0x )
add_definitions( -DTA3D_PLATFORM_MSVC=1 )
add_definitions( -DTA3D_PLATFORM_WINDOWS=1 )
# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search

View File

@ -16,6 +16,7 @@
#include "xml_parser.h"
#include "util.h"
#include "conversion.h"
#include <memory>
#include"platform_util.h"
using namespace std;

View File

@ -24,6 +24,7 @@
#include "util.h"
#include <wx/stdpaths.h>
#include <platform_util.h>
#include <memory>
using namespace std;
using namespace Shared::PlatformCommon;

View File

@ -483,6 +483,7 @@ Intro::Intro(Program *program):
//test = NULL;
//Shared::Graphics::md5::initMD5OpenGL(data_path + "data/core/shaders/");
//md5Test = Shared::Graphics::md5::getMD5ObjectFromLoaderScript("/home/softcoder/Code/megaglest/trunk/mk/linux/mydata/test/mv1/mv1.loader");
//md5Test = Shared::Graphics::md5::getMD5ObjectFromLoaderScript("/home/softcoder/Code/megaglest/trunk/mk/linux/mydata/test/mv1/mv2.loader");
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
@ -638,7 +639,8 @@ void Intro::render() {
//printf("animTimer.deltaTime () = %f anim = %f animTimer.deltaTime() / 25.0 = %f\n",animTimer.deltaTime (),anim,animTimer.deltaTime() / 25.0);
//double anim = animTimer.deltaTime();
//Shared::Graphics::md5::renderMD5Object(md5Test, animTimer.deltaTime() / 30.0, &modelViewMatrix);
// Shared::Graphics::md5::renderMD5Object(md5Test, animTimer.deltaTime() / 30.0, &modelViewMatrix);
//Shared::Graphics::md5::renderMD5Object(md5Test, animTimer.deltaTime() / 30.0, NULL);
// if(test == NULL) {
// glClearColor (0.0, 0.0, 0.0, 0.0);

View File

@ -21,6 +21,7 @@
#ifndef WIN32
#include <errno.h>
#endif
#include <memory>
using namespace Shared::Util;
using namespace Shared::PlatformCommon;

View File

@ -43,10 +43,11 @@
#endif // _WIN32
#include <GL/glew.h>
#ifndef _WIN32
//#include <boost/shared_ptr.hpp>
#if !defined(_WIN32) || defined(__MINGW32__)
#include <tr1/memory>
#endif
#include <stdexcept>
#include <iostream>
#include <fstream>
@ -61,7 +62,7 @@ using std::cout;
using std::endl;
using std::string;
#ifdef _WIN32
#if defined(_WIN32)
using std::tr1::shared_ptr;
#endif

View File

@ -48,7 +48,11 @@
#include <map>
#include <fstream>
#include <stdexcept>
//#include <tr1/memory>
#if !defined(_WIN32) || defined(__MINGW32__)
#include <tr1/memory>
#endif
#include <GL/glew.h>
#include "Mathlib.h"
@ -60,7 +64,7 @@ using std::string;
using std::vector;
using std::map;
#ifdef _WIN32
#if defined(_WIN32)
using std::tr1::shared_ptr;
#endif

View File

@ -33,10 +33,9 @@ typedef unsigned int uint32;
typedef long long int64;
typedef unsigned long long uint64;
//typedef uint8 byte;
}}//end namespace
#ifndef __MINGW32__
// ISO C9x compliant stdint.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
@ -287,3 +286,5 @@ typedef uint64_t uintmax_t;
#endif // _MSC_STDINT_H_ ]
#endif
#endif

View File

@ -25,6 +25,10 @@
# include <string>
#include "types.h"
#ifdef __MINGW32__
typedef unsigned char byte;
#endif
//! \name Macros for Shared::Util::String
//@{

View File

@ -1900,7 +1900,7 @@ void BroadCastClientSocketThread::execute() {
#else
setsockopt(bcfd, SOL_SOCKET, SO_REUSEADDR, (char *)&val, sizeof(val));
#endif
if(bind( bcfd, (struct sockaddr *)&bcaddr, sizeof(bcaddr) ) < 0 ) {
if(::bind( bcfd, (struct sockaddr *)&bcaddr, sizeof(bcaddr) ) < 0 ) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"bind failed: %s\n", getLastSocketErrorFormattedText().c_str());
}
else {

View File

@ -257,7 +257,15 @@ void init_win32() {
HWND hwnd = wminfo.window;
::SetClassLong(hwnd, GCL_HICON, (LONG) icon);
#ifdef __MINGW32__
#define GCL_HICON -14
#endif
#ifndef __MINGW32__
LONG iconPtr = (LONG)icon;
::SetClassLong(hwnd, GCL_HICON, iconPtr);
#endif
}
void done_win32() {
::DestroyIcon(icon);