Skip to content

Commit

Permalink
Use std::filesystem
Browse files Browse the repository at this point in the history
also update miniz
miniz expects utf8 on windows now
SDL2 already expected utf8 on windows, which may have been handled poorly before
  • Loading branch information
black-sliver committed Nov 2, 2024
1 parent f09eb3e commit 51d828d
Show file tree
Hide file tree
Showing 45 changed files with 1,566 additions and 1,010 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@ jobs:
matrix:
os: [ubuntu-latest, macos-13, macos-latest]
shell: [bash]
extra_make_args: [''] # default build
include:
- os: windows-latest
shell: msys2 {0}
extra_make_args: ''
- os: macos-13
shell: bash
# we now require 10.15 by default, but 10.13 should work with an extra dependency
extra_make_args: 'MACOS_DEPLOYMENT_TARGET=10.13'

name: Test ${{ matrix.os }}
name: Test ${{ matrix.os }} ${{ matrix.extra_make_args }}
runs-on: ${{ matrix.os }}

defaults:
Expand All @@ -52,6 +58,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 +84,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 }}
20 changes: 19 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,31 @@ 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

ifeq ($(HAS_STD_FILESYSTEM), true)
$(info using std::filesystem)
else
$(info using boost::filesystem)
NIX_LD_FLAGS += -lboost_filesystem
NIX_CPP_FLAGS += -DNO_STD_FILESYSTEM
endif

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

0 comments on commit 51d828d

Please sign in to comment.