-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (64 loc) · 2.49 KB
/
Makefile
File metadata and controls
83 lines (64 loc) · 2.49 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Set ulimit at the start (if possible)
$(shell ulimit -n 2048)
# Makefile for Skia static libs and example builds
SKIA_BUILDER = python3 build-skia.py
# Build directories
BUILD_DIR = $(shell pwd)/build
EXAMPLE_BUILD_DIR = $(shell pwd)/example/build-mac
WASM_EXAMPLE_BUILD_DIR = $(shell pwd)/example/build-wasm
# Skia paths
SKIA_SRC_DIR = $(BUILD_DIR)/src/skia
EMSDK_PATH = $(SKIA_SRC_DIR)/third_party/externals/emsdk
HTTP_PORT = 8080
.PHONY: skia-mac skia-ios skia-wasm skia-linux clean example-mac example-wasm serve-wasm skia-xcframework skia-spm example-mac-graphite example-linux-graphite
# Default target
all: skia-mac example-mac
# Build Skia libraries
skia-mac:
ulimit -n 2048 && $(SKIA_BUILDER) mac
skia-ios:
$(SKIA_BUILDER) ios
skia-wasm:
$(SKIA_BUILDER) wasm
# Build XCFramework combining iOS and macOS libraries
skia-xcframework:
$(SKIA_BUILDER) xcframework
# Build example
example-mac: skia-mac
mkdir -p $(EXAMPLE_BUILD_DIR) && \
cmake $(shell pwd)/example/CMakeLists.txt -B $(EXAMPLE_BUILD_DIR) -DCMAKE_BUILD_TYPE=Release && \
cmake --build $(EXAMPLE_BUILD_DIR)
# Build WebAssembly version of example
example-wasm: skia-wasm
source $(EMSDK_PATH)/emsdk_env.sh && \
mkdir -p $(WASM_EXAMPLE_BUILD_DIR) && \
emcmake cmake $(shell pwd)/example/CMakeLists.txt -B $(WASM_EXAMPLE_BUILD_DIR) -DCMAKE_BUILD_TYPE=Release && \
cmake --build $(WASM_EXAMPLE_BUILD_DIR)
# Serve WebAssembly example
serve-wasm: example-wasm
source $(EMSDK_PATH)/emsdk_env.sh && \
cd $(WASM_EXAMPLE_BUILD_DIR) && \
emrun --port $(HTTP_PORT) --browser chrome example.html
# Build directories for native graphite examples
MAC_GRAPHITE_BUILD_DIR = $(shell pwd)/example/build-mac-graphite
LINUX_GRAPHITE_BUILD_DIR = $(shell pwd)/example/build-linux-graphite
# Build Skia for Linux
skia-linux:
$(SKIA_BUILDER) linux
# Build native Graphite example for macOS (requires GLFW: brew install glfw)
example-mac-graphite: skia-mac
mkdir -p $(MAC_GRAPHITE_BUILD_DIR) && \
cmake $(shell pwd)/example/CMakeLists.txt -B $(MAC_GRAPHITE_BUILD_DIR) \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_NATIVE_GRAPHITE=ON && \
cmake --build $(MAC_GRAPHITE_BUILD_DIR)
# Build native Graphite example for Linux (requires GLFW: apt install libglfw3-dev)
example-linux-graphite: skia-linux
mkdir -p $(LINUX_GRAPHITE_BUILD_DIR) && \
cmake $(shell pwd)/example/CMakeLists.txt -B $(LINUX_GRAPHITE_BUILD_DIR) \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_NATIVE_GRAPHITE=ON && \
cmake --build $(LINUX_GRAPHITE_BUILD_DIR)
# Clean build artifacts
clean:
rm -rf $(BUILD_DIR)