mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-25 13:31:10 +00:00
* Support for MinGW cross compilation
This commit is contained in:
parent
aa3f7e1eb1
commit
310190a466
7 changed files with 104 additions and 102 deletions
76
README
76
README
|
@ -55,6 +55,28 @@ haven't set it. Which is where the id patch installs by default.
|
|||
Then run "make copyfiles", beware that this will overwrite any binaries
|
||||
installed previously, even official id ones.
|
||||
|
||||
Compiling under Windows using MinGW
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
It is possible to compile ioQ3 using the MinGW (Minimalist GNU for Windows)
|
||||
toolset. It's a little more involved than compiling for Linux; steps are as
|
||||
follows:
|
||||
|
||||
1. Download and install MinGW and MSys from http://www.mingw.org/.
|
||||
2. Download http://www.libsdl.org/extras/win32/common/directx-devel.tar.gz
|
||||
and untar in into your MinGW directory (usually C:\MinGW).
|
||||
3. Perform the usual precompilation sacrificial ritual.
|
||||
4. Open an MSys terminal, and follow the instructions for compiling on Linux.
|
||||
5. Steal underpants
|
||||
6. ?????
|
||||
7. Profit!
|
||||
|
||||
It is also possible to cross compile for Windows using MinGW. A script is
|
||||
available to build a cross compilation environment from
|
||||
http://www.libsdl.org/extras/win32/cross/build-cross.sh. The gcc/binutils
|
||||
version numbers that the script downloads may need to be altered. After you
|
||||
have successfully run this script cross compiling is simply a case of using
|
||||
'./cross-make-mingw.sh' in place of 'make'.
|
||||
|
||||
Using shared libraries instead of qvm
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
To make quake3 prefer shared libraries instead of qvm run it with
|
||||
|
@ -63,7 +85,7 @@ the following parameters:
|
|||
|
||||
Using Demo Data Files
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
you only need demoq3/pak0.pk3 from the demo installer. The qvm files inside
|
||||
You only need demoq3/pak0.pk3 from the demo installer. The qvm files inside
|
||||
pak0.pk3 will not work, you have to use the native shared libraries from this
|
||||
project. To do so copy or link ui*.so, qagame*.so, cgame*.so from baseq3 to
|
||||
demoq3 and run quake3 with the parameters described above.
|
||||
|
@ -80,58 +102,6 @@ prototype with long.
|
|||
|
||||
Note if you simply wish to run mods on a 64bit platform you do not need to
|
||||
recompile anything since by default Q3 uses a virtual machine system.
|
||||
Futhermore, ioq3 has an experimental JIT compiler for x86_64 which will result
|
||||
in better performance. To enable this find these lines in code/Makefile:
|
||||
|
||||
# experimental x86_64 jit compiler! you need as
|
||||
#HAVE_VM_COMPILED = true
|
||||
|
||||
..and change them to:
|
||||
|
||||
# experimental x86_64 jit compiler! you need as
|
||||
HAVE_VM_COMPILED = true
|
||||
|
||||
Compiling under windows using MinGW
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
It is possible to compile ioQ3 using the MinGW (Minimalist GNU for Windows)
|
||||
toolset. It's a little more involved than compiling for linux; steps are as
|
||||
follows:
|
||||
|
||||
1. Download and install MinGW and MSys from http://www.mingw.org/.
|
||||
2. Download and install the DirectX 9 SDK from
|
||||
http://msdn.microsoft.com/directx/. Previous versions of the SDK will
|
||||
probably work, but they have not been tested.
|
||||
3. Find the following in DXSDK/Include/dinput.h...
|
||||
|
||||
} DIDEVICEINSTANCEW, *LPDIDEVICEINSTANCEW;
|
||||
#ifdef UNICODE
|
||||
typedef DIDEVICEINSTANCEW DIDEVICEINSTANCE;
|
||||
typedef LPDIDEVICEINSTANCEW LPDIDEVICEINSTANCE;
|
||||
#else
|
||||
typedef DIDEVICEINSTANCEA DIDEVICEINSTANCE;
|
||||
typedef LPDIDEVICEINSTANCEA LPDIDEVICEINSTANCE;
|
||||
#endif // UNICODE
|
||||
|
||||
typedef const DIDEVICEINSTANCEA *LPCDIDEVICEINSTANCEA;
|
||||
typedef const DIDEVICEINSTANCEW *LPCDIDEVICEINSTANCEW;
|
||||
> #ifdef UNICODE
|
||||
> typedef DIDEVICEINSTANCEW DIDEVICEINSTANCE;
|
||||
> typedef LPCDIDEVICEINSTANCEW LPCDIDEVICEINSTANCE;
|
||||
> #else
|
||||
> typedef DIDEVICEINSTANCEA DIDEVICEINSTANCE;
|
||||
> typedef LPCDIDEVICEINSTANCEA LPCDIDEVICEINSTANCE;
|
||||
> #endif // UNICODE
|
||||
typedef const DIDEVICEINSTANCE *LPCDIDEVICEINSTANCE;
|
||||
|
||||
...and comment out/remove the duplicated code marked by '>'.
|
||||
|
||||
4. If you didn't install the DirectX SDK in C:\DXSDK\, add DXSDK_DIR to
|
||||
code/unix/Makefile.local to reflect the new location.
|
||||
5. Perform the usual precompilation sacrificial ritual.
|
||||
6. Open an MSys terminal, and follow the instructions for compiling on Linux.
|
||||
7. Steal underpants
|
||||
8. ?????
|
||||
9. Profit!
|
||||
|
||||
Creating mods compatible with Q3 1.32b
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -42,7 +42,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <gl/gl.h>
|
||||
#include <GL/gl.h>
|
||||
|
||||
#elif defined(MACOS_X)
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# yeah, couldn't do more simple really
|
||||
|
||||
PLATFORM=$(shell uname|sed -e s/_.*//|tr A-Z a-z)
|
||||
ifeq ($(PLATFORM),mingw32)
|
||||
BINEXT=.exe
|
||||
else
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
PLATFORM=$(shell uname|sed -e s/_.*//|tr A-Z a-z)
|
||||
TEMPDIR=/tmp
|
||||
A=.a
|
||||
O=.o
|
||||
|
@ -19,7 +18,7 @@ RANLIB=ranlib
|
|||
DIFF=diff
|
||||
RM=rm -f
|
||||
RMDIR=rmdir
|
||||
BUILDDIR=build
|
||||
BUILDDIR=build-$(PLATFORM)-$(ARCH)
|
||||
BD=$(BUILDDIR)/
|
||||
|
||||
ifeq ($(USE_CCACHE),1)
|
||||
|
|
|
@ -11,18 +11,13 @@
|
|||
# GNU Make required
|
||||
#
|
||||
|
||||
PLATFORM=$(shell uname|sed -e s/_.*//|tr A-Z a-z)
|
||||
PLATFORM_RELEASE=$(shell uname -r)
|
||||
COMPILE_PLATFORM=$(shell uname|sed -e s/_.*//|tr A-Z a-z)
|
||||
|
||||
# Apple does some things a little differently...
|
||||
ifeq ($(PLATFORM),darwin)
|
||||
ARCH:= $(shell uname -p | sed -e s/i.86/i386/)
|
||||
ifeq ($(COMPILE_PLATFORM),darwin)
|
||||
# Apple does some things a little differently...
|
||||
COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/i386/)
|
||||
else
|
||||
ARCH:=$(shell uname -m | sed -e s/i.86/i386/)
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),powerpc)
|
||||
ARCH:=ppc
|
||||
COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/i386/)
|
||||
endif
|
||||
|
||||
#############################################################################
|
||||
|
@ -35,6 +30,31 @@ endif
|
|||
#############################################################################
|
||||
-include Makefile.local
|
||||
|
||||
ifndef PLATFORM
|
||||
PLATFORM=$(COMPILE_PLATFORM)
|
||||
endif
|
||||
export PLATFORM
|
||||
|
||||
ifndef ARCH
|
||||
ARCH=$(COMPILE_ARCH)
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),powerpc)
|
||||
ARCH=ppc
|
||||
endif
|
||||
export ARCH
|
||||
|
||||
ifneq ($(PLATFORM),$(COMPILE_PLATFORM))
|
||||
CROSS_COMPILING=1
|
||||
else
|
||||
CROSS_COMPILING=0
|
||||
|
||||
ifneq ($(ARCH),$(COMPILE_ARCH))
|
||||
CROSS_COMPILING=1
|
||||
endif
|
||||
endif
|
||||
export CROSS_COMPILING
|
||||
|
||||
ifndef COPYDIR
|
||||
COPYDIR="/usr/local/games/quake3"
|
||||
endif
|
||||
|
@ -48,11 +68,6 @@ ifndef GENERATE_DEPENDENCIES
|
|||
GENERATE_DEPENDENCIES=1
|
||||
endif
|
||||
|
||||
# Used for building with mingw
|
||||
ifndef DXSDK_DIR
|
||||
DXSDK_DIR=C:/DXSDK
|
||||
endif
|
||||
|
||||
ifndef USE_CCACHE
|
||||
USE_CCACHE=0
|
||||
endif
|
||||
|
@ -84,8 +99,8 @@ endif
|
|||
|
||||
#############################################################################
|
||||
|
||||
BD=debug$(ARCH)$(GLIBC)
|
||||
BR=release$(ARCH)$(GLIBC)
|
||||
BD=debug-$(PLATFORM)-$(ARCH)
|
||||
BR=release-$(PLATFORM)-$(ARCH)
|
||||
CDIR=$(MOUNT_DIR)/client
|
||||
SDIR=$(MOUNT_DIR)/server
|
||||
RDIR=$(MOUNT_DIR)/renderer
|
||||
|
@ -343,13 +358,10 @@ else # ifeq darwin
|
|||
|
||||
ifeq ($(PLATFORM),mingw32)
|
||||
|
||||
GLIBC=-mingw
|
||||
CC=gcc
|
||||
WINDRES=windres
|
||||
|
||||
ifeq ($(ARCH),i386)
|
||||
ARCH=x86
|
||||
endif
|
||||
|
||||
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
|
||||
|
||||
|
@ -357,8 +369,6 @@ ifeq ($(PLATFORM),mingw32)
|
|||
BASE_CFLAGS += -DUSE_OPENAL=1 -DUSE_OPENAL_DLOPEN=1
|
||||
endif
|
||||
|
||||
DX_CFLAGS = -I$(DXSDK_DIR)/Include
|
||||
|
||||
GL_CFLAGS =
|
||||
MINGW_CFLAGS = -DDONT_TYPEDEF_INT32
|
||||
|
||||
|
@ -697,6 +707,17 @@ ifneq ($(BUILD_CLIENT),1)
|
|||
$(subst $(B)/$(PLATFORM)quake3$(BINEXT),,$(TARGETS) ))))))))))
|
||||
endif
|
||||
|
||||
# Never build qvms when cross-compiling
|
||||
ifeq ($(CROSS_COMPILING),1)
|
||||
TARGETS := \
|
||||
$(subst $(B)/baseq3/vm/qagame.qvm,,\
|
||||
$(subst $(B)/baseq3/vm/cgame.qvm,,\
|
||||
$(subst $(B)/baseq3/vm/ui.qvm,,\
|
||||
$(subst $(B)/missionpack/vm/qagame.qvm,,\
|
||||
$(subst $(B)/missionpack/vm/cgame.qvm,,\
|
||||
$(subst $(B)/missionpack/vm/ui.qvm,,$(TARGETS) ))))))
|
||||
endif
|
||||
|
||||
ifdef DEFAULT_BASEDIR
|
||||
BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\"
|
||||
endif
|
||||
|
@ -769,9 +790,14 @@ makedirs:
|
|||
Q3LCC=../tools/q3lcc$(BINEXT)
|
||||
Q3ASM=../tools/q3asm$(BINEXT)
|
||||
|
||||
ifeq ($(CROSS_COMPILING),1)
|
||||
tools:
|
||||
echo QVM tools not built when cross-compiling
|
||||
else
|
||||
tools:
|
||||
$(MAKE) -C ../tools/lcc install
|
||||
$(MAKE) -C ../tools/asm install
|
||||
endif
|
||||
|
||||
DO_Q3LCC=$(Q3LCC) -o $@ $<
|
||||
|
||||
|
@ -1287,16 +1313,16 @@ $(B)/client/matha.o : $(UDIR)/matha.s; $(DO_AS)
|
|||
$(B)/client/ftola.o : $(UDIR)/ftola.s; $(DO_AS)
|
||||
$(B)/client/snapvectora.o : $(UDIR)/snapvectora.s; $(DO_AS)
|
||||
|
||||
$(B)/client/win_gamma.o : $(W32DIR)/win_gamma.c; $(DO_CC) $(DX_CFLAGS)
|
||||
$(B)/client/win_glimp.o : $(W32DIR)/win_glimp.c; $(DO_CC) $(DX_CFLAGS)
|
||||
$(B)/client/win_input.o : $(W32DIR)/win_input.c; $(DO_CC) $(DX_CFLAGS)
|
||||
$(B)/client/win_main.o : $(W32DIR)/win_main.c; $(DO_CC) $(DX_CFLAGS)
|
||||
$(B)/client/win_net.o : $(W32DIR)/win_net.c; $(DO_CC) $(DX_CFLAGS)
|
||||
$(B)/client/win_qgl.o : $(W32DIR)/win_qgl.c; $(DO_CC) $(DX_CFLAGS)
|
||||
$(B)/client/win_shared.o : $(W32DIR)/win_shared.c; $(DO_CC) $(DX_CFLAGS)
|
||||
$(B)/client/win_snd.o : $(W32DIR)/win_snd.c; $(DO_CC) $(DX_CFLAGS)
|
||||
$(B)/client/win_syscon.o : $(W32DIR)/win_syscon.c; $(DO_CC) $(DX_CFLAGS)
|
||||
$(B)/client/win_wndproc.o : $(W32DIR)/win_wndproc.c; $(DO_CC) $(DX_CFLAGS)
|
||||
$(B)/client/win_gamma.o : $(W32DIR)/win_gamma.c; $(DO_CC)
|
||||
$(B)/client/win_glimp.o : $(W32DIR)/win_glimp.c; $(DO_CC)
|
||||
$(B)/client/win_input.o : $(W32DIR)/win_input.c; $(DO_CC)
|
||||
$(B)/client/win_main.o : $(W32DIR)/win_main.c; $(DO_CC)
|
||||
$(B)/client/win_net.o : $(W32DIR)/win_net.c; $(DO_CC)
|
||||
$(B)/client/win_qgl.o : $(W32DIR)/win_qgl.c; $(DO_CC)
|
||||
$(B)/client/win_shared.o : $(W32DIR)/win_shared.c; $(DO_CC)
|
||||
$(B)/client/win_snd.o : $(W32DIR)/win_snd.c; $(DO_CC)
|
||||
$(B)/client/win_syscon.o : $(W32DIR)/win_syscon.c; $(DO_CC)
|
||||
$(B)/client/win_wndproc.o : $(W32DIR)/win_wndproc.c; $(DO_CC)
|
||||
$(B)/client/win_resource.o : $(W32DIR)/winquake.rc; $(DO_WINDRES)
|
||||
|
||||
$(B)/client/vm_x86.o : $(CMDIR)/vm_x86.c; $(DO_CC)
|
||||
|
|
|
@ -47,7 +47,7 @@ static char sys_cmdline[MAX_STRING_CHARS];
|
|||
#define ALT_SPANK
|
||||
#ifdef ALT_SPANK
|
||||
#include <stdio.h>
|
||||
#include <sys\stat.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
int fh = 0;
|
||||
|
||||
|
@ -528,7 +528,6 @@ extern char *FS_BuildOSPath( const char *base, const char *game, const char *qp
|
|||
// fqpath buffersize must be at least MAX_QPATH+1 bytes long
|
||||
void * QDECL Sys_LoadDll( const char *name, char *fqpath , long (QDECL **entryPoint)(long, ...),
|
||||
long (QDECL *systemcalls)(long, ...) ) {
|
||||
static int lastWarning = 0;
|
||||
HINSTANCE libHandle;
|
||||
void (QDECL *dllEntry)( long (QDECL *syscallptr)(long, ...) );
|
||||
char *basepath;
|
||||
|
@ -536,6 +535,7 @@ void * QDECL Sys_LoadDll( const char *name, char *fqpath , long (QDECL **entryPo
|
|||
char *gamedir;
|
||||
char *fn;
|
||||
#ifdef NDEBUG
|
||||
static int lastWarning = 0;
|
||||
int timestamp;
|
||||
int ret;
|
||||
#endif
|
||||
|
|
8
cross-make-mingw.sh
Executable file
8
cross-make-mingw.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
PREFIX=/usr/local/cross-tools
|
||||
TARGET=i386-mingw32msvc
|
||||
PATH="$PREFIX/bin:$PREFIX/$TARGET/bin:$PATH"
|
||||
export PATH
|
||||
export PLATFORM=mingw32
|
||||
exec make $*
|
Loading…
Reference in a new issue