Skip to content

Commit

Permalink
drop boost regex lib for windows and macos (rime#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj authored Oct 13, 2023
1 parent eb2477e commit 298a9dd
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 143 deletions.
1 change: 0 additions & 1 deletion .github/workflows/macos-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ jobs:
with:
path: |
${{ env.BOOST_ROOT }}.tar.bz2
${{ env.BOOST_ROOT }}/stage
key: ${{ runner.os }}-boost-${{ env.boost_version }}

- name: Extract Boost source tarball
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
uses: ./.github/workflows/macos-build.yml
with:
build_variant: '-universal'
rime_plugins: rime/librime-charcode hchunhui/librime-lua lotem/librime-octagram
rime_plugins: hchunhui/librime-lua lotem/librime-octagram

windows:
uses: ./.github/workflows/windows-build.yml
with:
rime_plugins: rime/librime-charcode hchunhui/librime-lua lotem/librime-octagram
rime_plugins: hchunhui/librime-lua lotem/librime-octagram

release:
needs: [macos, windows]
Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/windows-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,6 @@ jobs:
7z x ${{ env.BOOST_ROOT }}.7z
popd
- name: Cache Boost lib
id: cache-boost-lib
uses: actions/cache@v3
with:
path: |
${{ env.BOOST_ROOT }}\stage
key: ${{ runner.os }}-boost-${{ env.boost_version }}-${{ matrix.compiler }}-lib

- name: Install Boost
if: steps.cache-boost-lib.outputs.cache-hit != 'true'
run: ${{ env.build_script }} boost

- name: Cache dependencies
id: cache-deps
uses: actions/cache@v3
Expand Down
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ if(MSVC)
set(Boost_USE_STATIC_RUNTIME ON)
endif()

set(BOOST_COMPONENTS regex)

find_package(Boost 1.74.0 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
if(LINUX)
find_package(Boost 1.74.0 REQUIRED COMPONENTS regex)
else()
find_package(Boost 1.77.0)
endif()
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
Expand Down
21 changes: 1 addition & 20 deletions build-clang.bat
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ set arch=x86
if "%PROCESSOR_ARCHITECTURE%" == "ARM64" set arch=arm

set clean=0
set build_boost=0
set build_deps=0
set build_librime=0
set build_test=OFF

:parse_cmdline_options
if "%1" == "" goto end_parsing_cmdline_options
if "%1" == "clean" set clean=1
if "%1" == "boost" set build_boost=1
if "%1" == "deps" set build_deps=1
if "%1" == "librime" set build_librime=1
if "%1" == "test" (
Expand All @@ -32,10 +30,9 @@ goto parse_cmdline_options
:end_parsing_cmdline_options

if %clean% == 0 (
if %build_boost% == 0 (
if %build_deps% == 0 (
set build_librime=1
)))
))

if %clean% == 1 (
rmdir /s /q build
Expand All @@ -47,22 +44,6 @@ if %clean% == 1 (
rmdir /s /q deps\yaml-cpp\build
)

if %build_boost% == 1 (
pushd %BOOST_ROOT% || exit
if not exist b2.exe call .\bootstrap.bat || exit
b2 toolset=clang-win^
architecture=%arch%^
address-model=64^
variant=release^
link=static^
runtime-link=static^
stage^
--with-locale^
--with-filesystem^
--with-regex || exit
popd
)

set common_cmake_flags=-B build^
-G Ninja^
-DCMAKE_C_COMPILER=clang^
Expand Down
89 changes: 1 addition & 88 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ set clean=0
set build_dir_base=build
set build_dir_suffix=
set build_config=Release
set build_boost=0
set build_boost_x86=0
set build_boost_x64=0
set build_boost_arm64=0
set boost_build_variant=release
set build_deps=0
set build_librime=0
set build_shared=ON
Expand All @@ -44,19 +39,6 @@ set enable_logging=ON
:parse_cmdline_options
if "%1" == "" goto end_parsing_cmdline_options
if "%1" == "clean" set clean=1
if "%1" == "boost" set build_boost=1
if "%1" == "boost_x86" (
set build_boost=1
set build_boost_x86=1
)
if "%1" == "boost_x64" (
set build_boost=1
set build_boost_x64=1
)
if "%1" == "boost_arm64" (
set build_boost=1
set build_boost_arm64=1
)
if "%1" == "deps" set build_deps=1
rem `thirdparty` is deprecated in favor of `deps`
if "%1" == "thirdparty" set build_deps=1
Expand All @@ -76,13 +58,10 @@ if "%1" == "test" (
if "%1" == "debug" (
set build_dir_base=debug
set build_config=Debug
set boost_build_variant=debug
)
if "%1" == "release" (
set build_dir_base=build
set build_config=Release
set boost_build_variant=release

)
if "%1" == "logging" (
set enable_logging=ON
Expand All @@ -96,10 +75,9 @@ goto parse_cmdline_options

if %clean% == 0 (
if %build_librime% == 0 (
if %build_boost% == 0 (
if %build_deps% == 0 (
set build_librime=1
))))
)))

if %clean% == 1 (
rmdir /s /q build
Expand All @@ -113,71 +91,6 @@ if %clean% == 1 (

set build_dir=%build_dir_base%%build_dir_suffix%

rem set curl=%RIME_ROOT%\bin\curl.exe
rem set download="%curl%" --remote-name-all

set boost_compiled_libs=--with-date_time^
--with-locale^
--with-regex^
--with-thread

rem the number actually means platform toolset, not %VisualStudioVersion%
rem eg. BJAM_TOOLSET=msvc-14.2 corresponds to PLATFORM_TOOLSET=v142
if defined BJAM_TOOLSET (
set bjam_options=toolset=%BJAM_TOOLSET%
)
set bjam_options=%bjam_options%^
variant=%boost_build_variant%^
link=static^
threading=multi^
runtime-link=static^
cxxflags="/Zc:threadSafeInit- "

set bjam_options_x86=%bjam_options%^
define=BOOST_USE_WINAPI_VERSION=0x0501^
architecture=x86^
address-model=32

set bjam_options_x64=%bjam_options%^
define=BOOST_USE_WINAPI_VERSION=0x0502^
architecture=x86^
address-model=64

set bjam_options_arm64=%bjam_options%^
define=BOOST_USE_WINAPI_VERSION=0x0A00^
architecture=arm^
address-model=64

if %build_boost% == 1 (
if %build_boost_x86% == 0 (
if %build_boost_x64% == 0 (
if %build_boost_arm64% == 0 (
rem default architecture
set build_boost_x86=1
))))

if %build_boost% == 1 (
pushd %BOOST_ROOT%
if not exist b2.exe call .\bootstrap.bat
if errorlevel 1 goto error

if %build_boost_x86% == 1 (
b2 %bjam_options_x86% stage %boost_compiled_libs%
if errorlevel 1 goto error
)

if %build_boost_x64% == 1 (
b2 %bjam_options_x64% stage %boost_compiled_libs%
if errorlevel 1 goto error
)

if %build_boost_arm64% == 1 (
b2 %bjam_options_arm64% stage %boost_compiled_libs%
if errorlevel 1 goto error
)
popd
)

if defined CMAKE_GENERATOR (
set common_cmake_flags=%common_cmake_flags% -G%CMAKE_GENERATOR%
)
Expand Down
17 changes: 0 additions & 17 deletions install-boost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,10 @@ download_boost_source() {
[[ -f "${BOOST_ROOT}/bootstrap.sh" ]]
}

boost_libs="${boost_libs=regex}"
boost_cxxflags='-arch arm64 -arch x86_64'

build_boost_macos() {
cd "${BOOST_ROOT}"
./bootstrap.sh --with-toolset=clang --with-libraries="${boost_libs}"
./b2 -q -a link=static architecture=arm cxxflags="${boost_cxxflags}" stage
for lib in stage/lib/*.a; do
lipo $lib -info
done
}

if [[ $# -eq 0 || " $* " =~ ' --download ' ]]; then
if [[ ! -f "${BOOST_ROOT}/bootstrap.sh" ]]; then
download_boost_source
else
echo "found boost at ${BOOST_ROOT}"
fi
fi
if [[ $# -eq 0 || " $* " =~ ' --build ' ]]; then
if [[ "$OSTYPE" =~ 'darwin' ]]; then
build_boost_macos
fi
fi

0 comments on commit 298a9dd

Please sign in to comment.