Skip to content

Commit

Permalink
Use std::filesystem
Browse files Browse the repository at this point in the history
miniz expects utf8 on windows now
SDL2 already expected utf8
  • Loading branch information
black-sliver committed Nov 1, 2024
1 parent f09eb3e commit c555eb5
Show file tree
Hide file tree
Showing 43 changed files with 1,458 additions and 1,005 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ jobs:
include:
- os: windows-latest
shell: msys2 {0}
- os: macos-13
shell: bash
extra_make_args: 'MACOS_DEPLOYMENT_TARGET=10.13'
# we now require 10.15 by default, but 10.13 should work with an extra dependency

name: Test ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -52,6 +56,10 @@ jobs:
if: ${{ startsWith(matrix.os, 'macos') }}
run: |
brew install coreutils SDL2 sdl2_ttf sdl2_image [email protected] googletest
- name: Install extra dependencies (brewo)
if: ${{ startsWith(matrix.os, 'macos') && contains(matrix.extra_make_args, 'MACOS_DEPLOYMENT_TARGET') }}
run: |
brew install boost
- name: Install dependencies (msys2)
if: ${{ startsWith(matrix.os, 'windows') }}
uses: msys2/setup-msys2@v2
Expand All @@ -74,6 +82,6 @@ jobs:
with:
submodules: recursive
- name: Build DEBUG
run: make native CONF=DEBUG -j4
run: make native CONF=DEBUG ${{ matrix.extra_make_args }} -j4
- name: Run tests
run: make test CONF=DEBUG
run: make test CONF=DEBUG ${{ matrix.extra_make_args }}
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# NOTE: we may use gifdec in the future to support animations
# for now we use SDL2_image GIF support only
CONF ?= RELEASE # make CONF=DEBUG for debug, CONF=DIST for .zip
MACOS_DEPLOYMENT_TARGET ?= 10.15
SRC_DIR = src
TEST_DIR = test
LIB_DIR = lib
Expand Down Expand Up @@ -172,14 +173,27 @@ WIN64_LD_FLAGS = $(LD_FLAGS)
NIX_LD_FLAGS = $(LD_FLAGS)
NIX_C_FLAGS = $(C_FLAGS) -DLUA_USE_READLINE -DLUA_USE_LINUX
NIX_LUA_C_FLAGS = $(LUA_C_FLAGS) -DLUA_USE_READLINE -DLUA_USE_LINUX

ifdef IS_OSX
BREW_PREFIX := $(shell brew --prefix)
DEPLOYMENT_TARGET=10.12
DEPLOYMENT_TARGET = MACOS_DEPLOYMENT_TARGET
DEPLOYMENT_TARGET_MAJOR := $(shell echo $(DEPLOYMENT_TARGET) | cut -f1 -d.)
DEPLOYMENT_TARGET_MINOR := $(shell echo $(DEPLOYMENT_TARGET) | cut -f2 -d.)
# NOTE: on macos before 10.15 we have to use boost::filesystem instead of std::filesystem
# This is currently not built automatically. Please open an issue if you really need a build for macos<10.15.
HAS_STD_FILESYSTEM := $(shell [ $(DEPLOYMENT_TARGET_MAJOR) -gt 10 -o \( $(DEPLOYMENT_TARGET_MAJOR) -eq 10 -a $(DEPLOYMENT_TARGET_MINOR) -ge 15 \) ] && echo true)
NIX_CPP_FLAGS += -mmacosx-version-min=$(DEPLOYMENT_TARGET) -I$(BREW_PREFIX)/opt/[email protected]/include -I$(BREW_PREFIX)/include
NIX_LD_FLAGS += -mmacosx-version-min=$(DEPLOYMENT_TARGET) -L$(BREW_PREFIX)/opt/[email protected]/lib -L$(BREW_PREFIX)/lib
NIX_C_FLAGS += -mmacosx-version-min=$(DEPLOYMENT_TARGET) -I$(BREW_PREFIX)/opt/[email protected]/include -I$(BREW_PREFIX)/include
NIX_LUA_C_FLAGS += -mmacosx-version-min=$(DEPLOYMENT_TARGET) -I$(BREW_PREFIX)/opt/[email protected]/include -I$(BREW_PREFIX)/include
else
HAS_STD_FILESYSTEM ?= true
endif

ifneq (HAS_STD_FILESYSTEM, true)
NIX_LD_FLAGS += -lboost_filesystem
endif

ifeq ($(CONF), DEBUG) # DEBUG
WINDRES_FLAGS =
else
Expand Down
Loading

0 comments on commit c555eb5

Please sign in to comment.