Skip to content

Commit 9b62353

Browse files
Migrate third_party/ to git submodules.
This replaces third_party/absl/ and third_party/protobuf-lite/ with submodules checked out at specific versions for abseil-cpp, googletest, benchmark, and protobuf libraries. This change allows removing local code copies of absl and googltest functionality.
1 parent 2734490 commit 9b62353

File tree

180 files changed

+1483
-42914
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+1483
-42914
lines changed

.github/workflows/cifuzz.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
dry-run: false
2424
language: c++
2525
- name: Upload Crash
26-
uses: actions/upload-artifact@v3
26+
uses: actions/upload-artifact@v4
2727
if: failure() && steps.build.outcome == 'success'
2828
with:
2929
name: artifacts

.github/workflows/cmake.yml

+17-13
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ permissions:
1414
jobs:
1515
build:
1616
strategy:
17+
fail-fast: false
1718
matrix:
18-
os: [ ubuntu-latest, ubuntu-20.04, windows-latest, macOS-11 ]
19+
os: [ ubuntu-latest, ubuntu-22.04, windows-latest ]
1920
arch: [ x64 ]
20-
include:
21-
- os: windows-latest
22-
arch: x86
2321
runs-on: ${{ matrix.os }}
2422

2523
permissions:
2624
contents: write # svenstaro/upload-release-action
2725

2826
steps:
2927
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
28+
with:
29+
submodules: 'recursive'
3030
- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
3131
with:
3232
python-version: '3.x'
@@ -35,16 +35,14 @@ jobs:
3535
- name: Config for Windows
3636
if: runner.os == 'Windows'
3737
run: |
38-
if ("${{matrix.arch}}" -eq "x64") {
39-
$msbuildPlatform = "x64"
40-
} else {
41-
$msbuildPlatform = "Win32"
42-
}
43-
cmake -A $msbuildPlatform -B ${{github.workspace}}/build -DSPM_BUILD_TEST=ON -DSPM_ENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/root
38+
cmake -A x64 -B ${{github.workspace}}/build -DSPM_BUILD_TEST=ON -DBUILD_SHARED_LIBS=OFF -DSPM_ENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/root
4439
4540
- name: Config for Unix
4641
if: runner.os != 'Windows'
47-
run: cmake -B ${{github.workspace}}/build -DSPM_BUILD_TEST=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/root
42+
run: |
43+
sudo apt-get update
44+
sudo apt-get install -y pkgconf
45+
cmake -B ${{github.workspace}}/build -DSPM_BUILD_TEST=ON -DBUILD_SHARED_LIBS=OFF -DSPM_ENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/root
4846
env:
4947
CMAKE_OSX_ARCHITECTURES: arm64;x86_64
5048

@@ -54,6 +52,8 @@ jobs:
5452
- name: Test
5553
working-directory: ${{github.workspace}}/build
5654
run: ctest -C Release --output-on-failure
55+
env:
56+
TEST_SRCDIR: ${{github.workspace}}/data
5757

5858
- name: Package
5959
working-directory: ${{github.workspace}}/build
@@ -65,12 +65,16 @@ jobs:
6565
python -m pip install --require-hashes --no-dependencies -r ../.github/workflows/requirements/base.txt
6666
python setup.py build
6767
python setup.py bdist_wheel
68+
pip install dist/*.whl
69+
pushd test
6870
python -m pytest
71+
env:
72+
GITHUB_REF_NAME: "${{github.ref_name}}"
6973

7074
- name: Upload artifcacts
71-
uses: actions/upload-artifact@v3
75+
uses: actions/upload-artifact@v4
7276
with:
73-
name: artifcacts
77+
name: "build-python-wrapper-artifacts-${{matrix.os}}-${{matrix.arch}}"
7478
path: ./build/*.7z
7579

7680
- name: Upload Release Assets

.github/workflows/cross_build.yml

+16-5
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,29 @@ jobs:
2121

2222
steps:
2323
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
24+
with:
25+
submodules: 'recursive'
2426

2527
- name: Install cross tools
2628
run: |
2729
sudo apt-get update
28-
sudo apt-get install -y sudo qemu-user gdb zstd dwarfdump {gcc,g++}-10-{i686,aarch64,riscv64,powerpc,powerpc64,powerpc64le,s390x,sparc64,m68k,sh4,alpha}-linux-gnu {gcc,g++}-10-arm-linux-gnueabihf
29-
sudo ln -sf /usr/bin/arm-linux-gnueabihf-gcc-10 /usr/bin/arm-linux-gnu-gcc-10
30-
sudo ln -sf /usr/bin/arm-linux-gnueabihf-g++-10 /usr/bin/arm-linux-gnu-g++-10
31-
sudo ln -sf /usr/arm-linux-gnueabihf /usr/arm-linux-gnu
30+
sudo apt-get install -y sudo qemu-user gdb zstd dwarfdump
31+
if [[ "${{matrix.arch}}" != "arm" ]]; then
32+
sudo apt-get install -y {gcc,g++}-14-${{matrix.arch}}-linux-gnu
33+
else
34+
sudo apt-get install -y {gcc,g++}-14-arm-linux-gnueabihf
35+
sudo ln -sf /usr/bin/arm-linux-gnueabihf-gcc-14 /usr/bin/arm-linux-gnu-gcc-14
36+
sudo ln -sf /usr/bin/arm-linux-gnueabihf-g++-14 /usr/bin/arm-linux-gnu-g++-14
37+
sudo ln -sf /usr/arm-linux-gnueabihf /usr/arm-linux-gnu
38+
sudo ln -sf /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /lib/ld-linux-armhf.so.3
39+
fi
40+
3241
3342
- name: Build
3443
run: |
3544
mkdir -p ${{github.workspace}}/build
3645
cd ${{github.workspace}}/build
37-
env CXX=/usr/bin/${{matrix.arch}}-linux-gnu-g++-10 CC=/usr/bin/${{matrix.arch}}-linux-gnu-gcc-10 cmake .. -DSPM_BUILD_TEST=ON -DSPM_ENABLE_SHARED=OFF -DCMAKE_FIND_ROOT_PATH=/usr/${{matrix.arch}}-linux-gnu -DSPM_CROSS_SYSTEM_PROCESSOR=${{matrix.arch}}
46+
env CXX=/usr/bin/${{matrix.arch}}-linux-gnu-g++-14 CC=/usr/bin/${{matrix.arch}}-linux-gnu-gcc-14 cmake .. -DSPM_BUILD_TEST=ON -DBUILD_SHARED_LIBS=OFF -DSPM_ENABLE_SHARED=OFF -DCMAKE_FIND_ROOT_PATH=/usr/${{matrix.arch}}-linux-gnu -DSPM_CROSS_SYSTEM_PROCESSOR=${{matrix.arch}}
3847
make -j$(nproc)
3948
4049
- name: Test on QEMU
@@ -43,3 +52,5 @@ jobs:
4352
cd ${{github.workspace}}/build
4453
qemu_arch=`echo ${{matrix.arch}} | sed -e s/powerpc/ppc/ -e s/686/386/`
4554
qemu-${qemu_arch} -L /usr/${{matrix.arch}}-linux-gnu src/spm_test
55+
env:
56+
TEST_SRCDIR: ${{github.workspace}}/data

.github/workflows/wheel.yml

+19-11
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ jobs:
1818
digests-macos: ${{ steps.hash-macos.outputs.digests }}
1919
digests-windows: ${{ steps.hash-windows.outputs.digests }}
2020
strategy:
21+
fail-fast: false
2122
matrix:
22-
os: [ubuntu-latest, windows-latest, macOS-11]
23+
os: [ubuntu-latest, windows-latest, windows-11-arm]
2324
runs-on: ${{ matrix.os }}
2425
name: Build wheels on ${{ matrix.os }}
2526

@@ -28,30 +29,36 @@ jobs:
2829

2930
steps:
3031
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
32+
with:
33+
submodules: 'recursive'
3134
- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
3235
with:
33-
python-version: "3.x"
36+
python-version: ">=3.8"
3437

3538
- name: Set up QEMU
3639
if: runner.os == 'Linux'
3740
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
3841
with:
3942
platforms: arm64
4043

41-
- name: Build for Windows
42-
if: runner.os == 'Windows'
44+
- name: Build for Windows x64
45+
if: runner.os == 'Windows' && runner.arch == 'X64'
4346
run: |
44-
cmake -A Win32 -B ${{github.workspace}}/build_win32 -DSPM_ENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/root_win32
47+
cmake -A Win32 -B ${{github.workspace}}/build_win32 -DBUILD_SHARED_LIBS=OFF -DSPM_ENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/root_win32
4548
cmake --build ${{github.workspace}}/build_win32 --config Release --target install --parallel 8
46-
cmake -A x64 -B ${{github.workspace}}/build_amd64 -DSPM_ENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/root_amd64
49+
cmake -A x64 -B ${{github.workspace}}/build_amd64 -DBUILD_SHARED_LIBS=OFF -DSPM_ENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/root_amd64
4750
cmake --build ${{github.workspace}}/build_amd64 --config Release --target install --parallel 8
48-
cmake -A arm64 -B ${{github.workspace}}/build_arm64 -DSPM_ENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/root_arm64
51+
52+
- name: Build for Windows Arm
53+
if: runner.os == 'Windows' && runner.arch == 'ARM64'
54+
run: |
55+
cmake -A arm64 -B ${{github.workspace}}/build_arm64 -DBUILD_SHARED_LIBS=OFF -DSPM_ENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/root_arm64
4956
cmake --build ${{github.workspace}}/build_arm64 --config Release --target install --parallel 8
5057
5158
- name: Build for Mac
5259
if: runner.os == 'macOS'
5360
run: |
54-
cmake -B ${{github.workspace}}/build -DSPM_ENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/root
61+
cmake -B ${{github.workspace}}/build -DSPM_ENABLE_SHARED=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/root
5562
cmake --build ${{github.workspace}}/build --config Release --target install --parallel 8
5663
env:
5764
CMAKE_OSX_ARCHITECTURES: arm64;x86_64
@@ -66,10 +73,11 @@ jobs:
6673
working-directory: ${{github.workspace}}/python
6774
run: python -m cibuildwheel --output-dir wheelhouse
6875
env:
76+
CIBW_ENVIRONMENT: "GITHUB_REF_NAME=${{ github.ref_name }}"
6977
CIBW_ARCHS_LINUX: auto aarch64
7078
CIBW_ARCHS_MACOS: x86_64 universal2 arm64
7179
CIBW_ARCHS_WINDOWS: auto ARM64
72-
CIBW_SKIP: "pp* *-musllinux_*"
80+
CIBW_SKIP: "pp* *-musllinux_* cp3{6,7}-*"
7381
CIBW_BUILD_VERBOSITY: 1
7482

7583
- name: Build sdist archive
@@ -91,9 +99,9 @@ jobs:
9199
run: cp -f dist/*.tar.gz wheelhouse/
92100

93101
- name: Upload artifact
94-
uses: actions/upload-artifact@v3
102+
uses: actions/upload-artifact@v4
95103
with:
96-
name: artifacts
104+
name: "build-wheel-artifacts-${{matrix.os}}"
97105
path: |
98106
./python/wheelhouse/*.whl
99107
./python/wheelhouse/*.tar.gz

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ dist/
6363
*.swp
6464
*.swo
6565
*.pyc
66+
*.whl
6667

6768
m.model
6869
m.vocab
@@ -72,6 +73,8 @@ libsentencepiece.so*
7273
libsentencepiece_train.so*
7374
python/bundled
7475
_sentencepiece.*.so
75-
third_party/abseil-cpp
76+
77+
# Generated proto files.
78+
src/*.pb.*
7679

7780
python/sentencepiece

.gitmodules

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[submodule "third_party/googletest"]
2+
path = third_party/googletest
3+
url = https://github.com/google/googletest.git
4+
[submodule "third_party/protobuf"]
5+
path = third_party/protobuf
6+
url = https://github.com/protocolbuffers/protobuf.git
7+
[submodule "third_party/abseil-cpp"]
8+
path = third_party/abseil-cpp
9+
url = https://github.com/abseil/abseil-cpp.git
10+
[submodule "third_party/benchmark"]
11+
path = third_party/benchmark
12+
url = https://github.com/google/benchmark.git

0 commit comments

Comments
 (0)