Merge pull request #2 from CapsCollective/Windows

Got windows building. Need to test with CI/CD
This commit is contained in:
Aryeh 2020-11-30 15:16:21 +11:00 committed by GitHub
commit f5c8e231be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 19 deletions

View File

@ -13,5 +13,23 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: make
run: mingw32-make - name: make setup
run: mingw32-make setup
shell: cmd
- name: make compile
run: mingw32-make compile
shell: cmd
- name: make clean
run: mingw32-make clean
shell: cmd
- name: make compile CXX=g++
run: mingw32-make compile CXX=g++
shell: cmd
- name: make clean
run: mingw32-make clean
shell: cmd

View File

@ -3,34 +3,31 @@ buildFile = build/app
# Check for Windows # Check for Windows
ifeq ($(OS), Windows_NT) ifeq ($(OS), Windows_NT)
# Set Windows compile macros # Set Windows macros
platform = Windows platform = Windows
compiler = g++ compiler = g++
options = -pthread -lopengl32 -lgdi32 -lwinmm -mwindows options = -pthread -lopengl32 -lgdi32 -lwinmm -mwindows
THEN = &&
# Set Windows commands
cleanCommand = del build\app.exe
else else
# Check for MacOS/Linux # Check for MacOS/Linux
UNAMEOS := $(shell uname) UNAMEOS = $(shell uname)
ifeq ($(UNAMEOS), Linux) ifeq ($(UNAMEOS), Linux)
# Set Linux compile macros # Set Linux macros
platform = Linux platform = Linux
compiler = g++ compiler = g++
options = -l GL -l m -l pthread -l dl -l rt -l X11 options = -l GL -l m -l pthread -l dl -l rt -l X11
libGenDirectory = # Empty libGenDirectory = # Empty
endif endif
ifeq ($(UNAMEOS), Darwin) ifeq ($(UNAMEOS), Darwin)
# Set macOS compile macros # Set macOS macros
platform = macOS platform = macOS
compiler = clang++ compiler = clang++
options = -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL options = -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL
libGenDirectory = src libGenDirectory = src
endif endif
# Set UNIX commands # Set UNIX macros
mkdirOptions = -p THEN = ;
cleanCommand = rm $(buildFile)
endif endif
# Explicitly set compiler to platform default if unset # Explicitly set compiler to platform default if unset
@ -53,20 +50,34 @@ submodules:
# Copy the relevant header files into includes # Copy the relevant header files into includes
include: submodules include: submodules
mkdir $(mkdirOptions) include ifeq ($(platform), Windows)
cp vendor/raylib-cpp/vendor/raylib/src/raylib.h include/raylib.h -mkdir .\include
cp vendor/raylib-cpp/vendor/raylib/src/raymath.h include/raymath.h -robocopy "vendor\raylib-cpp\vendor\raylib\src" "include" raylib.h raymath.h
-robocopy "vendor\raylib-cpp\include" "include" *.hpp
else
mkdir -p include
cp vendor/raylib-cpp/vendor/raylib/src/raylib.h vendor/raylib-cpp/vendor/raylib/src/raymath.h include
cp vendor/raylib-cpp/include/*.hpp include cp vendor/raylib-cpp/include/*.hpp include
endif
# Build the raylib static library file and copy it into lib # Build the raylib static library file and copy it into lib
lib: submodules lib: submodules
cd vendor/raylib-cpp/vendor/raylib/src; make PLATFORM=PLATFORM_DESKTOP cd vendor/raylib-cpp/vendor/raylib/src $(THEN) "$(MAKE)" PLATFORM=PLATFORM_DESKTOP
mkdir $(mkdirOptions) lib/$(platform) ifeq ($(platform), Windows)
-mkdir lib\$(platform)
-robocopy "vendor\raylib-cpp\vendor\raylib\src" "lib\Windows" libraylib.a
else
mkdir -p lib/$(platform)
cp vendor/raylib-cpp/vendor/raylib/$(libGenDirectory)/libraylib.a lib/$(platform)/libraylib.a cp vendor/raylib-cpp/vendor/raylib/$(libGenDirectory)/libraylib.a lib/$(platform)/libraylib.a
endif
# Create the build folder # Create the build folder
build: build:
mkdir $(mkdirOptions) build ifeq ($(platform), Windows)
-mkdir build
else
mkdir -p build
endif
# Create the build folder and compile the executable # Create the build folder and compile the executable
compile: build compile: build
@ -78,4 +89,8 @@ execute:
# Clean up all relevant files # Clean up all relevant files
clean: clean:
$(cleanCommand) ifeq ($(platform), Windows)
-del build\app.exe
else
rm $(buildFile)
endif