diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4bc0472..29ca3ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,9 +27,19 @@ jobs: uses: actions/checkout@v4 - name: Install packages run: sudo apt-get install mingw-w64 + - name: Get my CMake files + run: git clone https://github.com/nishiowo/cmake cmake-files --depth=1 - name: Get and extract ODE run: wget https://sourceforge.net/projects/opende/files/ODE/0.13/ode-0.13.tar.gz/download -O - | tar xvzf - - name: Build ODE run: cd ode-0.13 && ./configure --host=i686-w64-mingw32 --prefix=/ --disable-demos --without-drawstuff --enable-shared && make - name: Install ODE run: make -C ode-0.13 install DESTDIR=`pwd`/deps + - name: Get Pawn + run: git clone https://github.com/nishiowo/pawn --depth=1 + - name: Build Pawn + run: cd pawn && mkdir build && cd build && cmake -DDEBIAN=ON -DCMAKE_TOOLCHAIN_FILE=../../cmake-files/windows.cmake -DARCH=i686 .. -DCMAKE_INSTALL_PREFIX=/ && make + - name: Install Pawn + run: make -C pawn/build install DESTDIR=`pwd`/deps + - name: Build NishBox + run: make PLATFORM=win32 diff --git a/Makefile b/Makefile index e9341df..c26d55d 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,35 @@ export +ifeq ($(PLATFORM),win32) +TARGET_PREFIX=i686-w64-mingw32- + +ODE_CFLAGS = -I../deps/include +ODE_LIBS = -L../deps/lib -lode +AMX_CFLAGS = -I../deps/include +AMX_LIBS = -L../deps/lib -lamx +GL_CFLAGS = +GL_LIBS = -lopengl32 -lgdi32 + +BACKEND = WGL + +EXEC = .exe +endif + +ifeq ($(PLATFORM),win64) +TARGET_PREFIX=x86_64-w64-mingw32- + +ODE_CFLAGS = -I../deps/include +ODE_LIBS = -L../deps/lib -lode +AMX_CFLAGS = -I../deps/include +AMX_LIBS = -L../deps/lib -lamx +GL_CFLAGS = +GL_LIBS = -lopengl32 -lgdi32 + +BACKEND = WGL + +EXEC = .exe +endif + +ifeq ($(PLATFORM),) ODE_CFLAGS = `pkg-config --cflags ode` ODE_LIBS = `pkg-config --libs ode` AMX_CFLAGS = `pkg-config --cflags amx` @@ -8,14 +39,15 @@ GL_LIBS = `pkg-config --libs gl` BACKEND = GLX +EXEC = +endif + AR = $(TARGET_PREFIX)ar CC = $(TARGET_PREFIX)gcc CFLAGS = -D_DEFAULT_SOURCE -DUSE_$(BACKEND) -I../engine $(ODE_CFLAGS) $(AMX_CFLAGS) $(GL_CFLAGS) LDFLAGS = LIBS = $(ODE_LIBS) $(AMX_LIBS) $(GL_LIBS) -EXEC = - .PHONY: all format clean ./engine ./src all: ./src diff --git a/src/Makefile b/src/Makefile index 7e2c95b..cb820bd 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,4 +4,4 @@ OBJS = main.o include ../common.mk $(TARGET): $(OBJS) ../engine/libnishbox.a - $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) ../engine/libnishbox.a + $(CC) $(LDFLAGS) -o $@ $(OBJS) ../engine/libnishbox.a $(LIBS)