diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index c4c7023..a9f8d9c 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -13,5 +13,23 @@ jobs: runs-on: windows-latest steps: - 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 diff --git a/Makefile b/Makefile index 0afe234..87dbff3 100644 --- a/Makefile +++ b/Makefile @@ -3,34 +3,31 @@ buildFile = build/app # Check for Windows ifeq ($(OS), Windows_NT) - # Set Windows compile macros + # Set Windows macros platform = Windows compiler = g++ options = -pthread -lopengl32 -lgdi32 -lwinmm -mwindows - - # Set Windows commands - cleanCommand = del build\app.exe + THEN = && else # Check for MacOS/Linux - UNAMEOS := $(shell uname) + UNAMEOS = $(shell uname) ifeq ($(UNAMEOS), Linux) - # Set Linux compile macros + # Set Linux macros platform = Linux compiler = g++ options = -l GL -l m -l pthread -l dl -l rt -l X11 libGenDirectory = # Empty endif ifeq ($(UNAMEOS), Darwin) - # Set macOS compile macros + # Set macOS macros platform = macOS compiler = clang++ options = -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL libGenDirectory = src endif - # Set UNIX commands - mkdirOptions = -p - cleanCommand = rm $(buildFile) + # Set UNIX macros + THEN = ; endif # Explicitly set compiler to platform default if unset @@ -53,20 +50,34 @@ submodules: # Copy the relevant header files into includes include: submodules - mkdir $(mkdirOptions) include - cp vendor/raylib-cpp/vendor/raylib/src/raylib.h include/raylib.h - cp vendor/raylib-cpp/vendor/raylib/src/raymath.h include/raymath.h +ifeq ($(platform), Windows) + -mkdir .\include + -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 +endif # Build the raylib static library file and copy it into lib lib: submodules - cd vendor/raylib-cpp/vendor/raylib/src; make PLATFORM=PLATFORM_DESKTOP - mkdir $(mkdirOptions) lib/$(platform) + cd vendor/raylib-cpp/vendor/raylib/src $(THEN) "$(MAKE)" PLATFORM=PLATFORM_DESKTOP +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 +endif # Create the build folder build: - mkdir $(mkdirOptions) build +ifeq ($(platform), Windows) + -mkdir build +else + mkdir -p build +endif # Create the build folder and compile the executable compile: build @@ -78,4 +89,8 @@ execute: # Clean up all relevant files clean: - $(cleanCommand) +ifeq ($(platform), Windows) + -del build\app.exe +else + rm $(buildFile) +endif