Skip to content

Commit

Permalink
ci: build mingw version of SporeModLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Nov 5, 2023
1 parent dc38b77 commit a815c33
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 21 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,15 @@ jobs:
with:
name: SporeModLoader-${{ env.GIT_REVISION }}
path: artifacts/*
mingw-build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Install Packages
run: |
sudo apt-get -y install gcc-mingw-w64 g++-mingw-w64
- name: Build SporeModManager (mingw)
run: |
make MINGW=1 VERBOSE=1 -j$(nproc)
54 changes: 33 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ BINARY_DIR := bin
SOURCE_DIR := SporeModManager
EXE_FILE := SporeModManager
VERBOSE := 0
MINGW := 0

PKG_CONFIG := pkg-config
ifeq ($(MINGW), 0)
CC := gcc
CXX := g++
else
CC := x86_64-w64-mingw32-gcc
CXX := x86_64-w64-mingw32-g++
endif
CFLAGS := \
-I$(THIRDPARTY_DIR)/zlib \
-I$(THIRDPARTY_DIR)/zlib/contrib/minizip
Expand All @@ -18,35 +23,42 @@ CXXFLAGS := -std=c++17 \
-I$(THIRDPARTY_DIR)/tinyxml2 \
-I$(THIRDPARTY_DIR)/zlib \
-I$(THIRDPARTY_DIR)/zlib/contrib/minizip
ifeq ($(MINGW), 0)
OPTFLAGS := -Os -flto
LDFLAGS := -flto -s
OBJ_EXT := o
else
OPTFLAGS := -Os
LDFLAGS := -s -municode -static
OBJ_EXT := obj
endif

OBJECT_FILES := \
$(SOURCE_DIR)/SporeModManagerHelpers/FileVersion.o \
$(SOURCE_DIR)/SporeModManagerHelpers/Path.o \
$(SOURCE_DIR)/SporeModManagerHelpers/SporeMod.o \
$(SOURCE_DIR)/SporeModManagerHelpers/SporeModXml.o \
$(SOURCE_DIR)/SporeModManagerHelpers/String.o \
$(SOURCE_DIR)/SporeModManagerHelpers/UI.o \
$(SOURCE_DIR)/SporeModManagerHelpers/Zip.o \
$(SOURCE_DIR)/SporeModManager.o \
$(SOURCE_DIR)/main.o
$(SOURCE_DIR)/SporeModManagerHelpers/FileVersion.$(OBJ_EXT) \
$(SOURCE_DIR)/SporeModManagerHelpers/Path.$(OBJ_EXT) \
$(SOURCE_DIR)/SporeModManagerHelpers/SporeMod.$(OBJ_EXT) \
$(SOURCE_DIR)/SporeModManagerHelpers/SporeModXml.$(OBJ_EXT) \
$(SOURCE_DIR)/SporeModManagerHelpers/String.$(OBJ_EXT) \
$(SOURCE_DIR)/SporeModManagerHelpers/UI.$(OBJ_EXT) \
$(SOURCE_DIR)/SporeModManagerHelpers/Zip.$(OBJ_EXT) \
$(SOURCE_DIR)/SporeModManager.$(OBJ_EXT) \
$(SOURCE_DIR)/main.$(OBJ_EXT)

HEADER_FILES := \
$(SOURCE_DIR)/SporeModManager.hpp \
$(SOURCE_DIR)/SporeModManagerHelpers.hpp


THIRDPARTY_OBJECT_FILES := \
$(THIRDPARTY_DIR)/tinyxml2/tinyxml2.o \
$(THIRDPARTY_DIR)/zlib/adler32.o \
$(THIRDPARTY_DIR)/zlib/crc32.o \
$(THIRDPARTY_DIR)/zlib/inflate.o \
$(THIRDPARTY_DIR)/zlib/inffast.o \
$(THIRDPARTY_DIR)/zlib/inftrees.o \
$(THIRDPARTY_DIR)/zlib/zutil.o \
$(THIRDPARTY_DIR)/zlib/contrib/minizip/unzip.o \
$(THIRDPARTY_DIR)/zlib/contrib/minizip/ioapi.o
$(THIRDPARTY_DIR)/tinyxml2/tinyxml2.$(OBJ_EXT) \
$(THIRDPARTY_DIR)/zlib/adler32.$(OBJ_EXT) \
$(THIRDPARTY_DIR)/zlib/crc32.$(OBJ_EXT) \
$(THIRDPARTY_DIR)/zlib/inflate.$(OBJ_EXT) \
$(THIRDPARTY_DIR)/zlib/inffast.$(OBJ_EXT) \
$(THIRDPARTY_DIR)/zlib/inftrees.$(OBJ_EXT) \
$(THIRDPARTY_DIR)/zlib/zutil.$(OBJ_EXT) \
$(THIRDPARTY_DIR)/zlib/contrib/minizip/unzip.$(OBJ_EXT) \
$(THIRDPARTY_DIR)/zlib/contrib/minizip/ioapi.$(OBJ_EXT)

THIRDPARTY_HEADER_FILES := \
$(THIRDPARTY_DIR)/zlib/zconf.h
Expand All @@ -58,11 +70,11 @@ else
QUIET :=
endif

%.o: %.c $(THIRDPARTY_HEADER_FILES)
%.$(OBJ_EXT): %.c $(THIRDPARTY_HEADER_FILES)
@echo "CC $<"
$(QUIET)$(CC) -c $< -o $@ $(OPTFLAGS) $(CFLAGS)

%.o: %.cpp $(HEADER_FILES) $(THIRDPARTY_HEADER_FILES)
%.$(OBJ_EXT): %.cpp $(HEADER_FILES) $(THIRDPARTY_HEADER_FILES)
@echo "CXX $<"
$(QUIET)$(CXX) -c $< -o $@ $(OPTFLAGS) $(CXXFLAGS)

Expand Down

0 comments on commit a815c33

Please sign in to comment.