-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (46 loc) · 1.36 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
OS := $(shell uname -s)
SOURCES := $(shell find src -name "*.cr")
CFLAGS :=
ifeq (${MODE},Release)
SOURCES += clean
CFLAGS += --release
else
CFLAGS += --debug
ifeq (${MODE},Debug)
CFLAGS += --verbose
endif
endif
ifeq (${OS},Darwin)
SOURCES += $(shell pwd)/src/platform/mac.c
CFLAGS += --link-flags $(shell pwd)/src/platform/mac.c
endif
ifeq (${OS},Linux)
ARCH := $(shell uname -m)
LIB_ARCH := $(shell gcc -dumpmachine)
ifeq (${MODE},Release)
CFLAGS += --link-flags '-Xlinker -rpath=\"/usr/lib/${LIB_ARCH}\"'
endif
endif
clean:
rm -r bin
.PHONY: clean
shard.lock: shard.yml
shards install
bin/triangle: shard.lock ${SOURCES} examples/triangle.cr
@mkdir -p bin
crystal build examples/triangle.cr -o bin/triangle ${CFLAGS}
bin/triangle.app: bin/triangle
ifeq (${OS},Darwin)
@echo "Fixing up libwgpu_native dylib path…"
@install_name_tool -change /Users/runner/work/wgpu-native/wgpu-native/target/debug/deps/libwgpu_native.dylib @executable_path/../../Frameworks/libwgpu_native.dylib bin/triangle
@otool -L bin/triangle | grep wgpu
@rm -rf "bin/triangle.app"
@lib/wgpu/scripts/appify.sh bin/triangle
@mkdir -p "triangle.app/Frameworks"
@cp lib/wgpu/bin/libs/libwgpu_native.dylib "triangle.app/Frameworks"
@cp examples/Info.plist "triangle.app/Contents"
@mv -f "triangle.app" bin
else
@echo "macOS app construction is unavailable on this platform"
@false
endif