From e0a710590c860a257b8f2f4ec2607c8d75916d50 Mon Sep 17 00:00:00 2001 From: WhiredPlanck Date: Sun, 12 Nov 2023 19:22:01 +0800 Subject: [PATCH 1/2] refactor(jni): remove workaround for rime tools --- app/src/main/jni/CMakeLists.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/src/main/jni/CMakeLists.txt b/app/src/main/jni/CMakeLists.txt index 79dd7f0402..1282054cf5 100644 --- a/app/src/main/jni/CMakeLists.txt +++ b/app/src/main/jni/CMakeLists.txt @@ -51,12 +51,7 @@ include_directories( PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/librime/deps/glog" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/librime/deps/glog/src" ) -# workaround for librime/tools/rime_api_console.cc -# TODO: fix it in upstream -string(REPLACE "-Werror=format-security" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) -string(REPLACE "-Wformat" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) -add_definitions("-Wno-format") -# workaround end + add_subdirectory(librime) add_subdirectory(librime_jni) From db1581f1002ee50be9e557b21c16bea6a446e43c Mon Sep 17 00:00:00 2001 From: WhiredPlanck Date: Sun, 12 Nov 2023 20:57:55 +0800 Subject: [PATCH 2/2] build(jni): try to replace boost git submodule with source tarball This may off about 50% of the build time. --- .gitmodules | 3 --- app/src/main/jni/CMakeLists.txt | 14 +++++++++++++- app/src/main/jni/boost | 1 - 3 files changed, 13 insertions(+), 5 deletions(-) delete mode 160000 app/src/main/jni/boost diff --git a/.gitmodules b/.gitmodules index 22b8593b3e..a4791ae3d8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,9 +4,6 @@ [submodule "snappy"] path = app/src/main/jni/snappy url = https://github.com/google/snappy.git -[submodule "boost"] - path = app/src/main/jni/boost - url = https://github.com/boostorg/boost.git [submodule "librime"] path = app/src/main/jni/librime url = https://github.com/rime/librime.git diff --git a/app/src/main/jni/CMakeLists.txt b/app/src/main/jni/CMakeLists.txt index 1282054cf5..b84a05d99e 100644 --- a/app/src/main/jni/CMakeLists.txt +++ b/app/src/main/jni/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.10.0) +cmake_minimum_required (VERSION 3.18.0) project(trime-lib VERSION 3.0.0) @@ -16,6 +16,18 @@ include(Iconv) # workaround for boost install install(TARGETS iconv EXPORT boost_locale-targets) +set(BOOST_VER 1.83.0) +if(NOT EXISTS ${CMAKE_SOURCE_DIR}/boost) + file( + DOWNLOAD "https://github.com/boostorg/boost/releases/download/boost-${BOOST_VER}/boost-${BOOST_VER}.tar.xz" boost-${BOOST_VER}.tar.xz + EXPECTED_HASH SHA256=c5a0688e1f0c05f354bbd0b32244d36085d9ffc9f932e8a18983a9908096f614 + SHOW_PROGRESS + ) + file(ARCHIVE_EXTRACT INPUT boost-${BOOST_VER}.tar.xz + DESTINATION ${CMAKE_SOURCE_DIR} + ) + file(RENAME "boost-${BOOST_VER}" boost) +endif() add_subdirectory(boost) option(WITH_GFLAGS "Use gflags" OFF) diff --git a/app/src/main/jni/boost b/app/src/main/jni/boost deleted file mode 160000 index 564e2ac169..0000000000 --- a/app/src/main/jni/boost +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 564e2ac16907019696cdaba8a93e3588ec596062