diff --git a/librime.patch b/librime.patch index d3db0ce..c580bc9 100644 --- a/librime.patch +++ b/librime.patch @@ -12,10 +12,10 @@ index 6ec9dae1..dc2266c1 100644 +ios +*.tar.bz2 diff --git a/Makefile b/Makefile -index e4f56fe6..d0ad1c3e 100644 +index 58784112..b783b568 100644 --- a/Makefile +++ b/Makefile -@@ -43,6 +43,12 @@ deps: +@@ -52,6 +52,12 @@ deps: deps/%: $(MAKE) -f deps.mk $(@:deps/%=%) @@ -26,7 +26,7 @@ index e4f56fe6..d0ad1c3e 100644 + $(MAKE) -f xcode.mk $(@:xcode/%=%) + clean: - rm -Rf build debug + rm -r $(build) || true diff --git a/README-iOS.md b/README-iOS.md new file mode 100644 @@ -1167,37 +1167,37 @@ index 00000000..f88956b7 +endmacro(find_host_package) \ No newline at end of file diff --git a/deps.mk b/deps.mk -index ede5330f..5599e688 100644 +index fe68ccdd..32c503e3 100644 --- a/deps.mk +++ b/deps.mk -@@ -32,6 +32,7 @@ glog: +@@ -39,6 +39,7 @@ glog: -DWITH_GFLAGS:BOOL=OFF \ -DCMAKE_BUILD_TYPE:STRING="Release" \ - -DCMAKE_INSTALL_PREFIX:PATH="$(rime_root)" \ + -DCMAKE_INSTALL_PREFIX:PATH="$(prefix)" \ + $(RIME_CMAKE_FLAGS) \ && cmake --build $(build) --target install - gtest: -@@ -40,6 +41,7 @@ gtest: + googletest: +@@ -47,6 +48,7 @@ googletest: -DBUILD_GMOCK:BOOL=OFF \ -DCMAKE_BUILD_TYPE:STRING="Release" \ - -DCMAKE_INSTALL_PREFIX:PATH="$(rime_root)" \ + -DCMAKE_INSTALL_PREFIX:PATH="$(prefix)" \ + $(RIME_CMAKE_FLAGS) \ && cmake --build $(build) --target install leveldb: -@@ -49,6 +51,7 @@ leveldb: +@@ -56,6 +58,7 @@ leveldb: -DLEVELDB_BUILD_TESTS:BOOL=OFF \ -DCMAKE_BUILD_TYPE:STRING="Release" \ - -DCMAKE_INSTALL_PREFIX:PATH="$(rime_root)" \ + -DCMAKE_INSTALL_PREFIX:PATH="$(prefix)" \ + $(RIME_CMAKE_FLAGS) \ && cmake --build $(build) --target install - marisa: -@@ -56,15 +59,40 @@ marisa: + marisa-trie: +@@ -63,15 +66,40 @@ marisa-trie: cmake . -B$(build) \ -DCMAKE_BUILD_TYPE:STRING="Release" \ - -DCMAKE_INSTALL_PREFIX:PATH="$(rime_root)" \ + -DCMAKE_INSTALL_PREFIX:PATH="$(prefix)" \ + $(RIME_CMAKE_FLAGS) \ && cmake --build $(build) --target install @@ -1207,7 +1207,7 @@ index ede5330f..5599e688 100644 cmake . -B$(build) \ -DBUILD_SHARED_LIBS:BOOL=OFF \ -DCMAKE_BUILD_TYPE:STRING="Release" \ - -DCMAKE_INSTALL_PREFIX:PATH="$(rime_root)" \ + -DCMAKE_INSTALL_PREFIX:PATH="$(prefix)" \ + $(RIME_CMAKE_FLAGS) \ && cmake --build $(build) --target install +else @@ -1220,32 +1220,32 @@ index ede5330f..5599e688 100644 + cmake . -B$(build) \ + -DBUILD_SHARED_LIBS:BOOL=OFF \ + -DCMAKE_BUILD_TYPE:STRING="Release" \ -+ -DCMAKE_INSTALL_PREFIX:PATH="$(rime_root)" \ ++ -DCMAKE_INSTALL_PREFIX:PATH="$(prefix)" \ + && cmake --build build --target install \ -+ && rm $(rime_root)/lib/libopencc.a || true \ ++ && rm $(prefix)/lib/libopencc.a || true \ + && echo "Cross compiling..." \ -+ && export PATH=$(rime_root)/bin:$$PATH && echo $$PATH \ ++ && export PATH=$(prefix)/bin:$$PATH && echo $$PATH \ + && cmake . -B$(build)/opencc_arm64 \ + -DBUILD_SHARED_LIBS:BOOL=OFF \ + -DCMAKE_BUILD_TYPE:STRING="Release" \ -+ -DCMAKE_INSTALL_PREFIX:PATH="$(rime_root)" \ ++ -DCMAKE_INSTALL_PREFIX:PATH="$(prefix)" \ + $(RIME_CMAKE_FLAGS) \ + && cmake --build $(build)/opencc_arm64 --target install +endif yaml-cpp: cd $(src_dir)/yaml-cpp; \ -@@ -74,4 +102,5 @@ yaml-cpp: +@@ -81,4 +109,5 @@ yaml-cpp: -DYAML_CPP_BUILD_TOOLS:BOOL=OFF \ -DCMAKE_BUILD_TYPE:STRING="Release" \ - -DCMAKE_INSTALL_PREFIX:PATH="$(rime_root)" \ + -DCMAKE_INSTALL_PREFIX:PATH="$(prefix)" \ + $(RIME_CMAKE_FLAGS) \ && cmake --build $(build) --target install diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 6364e1c8..42f0e692 100644 +index f7594089..fa94808f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt -@@ -71,6 +71,7 @@ else() +@@ -80,6 +80,7 @@ else() ${rime_plugins_deps}) endif() @@ -1253,11 +1253,7 @@ index 6364e1c8..42f0e692 100644 if(BUILD_SHARED_LIBS) add_library(rime ${rime_src}) target_link_libraries(rime ${rime_deps}) -@@ -78,9 +79,33 @@ if(BUILD_SHARED_LIBS) - DEFINE_SYMBOL "RIME_EXPORTS" - VERSION ${rime_version} - SOVERSION ${rime_soversion}) -+ +@@ -92,6 +93,29 @@ if(BUILD_SHARED_LIBS) if(XCODE_VERSION) set_target_properties(rime PROPERTIES INSTALL_NAME_DIR "@rpath") endif() @@ -1287,13 +1283,13 @@ index 6364e1c8..42f0e692 100644 install(TARGETS rime DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) if(BUILD_SEPARATE_LIBS) -@@ -146,3 +171,4 @@ else() - set_target_properties(rime-static PROPERTIES OUTPUT_NAME "rime" PREFIX "lib") +@@ -167,3 +191,4 @@ else() + ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) install(TARGETS rime-static DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) endif() + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt -index 80fb5ddd..0cc6907a 100644 +index 62c4c1d6..4880643a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,23 @@ @@ -1321,131 +1317,19 @@ index 80fb5ddd..0cc6907a 100644 ${rime_library} ${rime_dict_library} diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt -index ab64c52a..4f65c36d 100644 +index 090a0fc0..c61ff2dd 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt -@@ -7,21 +7,73 @@ set(rime_console_deps - ${rime_levers_library} - ${rime_plugins_library}) - -+ - set(rime_api_console_src "rime_api_console.cc") - add_executable(rime_api_console ${rime_api_console_src}) - target_link_libraries(rime_api_console ${rime_console_deps}) - -+if(${CMAKE_SYSTEM_NAME} MATCHES "iOS") -+ set(RIME_API_CCONSOLE_BUNDLE_IDENTIFIER "") -+ set(RIME_API_CCONSOLE_BUNDLE_IDENTIFIER ${RIME_API_CCONSOLE_BUNDLE_IDENTIFIER}) -+ -+ if (DEFINED RIME_API_CCONSOLE_BUNDLE_IDENTIFIER) -+ message (STATUS "Using RIME_API_CCONSOLE_BUNDLE_IDENTIFIER: ${RIME_API_CCONSOLE_BUNDLE_IDENTIFIER}") -+ set_xcode_property (rime_api_console PRODUCT_BUNDLE_IDENTIFIER ${RIME_API_CCONSOLE_BUNDLE_IDENTIFIER} All) -+ else() -+ message (STATUS "No RIME_API_CCONSOLE_BUNDLE_IDENTIFIER - with -DRIME_API_CCONSOLE_BUNDLE_IDENTIFIER=") -+ endif() -+ -+ if (DEFINED DEVELOPMENT_TEAM) -+ set_xcode_property (rime_api_console DEVELOPMENT_TEAM ${DEVELOPMENT_TEAM} All) -+ endif() -+endif() -+ - set(rime_patch_src "rime_patch.cc") - add_executable(rime_patch ${rime_patch_src}) - target_link_libraries(rime_patch - ${rime_library} - ${rime_levers_library}) - -+if(${CMAKE_SYSTEM_NAME} MATCHES "iOS") -+ set(RIME_PATCH_BUNDLE_IDENTIFIER "") -+ set(RIME_PATCH_BUNDLE_IDENTIFIER ${RIME_PATCH_BUNDLE_IDENTIFIER}) -+ -+ if (DEFINED RIME_PATCH_BUNDLE_IDENTIFIER) -+ message (STATUS "Using RIME_PATCH_BUNDLE_IDENTIFIER: ${RIME_PATCH_BUNDLE_IDENTIFIER}") -+ set_xcode_property (rime_patch PRODUCT_BUNDLE_IDENTIFIER ${RIME_PATCH_BUNDLE_IDENTIFIER} All) -+ else() -+ message (STATUS "No RIME_API_CCONSOLE_BUNDLE_IDENTIFIER - with -DRIME_PATCH_BUNDLE_IDENTIFIER=") -+ endif() -+ -+ if (DEFINED DEVELOPMENT_TEAM) -+ set_xcode_property (rime_patch DEVELOPMENT_TEAM ${DEVELOPMENT_TEAM} All) -+ endif() -+endif() -+ -+# msvc doesn't export all symbols -+if(NOT (WIN32 AND BUILD_SHARED_LIBS)) -+ - set(rime_console_src "rime_console.cc") - add_executable(rime_console ${rime_console_src}) - target_compile_definitions(rime_console PRIVATE RIME_IMPORTS) - target_link_libraries(rime_console ${rime_console_deps}) - -+if(${CMAKE_SYSTEM_NAME} MATCHES "iOS") -+ set(RIME_CONSOLE_BUNDLE_IDENTIFIER "") -+ set(RIME_CONSOLE_BUNDLE_IDENTIFIER ${RIME_CONSOLE_BUNDLE_IDENTIFIER}) -+ -+ if (DEFINED RIME_CONSOLE_BUNDLE_IDENTIFIER) -+ message (STATUS "Using RIME_CONSOLE_BUNDLE_IDENTIFIER: ${RIME_CONSOLE_BUNDLE_IDENTIFIER}") -+ set_xcode_property (rime_console PRODUCT_BUNDLE_IDENTIFIER ${RIME_CONSOLE_BUNDLE_IDENTIFIER} All) -+ else() -+ message (STATUS "No RIME_CONSOLE_BUNDLE_IDENTIFIER - with -DRIME_CONSOLE_BUNDLE_IDENTIFIER=") -+ endif() -+ -+ if (DEFINED DEVELOPMENT_TEAM) -+ set_xcode_property (rime_console DEVELOPMENT_TEAM ${DEVELOPMENT_TEAM} All) -+ endif() -+endif() -+ - set(rime_dict_manager_src "rime_dict_manager.cc") - add_executable(rime_dict_manager ${rime_dict_manager_src}) - target_link_libraries(rime_dict_manager -@@ -29,6 +81,22 @@ target_link_libraries(rime_dict_manager - ${rime_dict_library} - ${rime_levers_library}) - -+if(${CMAKE_SYSTEM_NAME} MATCHES "iOS") -+ set(RIME_DICT_MANAGER_CCONSOLE_BUNDLE_IDENTIFIER "") -+ set(RIME_DICT_MANAGER_CCONSOLE_BUNDLE_IDENTIFIER ${RIME_DICT_MANAGER_CCONSOLE_BUNDLE_IDENTIFIER}) -+ -+ if (DEFINED RIME_DICT_MANAGER_CCONSOLE_BUNDLE_IDENTIFIER) -+ message (STATUS "Using RIME_DICT_MANAGER_CCONSOLE_BUNDLE_IDENTIFIER: ${RIME_DICT_MANAGER_CCONSOLE_BUNDLE_IDENTIFIER}") -+ set_xcode_property (rime_dict_manager PRODUCT_BUNDLE_IDENTIFIER ${RIME_DICT_MANAGER_CCONSOLE_BUNDLE_IDENTIFIER} All) -+ else() -+ message (STATUS "No RIME_DICT_MANAGER_CCONSOLE_BUNDLE_IDENTIFIER - with -DRIME_DICT_MANAGER_CCONSOLE_BUNDLE_IDENTIFIER=") -+ endif() -+ -+ if (DEFINED DEVELOPMENT_TEAM) -+ set_xcode_property (rime_dict_manager DEVELOPMENT_TEAM ${DEVELOPMENT_TEAM} All) -+ endif() -+endif() -+ - set(rime_deployer_src "rime_deployer.cc") - add_executable(rime_deployer ${rime_deployer_src}) - target_compile_definitions(rime_deployer PRIVATE RIME_IMPORTS) -@@ -48,6 +116,21 @@ add_executable(rime_table_decompiler ${rime_table_decompiler_src}) - target_link_libraries(rime_table_decompiler - ${rime_library} - ${rime_dict_library}) -+if(${CMAKE_SYSTEM_NAME} MATCHES "iOS") -+ set(RIME_DEPLOYER_BUNDLE_IDENTIFIER "") -+ set(RIME_DEPLOYER_BUNDLE_IDENTIFIER ${RIME_DEPLOYER_BUNDLE_IDENTIFIER}) -+ -+ if (DEFINED RIME_DEPLOYER_BUNDLE_IDENTIFIER) -+ message (STATUS "Using RIME_DEPLOYER_BUNDLE_IDENTIFIER: ${RIME_DEPLOYER_BUNDLE_IDENTIFIER}") -+ set_xcode_property (rime_deployer PRODUCT_BUNDLE_IDENTIFIER ${RIME_DEPLOYER_BUNDLE_IDENTIFIER} All) -+ else() -+ message (STATUS "No RIME_DEPLOYER_BUNDLE_IDENTIFIER - with -DRIME_DEPLOYER_BUNDLE_IDENTIFIER=") -+ endif() -+ -+ if (DEFINED DEVELOPMENT_TEAM) -+ set_xcode_property (rime_deployer DEVELOPMENT_TEAM ${DEVELOPMENT_TEAM} All) -+ endif() -+endif() - - install(TARGETS rime_deployer DESTINATION ${BIN_INSTALL_DIR}) - install(TARGETS rime_dict_manager DESTINATION ${BIN_INSTALL_DIR}) +@@ -66,4 +66,4 @@ file(COPY ${PROJECT_SOURCE_DIR}/data/minimal/luna_pinyin.schema.yaml + file(COPY ${PROJECT_SOURCE_DIR}/data/minimal/cangjie5.dict.yaml + DESTINATION ${EXECUTABLE_OUTPUT_PATH}) + file(COPY ${PROJECT_SOURCE_DIR}/data/minimal/cangjie5.schema.yaml +- DESTINATION ${EXECUTABLE_OUTPUT_PATH}) ++ DESTINATION ${EXECUTABLE_OUTPUT_PATH}) +\ No newline at end of file diff --git a/xcode.mk b/xcode.mk new file mode 100644 -index 00000000..941d489c +index 00000000..8b7a19c4 --- /dev/null +++ b/xcode.mk @@ -0,0 +1,203 @@ diff --git a/librimeBuild.sh b/librimeBuild.sh index 7124a09..8d05918 100755 --- a/librimeBuild.sh +++ b/librimeBuild.sh @@ -74,7 +74,8 @@ function prepare_library() { # build deps # first time: for ios - rm -rf ${LIBRIME_ROOT}/lib/*.a + # rm -rf ${LIBRIME_ROOT}/lib/*.a + make xcode/ios/deps/clean make xcode/ios/deps for file in ${deps[@]} do @@ -82,7 +83,8 @@ function prepare_library() { done # second time: for simulator - rm -rf ${LIBRIME_ROOT}/lib/*.a + # rm -rf ${LIBRIME_ROOT}/lib/*.a + make xcode/simulator/deps/clean make xcode/simulator/deps for file in ${deps[@]} do