forked from rime/librime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.thirdparty
61 lines (51 loc) · 2.12 KB
/
Makefile.thirdparty
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
# a minimal build for static linking
SRC_DIR=thirdparty/src
.PHONY: all clean-src glog leveldb marisa opencc yaml-cpp gtest
all: leveldb marisa opencc yaml-cpp
# note: this won't clean output files under include/, lib/ and bin/.
clean-src:
rm -r $(SRC_DIR)/glog/build || true
rm -r $(SRC_DIR)/gtest/build || true
cd $(SRC_DIR)/leveldb; make clean || true
cd $(SRC_DIR)/marisa-trie; make distclean || true
rm -r $(SRC_DIR)/opencc/build || true
rm -r $(SRC_DIR)/yaml-cpp/build || true
glog:
cd $(SRC_DIR)/glog; emcmake cmake \
. -Bbuild \
-DWITH_GFLAGS:BOOL=OFF \
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -s WASM=1 -s ASSERTIONS=1 -s DISABLE_EXCEPTION_CATCHING=0 --memory-init-file 0" \
&& cmake --build build
cp -R $(SRC_DIR)/glog/build/glog thirdparty/include/
cp $(SRC_DIR)/glog/src/glog/log_severity.h thirdparty/include/glog/
cp $(SRC_DIR)/glog/build/libglog.a thirdparty/lib/
leveldb:
cd $(SRC_DIR)/leveldb; emmake make
cp -R $(SRC_DIR)/leveldb/include/leveldb thirdparty/include/
cp $(SRC_DIR)/leveldb/libleveldb.a thirdparty/lib/
marisa:
cd $(SRC_DIR)/marisa-trie; emconfigure ./configure --disable-debug --disable-dependency-tracking --enable-static && make
cp -R $(SRC_DIR)/marisa-trie/lib/marisa thirdparty/include/
cp $(SRC_DIR)/marisa-trie/lib/marisa.h thirdparty/include/
cp $(SRC_DIR)/marisa-trie/lib/.libs/libmarisa.a thirdparty/lib/
opencc:
cd $(SRC_DIR)/opencc; make wasm
mkdir -p thirdparty/include/opencc
cp $(SRC_DIR)/opencc/src/*.h* thirdparty/include/opencc/
cp $(SRC_DIR)/opencc/build/wasm/src/libopencc.a thirdparty/lib/
mkdir -p thirdparty/data/opencc
cp $(SRC_DIR)/opencc/data/config/*.json thirdparty/data/opencc/
cp $(SRC_DIR)/opencc/build/linux32/data/*.ocd thirdparty/data/opencc/
yaml-cpp:
cd $(SRC_DIR)/yaml-cpp; emcmake cmake \
. -Bbuild \
-DCMAKE_BUILD_TYPE=Release \
&& cmake --build build
cp -R $(SRC_DIR)/yaml-cpp/include/yaml-cpp thirdparty/include/
cp $(SRC_DIR)/yaml-cpp/build/libyaml-cpp.a thirdparty/lib/
gtest:
cd $(SRC_DIR)/gtest; cmake \
. -Bbuild \
&& cmake --build build
cp -R $(SRC_DIR)/gtest/include/gtest thirdparty/include/
cp $(SRC_DIR)/gtest/build/libgtest*.a thirdparty/lib/