-
Notifications
You must be signed in to change notification settings - Fork 103
MacOs ci #4552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
MacOs ci #4552
Changes from all commits
013f2ad
8909f7f
302feef
8ebe9a6
0c69cab
26ded90
154ac6d
af2168f
5567c66
be450a1
24a5c86
d0fa16c
4f59317
b9d10e9
c99fabc
4b805a2
5691574
afe52e1
24a5957
a34f3a2
25f335a
565582b
a043694
c154cc1
cad551d
673ba50
b789030
118427e
669ceee
3f5f064
7951e39
7a81dc6
b738d4c
ef678ab
b77aadd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,81 @@ STRIP ?= strip | |
| ECHO ?= echo | ||
| MV ?= mv -f | ||
|
|
||
| PLATFORM ?= $(shell uname -s) | ||
| ARCH ?= $(shell uname -m) | ||
|
|
||
| ifeq ($(PLATFORM),Linux) | ||
| PLATFORM := linux | ||
| endif | ||
| ifeq ($(PLATFORM),Darwin) | ||
| PLATFORM := mac | ||
| endif | ||
| ifeq ($(PLATFORM),macos) | ||
| PLATFORM := mac | ||
| endif | ||
|
|
||
| ifeq ($(ARCH),amd64) | ||
| ARCH := x86_64 | ||
| endif | ||
| ifeq ($(ARCH),aarch64) | ||
| ARCH := arm64 | ||
| endif | ||
|
|
||
| DEPS_ASTRONOMY_TAG ?= 20250418 | ||
| DEPS_CENTIJSON_TAG ?= 20250418 | ||
| DEPS_ENET6_TAG ?= 20260213 | ||
| DEPS_ASTRONOMY_REPO ?= https://github.com/cosinekitty/astronomy.git | ||
| DEPS_CENTIJSON_REPO ?= https://github.com/mity/centijson.git | ||
| DEPS_ENET6_REPO ?= https://github.com/SirLynix/enet6.git | ||
| DEPS_ASTRONOMY_REF ?= | ||
| DEPS_CENTIJSON_REF ?= | ||
| DEPS_ENET6_REF ?= | ||
| DEPS_CLONE_DEPTH ?= 1 | ||
| DEPS_BUILD_DIR ?= deps/_build | ||
| DEPS_SUFFIX ?= | ||
| DEPS_DOWNLOAD ?= 1 | ||
|
|
||
| ifeq ($(PLATFORM),linux) | ||
| ifeq ($(ARCH),x86_64) | ||
| DEPS_SUFFIX ?= lin64 | ||
| else | ||
| # No prebuilt dependency archive defined for this architecture; disable downloads. | ||
| DEPS_DOWNLOAD ?= 0 | ||
| endif | ||
| endif | ||
| ifeq ($(PLATFORM),mac) | ||
| DEPS_DOWNLOAD ?= 0 | ||
| endif | ||
|
|
||
| ifeq ($(PLATFORM),linux) | ||
| ifeq ($(ARCH),x86_64) | ||
| ARCH_CFLAGS := -march=x86-64 | ||
| else ifeq ($(ARCH),arm64) | ||
| ARCH_CFLAGS := -march=armv8-a | ||
| else | ||
| $(error Unsupported ARCH for linux: $(ARCH)) | ||
| endif | ||
| ARCH_LDFLAGS := | ||
| else ifeq ($(PLATFORM),mac) | ||
| ifeq ($(ARCH),x86_64) | ||
| ARCH_CFLAGS := -arch x86_64 | ||
| else ifeq ($(ARCH),arm64) | ||
| ARCH_CFLAGS := -arch arm64 | ||
| else | ||
| $(error Unsupported ARCH for mac: $(ARCH)) | ||
| endif | ||
| ARCH_LDFLAGS := $(ARCH_CFLAGS) | ||
| else | ||
| $(error Unsupported PLATFORM: $(PLATFORM)) | ||
| endif | ||
|
|
||
| WARN_NO_FORMAT_TRUNCATION := | ||
| ifeq ($(PLATFORM),linux) | ||
| WARN_NO_FORMAT_TRUNCATION := -Wno-format-truncation | ||
| endif | ||
|
|
||
| CXX_STD ?= -std=c++17 | ||
|
|
||
| KFX_SOURCES = \ | ||
| src/actionpt.c \ | ||
| src/api.c \ | ||
|
|
@@ -282,35 +357,63 @@ KFX_INCLUDES = \ | |
| -Ideps/centitoml \ | ||
| -Ideps/astronomy/include \ | ||
| -Ideps/enet6/include \ | ||
| $(shell pkg-config --cflags-only-I sdl2) \ | ||
| $(shell pkg-config --cflags-only-I SDL2_image) \ | ||
| $(shell pkg-config --cflags-only-I SDL2_mixer) \ | ||
| $(shell pkg-config --cflags-only-I SDL2_net) \ | ||
| $(shell pkg-config --cflags-only-I libavformat) \ | ||
| $(shell pkg-config --cflags-only-I libavcodec) \ | ||
| $(shell pkg-config --cflags-only-I libswresample) \ | ||
| $(shell pkg-config --cflags-only-I libavutil) \ | ||
| $(shell pkg-config --cflags-only-I openal) \ | ||
| $(shell pkg-config --cflags-only-I openal-soft) \ | ||
| $(shell pkg-config --cflags-only-I spng) \ | ||
| $(shell pkg-config --cflags-only-I minizip) \ | ||
| $(shell pkg-config --cflags-only-I zlib) \ | ||
| $(shell pkg-config --cflags-only-I luajit) | ||
|
|
||
| KFX_CFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 -march=x86-64 $(KFX_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter -Wno-absolute-value -Wno-unknown-pragmas -Wno-format-truncation -Wno-sign-compare | ||
| KFX_CXXFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 -march=x86-64 $(KFX_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unknown-pragmas -Wno-format-truncation -Wno-sign-compare | ||
| ifeq ($(PLATFORM),mac) | ||
| KFX_INCLUDES += \ | ||
| -I/opt/homebrew/opt/openal-soft/include \ | ||
| -I/usr/local/opt/openal-soft/include | ||
| endif | ||
|
|
||
| KFX_CFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Wno-unused-parameter -Wno-absolute-value -Wno-unknown-pragmas $(WARN_NO_FORMAT_TRUNCATION) -Wno-sign-compare -fsigned-char | ||
| KFX_CXXFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(CXX_STD) $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas $(WARN_NO_FORMAT_TRUNCATION) -Wno-sign-compare -fsigned-char | ||
|
|
||
| KFX_LDFLAGS += \ | ||
| -g \ | ||
| -rdynamic \ | ||
| -Wall -Wextra -Werror \ | ||
| $(ARCH_LDFLAGS) \ | ||
| -Ldeps/astronomy -lastronomy \ | ||
| -Ldeps/centijson -ljson \ | ||
| -Ldeps/enet6 -lenet6 \ | ||
| $(shell pkg-config --libs-only-l sdl2) \ | ||
| $(shell pkg-config --libs-only-l SDL2_mixer) \ | ||
| $(shell pkg-config --libs-only-l SDL2_net) \ | ||
| $(shell pkg-config --libs-only-l SDL2_image) \ | ||
| $(shell pkg-config --libs-only-l libavformat) \ | ||
| $(shell pkg-config --libs-only-l libavcodec) \ | ||
| $(shell pkg-config --libs-only-l libswresample) \ | ||
| $(shell pkg-config --libs-only-l libavutil) \ | ||
| $(shell pkg-config --libs-only-l openal) \ | ||
| $(shell pkg-config --libs-only-l luajit) \ | ||
| $(shell pkg-config --libs-only-l spng) \ | ||
| $(shell pkg-config --libs-only-l minizip) \ | ||
| $(shell pkg-config --libs-only-l zlib) \ | ||
| $(shell pkg-config --libs sdl2) \ | ||
| $(shell pkg-config --libs SDL2_mixer) \ | ||
| $(shell pkg-config --libs SDL2_net) \ | ||
| $(shell pkg-config --libs SDL2_image) \ | ||
| $(shell pkg-config --libs libavformat) \ | ||
| $(shell pkg-config --libs libavcodec) \ | ||
| $(shell pkg-config --libs libswresample) \ | ||
| $(shell pkg-config --libs libavutil) \ | ||
| $(shell pkg-config --libs openal) \ | ||
| $(shell pkg-config --libs openal-soft) \ | ||
| $(shell pkg-config --libs luajit) \ | ||
| $(shell pkg-config --libs spng) \ | ||
| $(shell pkg-config --libs minizip) \ | ||
| $(shell pkg-config --libs zlib) \ | ||
| -lminiupnpc \ | ||
| -lnatpmp \ | ||
| -ldl | ||
|
|
||
| ifeq ($(PLATFORM),mac) | ||
| KFX_LDFLAGS += \ | ||
| -L/opt/homebrew/opt/openal-soft/lib \ | ||
| -L/usr/local/opt/openal-soft/lib \ | ||
| -lopenal | ||
| endif | ||
|
|
||
| TOML_SOURCES = \ | ||
| deps/centitoml/toml_api.c | ||
|
|
||
|
|
@@ -319,7 +422,7 @@ TOML_OBJECTS = $(patsubst deps/centitoml/%.c,obj/centitoml/%.o,$(TOML_SOURCES)) | |
| TOML_INCLUDES = \ | ||
| -Ideps/centijson/include | ||
|
|
||
| TOML_CFLAGS += -O3 -march=x86-64 $(TOML_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter | ||
| TOML_CFLAGS += -O3 $(ARCH_CFLAGS) $(TOML_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter | ||
|
|
||
| ifeq ($(ENABLE_LTO), 1) | ||
| KFX_CFLAGS += -flto | ||
|
|
@@ -359,23 +462,102 @@ src/moonphase.c: deps/astronomy/include/astronomy.h | |
| deps/centitoml/toml_api.c: deps/centijson/include/json.h | ||
| deps/centitoml/toml_conv.c: deps/centijson/include/json.h | ||
|
|
||
| deps/astronomy-lin64.tar.gz: | ||
| curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/20250418/astronomy-lin64.tar.gz" | ||
|
|
||
| deps/astronomy/include/astronomy.h: deps/astronomy-lin64.tar.gz | deps/astronomy | ||
| tar xzmf $< -C deps/astronomy | ||
|
|
||
| deps/centijson-lin64.tar.gz: | ||
| curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/20250418/centijson-lin64.tar.gz" | ||
|
|
||
| deps/centijson/include/json.h: deps/centijson-lin64.tar.gz | deps/centijson | ||
| tar xzmf $< -C deps/centijson | ||
| deps/astronomy/include/astronomy.h: | deps/astronomy | ||
| @set -eux; \ | ||
| if [ -f "$@" ]; then exit 0; fi; \ | ||
| if [ "$(DEPS_DOWNLOAD)" = "1" ] && [ -n "$(DEPS_SUFFIX)" ]; then \ | ||
| if [ ! -f "deps/astronomy-$(DEPS_SUFFIX).tar.gz" ]; then \ | ||
| curl -Lfso "deps/astronomy-$(DEPS_SUFFIX).tar.gz" \ | ||
| "https://github.com/dkfans/kfx-deps/releases/download/$(DEPS_ASTRONOMY_TAG)/astronomy-$(DEPS_SUFFIX).tar.gz"; \ | ||
| fi; \ | ||
| if [ -f "deps/astronomy-$(DEPS_SUFFIX).tar.gz" ]; then \ | ||
| tar xzmf "deps/astronomy-$(DEPS_SUFFIX).tar.gz" -C deps/astronomy; \ | ||
| exit 0; \ | ||
| fi; \ | ||
| fi; \ | ||
| rm -rf "$(DEPS_BUILD_DIR)/astronomy"; \ | ||
| $(MKDIR) "$(DEPS_BUILD_DIR)"; \ | ||
| git clone --depth "$(DEPS_CLONE_DEPTH)" "$(DEPS_ASTRONOMY_REPO)" "$(DEPS_BUILD_DIR)/astronomy"; \ | ||
| if [ -n "$(DEPS_ASTRONOMY_REF)" ]; then git -C "$(DEPS_BUILD_DIR)/astronomy" checkout "$(DEPS_ASTRONOMY_REF)"; fi; \ | ||
|
Comment on lines
+480
to
+481
|
||
| if [ -f "$(DEPS_BUILD_DIR)/astronomy/CMakeLists.txt" ]; then \ | ||
| cmake -S "$(DEPS_BUILD_DIR)/astronomy" -B "$(DEPS_BUILD_DIR)/astronomy/build" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release; \ | ||
| cmake --build "$(DEPS_BUILD_DIR)/astronomy/build"; \ | ||
| else \ | ||
| astro_src=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/source/c/astronomy.c" | head -n 1); \ | ||
| if [ -z "$$astro_src" ]; then astro_src=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/source/astronomy.c" | head -n 1); fi; \ | ||
| if [ -z "$$astro_src" ]; then astro_src=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/src/astronomy.c" | head -n 1); fi; \ | ||
| if [ -z "$$astro_src" ]; then echo "astronomy.c not found"; exit 1; fi; \ | ||
| astro_inc=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/source/c/astronomy.h" -exec dirname {} \; | head -n 1); \ | ||
| if [ -z "$$astro_inc" ]; then astro_inc=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/source/astronomy.h" -exec dirname {} \; | head -n 1); fi; \ | ||
| if [ -z "$$astro_inc" ]; then astro_inc=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/src/astronomy.h" -exec dirname {} \; | head -n 1); fi; \ | ||
| if [ -z "$$astro_inc" ]; then echo "astronomy.h not found"; exit 1; fi; \ | ||
| $(MKDIR) "$(DEPS_BUILD_DIR)/astronomy/build"; \ | ||
| $(CC) -O3 -I"$$astro_inc" -c "$$astro_src" -o "$(DEPS_BUILD_DIR)/astronomy/build/astronomy.o"; \ | ||
| ar rcs "$(DEPS_BUILD_DIR)/astronomy/build/libastronomy.a" "$(DEPS_BUILD_DIR)/astronomy/build/astronomy.o"; \ | ||
| fi; \ | ||
| $(MKDIR) deps/astronomy/include; \ | ||
| header_path=$$(find "$(DEPS_BUILD_DIR)/astronomy" -name astronomy.h | head -n 1); \ | ||
| lib_path=$$(find "$(DEPS_BUILD_DIR)/astronomy" -name libastronomy.a | head -n 1); \ | ||
| if [ -z "$$header_path" ] || [ -z "$$lib_path" ]; then echo "astronomy build output not found"; exit 1; fi; \ | ||
| cp "$$header_path" deps/astronomy/include/; \ | ||
| cp "$$lib_path" deps/astronomy/libastronomy.a | ||
|
|
||
| deps/enet6-lin64.tar.gz: | ||
| curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/20260213/enet6-lin64.tar.gz" | ||
| deps/centijson/include/json.h: | deps/centijson | ||
| @set -eux; \ | ||
| if [ -f "$@" ]; then exit 0; fi; \ | ||
| if [ "$(DEPS_DOWNLOAD)" = "1" ] && [ -n "$(DEPS_SUFFIX)" ]; then \ | ||
| if [ ! -f "deps/centijson-$(DEPS_SUFFIX).tar.gz" ]; then \ | ||
| curl -Lfso "deps/centijson-$(DEPS_SUFFIX).tar.gz" \ | ||
| "https://github.com/dkfans/kfx-deps/releases/download/$(DEPS_CENTIJSON_TAG)/centijson-$(DEPS_SUFFIX).tar.gz"; \ | ||
| fi; \ | ||
| if [ -f "deps/centijson-$(DEPS_SUFFIX).tar.gz" ]; then \ | ||
| tar xzmf "deps/centijson-$(DEPS_SUFFIX).tar.gz" -C deps/centijson; \ | ||
| exit 0; \ | ||
| fi; \ | ||
| fi; \ | ||
| rm -rf "$(DEPS_BUILD_DIR)/centijson"; \ | ||
| $(MKDIR) "$(DEPS_BUILD_DIR)"; \ | ||
| git clone --depth "$(DEPS_CLONE_DEPTH)" "$(DEPS_CENTIJSON_REPO)" "$(DEPS_BUILD_DIR)/centijson"; \ | ||
| if [ -n "$(DEPS_CENTIJSON_REF)" ]; then git -C "$(DEPS_BUILD_DIR)/centijson" checkout "$(DEPS_CENTIJSON_REF)"; fi; \ | ||
|
Comment on lines
+520
to
+521
|
||
| if [ "$(PLATFORM)" = "mac" ]; then \ | ||
| find "$(DEPS_BUILD_DIR)/centijson" -name "*.c" -print0 | xargs -0 perl -pi -e 's@#include <malloc.h>@#include <stdlib.h>@'; \ | ||
| fi; \ | ||
| cmake -S "$(DEPS_BUILD_DIR)/centijson" -B "$(DEPS_BUILD_DIR)/centijson/build" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release; \ | ||
| cmake --build "$(DEPS_BUILD_DIR)/centijson/build"; \ | ||
| $(MKDIR) deps/centijson/include; \ | ||
| header_path=$$(find "$(DEPS_BUILD_DIR)/centijson" \( -name value.h -o -name json.h \) | head -n 1); \ | ||
| header_dir=$$(dirname "$$header_path"); \ | ||
| lib_path=$$(find "$(DEPS_BUILD_DIR)/centijson" \( -name libjson.a -o -name libcentijson.a \) | head -n 1); \ | ||
| if [ -z "$$header_path" ] || [ -z "$$lib_path" ]; then echo "centijson build output not found"; exit 1; fi; \ | ||
| cp "$$header_dir"/*.h deps/centijson/include/; \ | ||
| cp "$$lib_path" deps/centijson/libjson.a | ||
|
|
||
| deps/enet6/include/enet6/enet.h: deps/enet6-lin64.tar.gz | deps/enet6 | ||
| tar xzmf $< -C deps/enet6 | ||
| deps/enet6/include/enet6/enet.h: | deps/enet6 | ||
| @set -eux; \ | ||
| if [ -f "$@" ]; then exit 0; fi; \ | ||
| if [ "$(DEPS_DOWNLOAD)" = "1" ] && [ -n "$(DEPS_SUFFIX)" ]; then \ | ||
| if [ ! -f "deps/enet6-$(DEPS_SUFFIX).tar.gz" ]; then \ | ||
| curl -Lfso "deps/enet6-$(DEPS_SUFFIX).tar.gz" \ | ||
| "https://github.com/dkfans/kfx-deps/releases/download/$(DEPS_ENET6_TAG)/enet6-$(DEPS_SUFFIX).tar.gz"; \ | ||
| fi; \ | ||
| if [ -f "deps/enet6-$(DEPS_SUFFIX).tar.gz" ]; then \ | ||
| tar xzmf "deps/enet6-$(DEPS_SUFFIX).tar.gz" -C deps/enet6; \ | ||
| exit 0; \ | ||
| fi; \ | ||
| fi; \ | ||
| rm -rf "$(DEPS_BUILD_DIR)/enet6"; \ | ||
| $(MKDIR) "$(DEPS_BUILD_DIR)"; \ | ||
| git clone --depth "$(DEPS_CLONE_DEPTH)" "$(DEPS_ENET6_REPO)" "$(DEPS_BUILD_DIR)/enet6"; \ | ||
| if [ -n "$(DEPS_ENET6_REF)" ]; then git -C "$(DEPS_BUILD_DIR)/enet6" checkout "$(DEPS_ENET6_REF)"; fi; \ | ||
|
Comment on lines
+550
to
+551
|
||
| cmake -S "$(DEPS_BUILD_DIR)/enet6" -B "$(DEPS_BUILD_DIR)/enet6/build" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release; \ | ||
| cmake --build "$(DEPS_BUILD_DIR)/enet6/build"; \ | ||
| $(MKDIR) deps/enet6/include/enet6; \ | ||
| header_path=$$(find "$(DEPS_BUILD_DIR)/enet6" -path "*/enet6/enet.h" | head -n 1); \ | ||
| lib_path=$$(find "$(DEPS_BUILD_DIR)/enet6" \( -name libenet6.a -o -name libenet.a \) | head -n 1); \ | ||
| if [ -z "$$header_path" ] || [ -z "$$lib_path" ]; then echo "enet6 build output not found"; exit 1; fi; \ | ||
| header_dir=$$(dirname "$$header_path"); \ | ||
| cp "$$header_dir"/*.h deps/enet6/include/enet6/; \ | ||
| cp "$$lib_path" deps/enet6/libenet6.a | ||
|
|
||
| src/ver_defs.h: version.mk | ||
| $(ECHO) "#define VER_MAJOR $(VER_MAJOR)" > $@.swp | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.