Skip to content

Commit

Permalink
Cross compilation from linux for windows is now easier
Browse files Browse the repository at this point in the history
  • Loading branch information
ad-oliviero committed Nov 15, 2021
1 parent de6d8d4 commit 9584f76
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
SRC = .
CC = gcc
NAME = Simple_TTT
ifeq ($(shell uname), Linux)
PLATFORM = $(shell uname)
ifeq ($(PLATFORM), Linux)
CFLAGS = -O3
LDFLAGS = -L $(SRC)/lib/raylib -l:libraylib.a -lpthread -lm -ldl
else ifeq ($(shell uname), windows32)
else ifeq ($(PLATFORM), windows32)
CFLAGS = -Wl,--subsystem,windows
LDFLAGS = -L $(SRC)/lib/raylib -l:libraylib.a -lopengl32 -lwinmm -lgdi32 -static -lwinpthread -lwsock32
else ifeq ($(PLATFORM), linux_win)
CC = x86_64-w64-mingw32-gcc
CFLAGS = -Wl,--subsystem,windows
LDFLAGS = -L $(SRC)/lib/raylib -l:libraylib.a -lopengl32 -lwinmm -lgdi32 -static -lwinpthread -lwsock32
endif

.PHONY: server

build: main client gui shapes gameplay server
$(CC) $(CFLAGS) -o $(NAME) *.o $(LDFLAGS)


main:
$(CC) -c -o $(SRC)/$@.o $(SRC)/$@.c

Expand Down
1 change: 1 addition & 0 deletions lib/setup_raylib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ mv raylib/ ../../
# raygui
cd ../../
git clone https://github.com/raysan5/raygui.git
cp ./raylib/src/raylib.h ./raygui/src
14 changes: 14 additions & 0 deletions lib/setup_raylib_cross_linuxforwin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# raylib
rm -rf raylib
git clone https://github.com/raysan5/raylib.git raylib-git
cd raylib-git/src
make PLATFORM=PLATFORM_DESKTOP CC=x86_64-w64-mingw32-gcc
cd ../../
mkdir -p raylib/include
cp raylib-git/src/raylib.h raylib/include
cp raylib-git/libraylib.a raylib/

# raygui
cd ../../
git clone https://github.com/raysan5/raygui.git
cp ./raylib/src/raylib.h ./raygui/src

0 comments on commit 9584f76

Please sign in to comment.