Add flatc

This commit is contained in:
Isaac 2025-01-14 22:48:51 +08:00
parent 40e472fd7f
commit 6f95dad40a
2 changed files with 43 additions and 0 deletions

View File

@ -45,6 +45,12 @@ http_file(
sha256 = "89a287444b5b3e98f88a945afa50ce937b8ffd1dcc59c555ad9b1baf855298c9", sha256 = "89a287444b5b3e98f88a945afa50ce937b8ffd1dcc59c555ad9b1baf855298c9",
) )
http_file(
name = "flatbuffers_zip",
urls = ["https://github.com/google/flatbuffers/archive/refs/tags/v24.12.23.zip"],
sha256 = "c5cd6a605ff20350c7faa19d8eeb599df6117ea4aabd16ac58a7eb5ba82df4e7",
)
http_archive( http_archive(
name = "appcenter_sdk", name = "appcenter_sdk",
urls = ["https://github.com/microsoft/appcenter-sdk-apple/releases/download/4.1.1/AppCenter-SDK-Apple-4.1.1.zip"], urls = ["https://github.com/microsoft/appcenter-sdk-apple/releases/download/4.1.1/AppCenter-SDK-Apple-4.1.1.zip"],

37
third-party/flatc/BUILD vendored Normal file
View File

@ -0,0 +1,37 @@
genrule(
name = "flatc",
srcs = [
"@flatbuffers_zip//file",
"@cmake_tar_gz//file",
],
cmd_bash =
"""
set -x
core_count=`PATH="$$PATH:/usr/sbin" sysctl -n hw.logicalcpu`
BUILD_DIR="$(RULEDIR)/build"
rm -rf "$$BUILD_DIR"
mkdir -p "$$BUILD_DIR"
CMAKE_DIR="$$(pwd)/$$BUILD_DIR/cmake"
rm -rf "$$CMAKE_DIR"
mkdir -p "$$CMAKE_DIR"
tar -xf "$(location @cmake_tar_gz//file)" -C "$$CMAKE_DIR"
tar -xzf "$(location @flatbuffers_zip//file)" --directory "$$BUILD_DIR"
pushd "$$BUILD_DIR/flatbuffers-24.12.23"
mkdir build
cd build
PATH="$$PATH:$$CMAKE_DIR/cmake-3.23.1-macos-universal/CMake.app/Contents/bin" cmake .. -DCMAKE_BUILD_TYPE=Release"
make -j $$core_count
popd
tar -cf "$(location flatc.tar)" -C "$$BUILD_DIR/flatbuffers-24.12.23/build" .
""",
outs = [
"flatc.tar",
],
visibility = [
"//visibility:public",
]
)