build: add ability to compile for WIN64 using MinGW64

Fix a few minor int<->pointer size warnings.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
Kevin Shanahan 2013-03-15 21:49:16 +10:30
parent 636a94f260
commit b4ff9663cc
3 changed files with 25 additions and 4 deletions

View File

@ -43,6 +43,17 @@ EXT=.exe
DPTHREAD=
LPTHREAD=
ifneq ($(HOST_OS),WIN32)
TARGET ?= $(MINGW32_CROSS_GUESS)
CC = $(TARGET)-gcc
STRIP = $(TARGET)-strip
endif
else
ifeq ($(TARGET_OS),WIN64)
EXT=.exe
DPTHREAD=
LPTHREAD=
ifneq ($(HOST_OS),WIN64)
TARGET ?= $(MINGW64_CROSS_GUESS)
CC = $(TARGET)-gcc
STRIP = $(TARGET)-strip
endif
@ -51,6 +62,7 @@ EXT=
DPTHREAD=-DUSE_PTHREADS -pthread
LPTHREAD=-lpthread
endif
endif
#BIN_PFX ?= tyr-
BIN_PFX ?=
@ -87,7 +99,7 @@ endif
# i486-mingw32 (Arch).
# ------------------------------------------------------------------------
MINGW_CROSS_GUESS := $(shell \
MINGW32_CROSS_GUESS := $(shell \
if which i486-mingw32-gcc > /dev/null 2>&1; then \
echo i486-mingw32; \
elif which i586-mingw32msvc-gcc > /dev/null 2>&1; then \
@ -96,6 +108,13 @@ MINGW_CROSS_GUESS := $(shell \
echo i386-mingw32msvc; \
fi)
MINGW64_CROSS_GUESS := $(shell \
if which x86_64-w64-mingw32-gcc > /dev/null 2>&1; then \
echo x86_64-w64-mingw32; \
else \
echo x86_64-w64-mingw32; \
fi)
# --------------------------------
# GCC option checking
# --------------------------------

View File

@ -1,5 +1,7 @@
/* common/threads.c */
#include <stdint.h>
#include <common/cmdlib.h>
#include <common/log.h>
#include <common/threads.h>
@ -103,7 +105,7 @@ ThreadUnlock(void)
void
RunThreadsOn(int start, int workcnt, void *(func)(void *))
{
int i;
uintptr_t i; /* avoid warning due to cast for the CreateThread API */
DWORD *threadid;
HANDLE *threadhandle;

View File

@ -190,12 +190,12 @@ LightWorld(void)
lightdatasize /= 4;
/* align filebase to a 4 byte boundary */
filebase = file_p = (byte *)(((unsigned long)dlightdata + 3) & ~3);
filebase = file_p = (byte *)(((uintptr_t)dlightdata + 3) & ~3);
file_end = filebase + lightdatasize;
if (colored) {
/* litfile data stored in dlightdata, after the white light */
lit_filebase = file_end + 12 - ((unsigned long)file_end % 12);
lit_filebase = file_end + 12 - ((uintptr_t)file_end % 12);
lit_file_p = lit_filebase;
lit_file_end = lit_filebase + 3 * (MAX_MAP_LIGHTING / 4);
}