mirror of
https://github.com/dhewm/dhewm3-sdk.git
synced 2024-11-24 05:21:20 +00:00
Basic infrastructure to build with MinGW
Add WIN32 support to CMake (core and games, no dedicated for now). Only use MFC when it is available.
This commit is contained in:
parent
01e9547049
commit
2b446ddd28
4 changed files with 53 additions and 31 deletions
|
@ -207,7 +207,9 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|||
endif()
|
||||
endif()
|
||||
|
||||
set(sys_libs ${sys_libs} pthread)
|
||||
if (NOT MINGW)
|
||||
set(sys_libs ${sys_libs} pthread)
|
||||
endif()
|
||||
|
||||
if (os STREQUAL "linux")
|
||||
set(sys_libs ${sys_libs} dl)
|
||||
|
@ -217,6 +219,23 @@ else()
|
|||
message(FATAL_ERROR "Unsupported compiler")
|
||||
endif()
|
||||
|
||||
# mingw and msvc
|
||||
if (WIN32)
|
||||
add_definitions(-DWINVER=0x0501)
|
||||
add_definitions(-D_WIN32_WINNT=0x0501)
|
||||
|
||||
set(sys_libs ${sys_libs}
|
||||
dinput8
|
||||
dsound
|
||||
ksuser
|
||||
dxguid
|
||||
dxerr8
|
||||
winmm
|
||||
iphlpapi
|
||||
wsock32
|
||||
)
|
||||
endif()
|
||||
|
||||
message(STATUS "Building ${CMAKE_BUILD_TYPE} for ${os}.${cpu}")
|
||||
|
||||
set(src_renderer
|
||||
|
@ -647,6 +666,26 @@ if (APPLE)
|
|||
# sys/osx/macosx_utils.mm
|
||||
# sys/osx/macosx_sys.mm
|
||||
)
|
||||
elseif (WIN32)
|
||||
set(src_sys_base
|
||||
sys/sys_local.cpp
|
||||
sys/win32/win_cpu.cpp
|
||||
# sys/win32/win_gamma.cpp
|
||||
sys/win32/win_glimp.cpp
|
||||
sys/win32/win_input.cpp
|
||||
sys/win32/win_main.cpp
|
||||
sys/win32/win_net.cpp
|
||||
sys/win32/win_qgl.cpp
|
||||
sys/win32/win_shared.cpp
|
||||
sys/win32/win_snd.cpp
|
||||
sys/win32/win_syscon.cpp
|
||||
sys/win32/win_taskkeyhook.cpp
|
||||
sys/win32/win_wndproc.cpp
|
||||
)
|
||||
|
||||
set(src_sys_core
|
||||
${src_stub_util}
|
||||
)
|
||||
else()
|
||||
set(src_sys_base
|
||||
sys/sys_local.cpp
|
||||
|
|
|
@ -92,7 +92,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
//#define ID_DEMO_BUILD
|
||||
|
||||
// don't define ID_ALLOW_TOOLS when we don't want tool code in the executable.
|
||||
#if defined( _WIN32 ) && !defined( ID_DEDICATED ) && !defined( ID_DEMO_BUILD )
|
||||
#if defined( _WIN32 ) && defined(_MFC_VER) && !defined( ID_DEDICATED ) && !defined( ID_DEMO_BUILD )
|
||||
#define ID_ALLOW_TOOLS
|
||||
#endif
|
||||
|
||||
|
|
|
@ -37,29 +37,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#ifdef _WIN32
|
||||
|
||||
#if defined(_MFC_VER) && !defined(_D3SDK) && !defined(GAME_DLL)
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // prevent auto literal to string conversion
|
||||
|
||||
#ifndef _D3SDK
|
||||
#ifndef GAME_DLL
|
||||
|
||||
#define WINVER 0x501
|
||||
|
||||
#if 0
|
||||
// Dedicated server hits unresolved when trying to link this way now. Likely because of the 2010/Win7 transition? - TTimo
|
||||
|
||||
#ifdef ID_DEDICATED
|
||||
// dedicated sets windows version here
|
||||
#define _WIN32_WINNT WINVER
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#else
|
||||
// non-dedicated includes MFC and sets windows version here
|
||||
#include "../tools/comafx/StdAfx.h" // this will go away when MFC goes away
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#include "../tools/comafx/StdAfx.h"
|
||||
|
||||
#endif
|
||||
|
||||
#include <winsock2.h>
|
||||
|
@ -72,9 +52,6 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include <dsound.h>
|
||||
#include <dinput.h>
|
||||
|
||||
#endif /* !GAME_DLL */
|
||||
#endif /* !_D3SDK */
|
||||
|
||||
#pragma warning(disable : 4100) // unreferenced formal parameter
|
||||
#pragma warning(disable : 4244) // conversion to smaller type, possible loss of data
|
||||
#pragma warning(disable : 4714) // function marked as __forceinline not inlined
|
||||
|
|
|
@ -46,20 +46,26 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define CPUSTRING "x86"
|
||||
#define CPU_EASYARGS 1
|
||||
|
||||
#define ALIGN16( x ) __declspec(align(16)) x
|
||||
#define PACKED
|
||||
|
||||
#define _alloca16( x ) ((void *)((((uintptr_t)_alloca( (x)+15 )) + 15) & ~15))
|
||||
|
||||
#define PATHSEPERATOR_STR "\\"
|
||||
#define PATHSEPERATOR_CHAR '\\'
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define ALIGN16( x ) __declspec(align(16)) x
|
||||
#define PACKED __attribute__((packed))
|
||||
#define ID_INLINE __forceinline
|
||||
#define ID_STATIC_TEMPLATE static
|
||||
|
||||
#define assertmem( x, y ) assert( _CrtIsValidPointer( x, y, true ) )
|
||||
#else
|
||||
#define ALIGN16( x ) x __attribute__ ((aligned (16)))
|
||||
#define PACKED
|
||||
#define ID_INLINE inline
|
||||
#define ID_STATIC_TEMPLATE
|
||||
#define assertmem( x, y )
|
||||
#endif
|
||||
|
||||
#define THREAD_RETURN_TYPE dword
|
||||
#define THREAD_RETURN_TYPE DWORD
|
||||
|
||||
#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
|
||||
#define ID_LITTLE_ENDIAN 1
|
||||
|
|
Loading…
Reference in a new issue