File tree Expand file tree Collapse file tree 4 files changed +28
-1
lines changed
Expand file tree Collapse file tree 4 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 44compile_commands.json
55libsimple. *
66build /
7+ build-ios /
78* .gch
89bin /
910output /
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ make install
7171
7272支持 iOS 编译:
7373```
74- cmake ../.. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../../contrib/ ios.toolchain.cmake -DPLATFORM=OS64COMBINED -DENABLE_BITCODE=0
74+ ./build- ios.sh
7575```
7676
7777### 代码
Original file line number Diff line number Diff line change 1+ #! /bin/zsh
2+
3+ current_dir=$( pwd) /$( dirname " $0 " )
4+ build_dir=" ${current_dir} /build-ios"
5+ lib_prefix=" ${current_dir} /output"
6+
7+ cmake " $current_dir " -G Xcode -DCMAKE_TOOLCHAIN_FILE=contrib/ios.toolchain.cmake \
8+ -DPLATFORM=OS64COMBINED -DENABLE_BITCODE=1 \
9+ -DCMAKE_INSTALL_PREFIX=" " -B " $build_dir " \
10+ -DDEPLOYMENT_TARGET=8.0
11+
12+ cd " $build_dir " || exit
13+
14+ cmake --build " $build_dir " --config Release
15+ cmake --install " $build_dir " --config Release --prefix " ${lib_prefix} "
Original file line number Diff line number Diff line change @@ -25,7 +25,12 @@ set(SOURCE_FILES
2525 entry.cc
2626)
2727
28+ if (IOS)
29+ # iOS only support static library.
30+ add_library (simple STATIC ${SOURCE_FILES} )
31+ else ()
2832add_library (simple SHARED ${SOURCE_FILES} )
33+ endif ()
2934
3035if (SIMPLE_WITH_JIEBA)
3136 add_dependencies (simple cppjieba)
@@ -44,3 +49,9 @@ endif()
4449target_link_libraries (simple PUBLIC coverage_config PRIVATE PINYIN_TEXT SQLite3)
4550
4651install (TARGETS simple DESTINATION bin)
52+
53+ if (IOS)
54+ # iOS build as static library. so we need install PINYIN_TEXT too.
55+ install (TARGETS PINYIN_TEXT DESTINATION bin)
56+ endif ()
57+
You can’t perform that action at this time.
0 commit comments