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:
parent
636a94f260
commit
b4ff9663cc
21
Makefile
21
Makefile
|
|
@ -43,6 +43,17 @@ EXT=.exe
|
||||||
DPTHREAD=
|
DPTHREAD=
|
||||||
LPTHREAD=
|
LPTHREAD=
|
||||||
ifneq ($(HOST_OS),WIN32)
|
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
|
CC = $(TARGET)-gcc
|
||||||
STRIP = $(TARGET)-strip
|
STRIP = $(TARGET)-strip
|
||||||
endif
|
endif
|
||||||
|
|
@ -51,6 +62,7 @@ EXT=
|
||||||
DPTHREAD=-DUSE_PTHREADS -pthread
|
DPTHREAD=-DUSE_PTHREADS -pthread
|
||||||
LPTHREAD=-lpthread
|
LPTHREAD=-lpthread
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
#BIN_PFX ?= tyr-
|
#BIN_PFX ?= tyr-
|
||||||
BIN_PFX ?=
|
BIN_PFX ?=
|
||||||
|
|
@ -87,7 +99,7 @@ endif
|
||||||
# i486-mingw32 (Arch).
|
# i486-mingw32 (Arch).
|
||||||
# ------------------------------------------------------------------------
|
# ------------------------------------------------------------------------
|
||||||
|
|
||||||
MINGW_CROSS_GUESS := $(shell \
|
MINGW32_CROSS_GUESS := $(shell \
|
||||||
if which i486-mingw32-gcc > /dev/null 2>&1; then \
|
if which i486-mingw32-gcc > /dev/null 2>&1; then \
|
||||||
echo i486-mingw32; \
|
echo i486-mingw32; \
|
||||||
elif which i586-mingw32msvc-gcc > /dev/null 2>&1; then \
|
elif which i586-mingw32msvc-gcc > /dev/null 2>&1; then \
|
||||||
|
|
@ -96,6 +108,13 @@ MINGW_CROSS_GUESS := $(shell \
|
||||||
echo i386-mingw32msvc; \
|
echo i386-mingw32msvc; \
|
||||||
fi)
|
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
|
# GCC option checking
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
/* common/threads.c */
|
/* common/threads.c */
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <common/cmdlib.h>
|
#include <common/cmdlib.h>
|
||||||
#include <common/log.h>
|
#include <common/log.h>
|
||||||
#include <common/threads.h>
|
#include <common/threads.h>
|
||||||
|
|
@ -103,7 +105,7 @@ ThreadUnlock(void)
|
||||||
void
|
void
|
||||||
RunThreadsOn(int start, int workcnt, void *(func)(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;
|
DWORD *threadid;
|
||||||
HANDLE *threadhandle;
|
HANDLE *threadhandle;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -190,12 +190,12 @@ LightWorld(void)
|
||||||
lightdatasize /= 4;
|
lightdatasize /= 4;
|
||||||
|
|
||||||
/* align filebase to a 4 byte boundary */
|
/* 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;
|
file_end = filebase + lightdatasize;
|
||||||
|
|
||||||
if (colored) {
|
if (colored) {
|
||||||
/* litfile data stored in dlightdata, after the white light */
|
/* 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_p = lit_filebase;
|
||||||
lit_file_end = lit_filebase + 3 * (MAX_MAP_LIGHTING / 4);
|
lit_file_end = lit_filebase + 3 * (MAX_MAP_LIGHTING / 4);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue