Skip to content

Commit

Permalink
Update ONNX script
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Apr 26, 2024
1 parent f320d06 commit 8b23387
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions tools/onnx
Expand Up @@ -40,20 +40,22 @@ sync() {
install() {
echo "onnx install"
venv
protobuf_version=$(grep "protobuf" ./third_party/source/onnx/requirements.txt | cut -d'=' -f2)
protoc_dir="$(pwd)/third_party/bin/protobuf/v${protobuf_version}"
case "${OSTYPE}" in
# linux*)
# [ -x "$(command -v cmake)" ] || sudo apt install -y cmake
# if [ ! -f "${protoc_dir}/bin/protoc" ]; then
# rm -rf ${protoc_dir}
# git clone --quiet -c advice.detachedHead=false --quiet --recursive --depth=1 --branch v${protobuf_version} https://github.com/protocolbuffers/protobuf.git ${protoc_dir}/src
# pushd "${protoc_dir}/src/cmake" > /dev/null
# cmake ../cmake -DCMAKE_CXX_FLAGS="-w" -Dprotobuf_BUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="..\.." -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release > /dev/null
# make -j$(nproc) > /dev/null
# make install > /dev/null
# popd > /dev/null
# fi
# export PATH="${protoc_dir}\bin":${PATH}
# ;;
linux*)
[ -x "$(command -v cmake)" ] || sudo apt install -y cmake
if [ ! -f "${protoc_dir}/bin/protoc" ]; then
rm -rf ${protoc_dir}
git clone --quiet -c advice.detachedHead=false --quiet --recursive --depth=1 --branch v${protobuf_version} https://github.com/protocolbuffers/protobuf.git ${protoc_dir}/src
pushd "${protoc_dir}/src/cmake" > /dev/null
cmake ../cmake -DCMAKE_CXX_FLAGS="-w" -Dprotobuf_BUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="..\.." -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release > /dev/null
make -j$(nproc) > /dev/null
make install > /dev/null
popd > /dev/null
fi
export PATH="${protoc_dir}\bin":${PATH}
;;
# darwin*)
# [ -x "$(command -v cmake)" ] || brew install cmake > /dev/null
# if [ ! -f "${protoc_dir}/bin/protoc" ]; then
Expand All @@ -72,11 +74,9 @@ install() {
programfiles_x86_dir=$(env | grep "^ProgramFiles(x86)=" | cut -d '=' -f 2)
build_tools_dir="${programfiles_x86_dir}\Microsoft Visual Studio\2019\BuildTools"
cmake_dir="${build_tools_dir}\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin"
protobuf_version=$(grep "protobuf" ./third_party/source/onnx/requirements.txt | cut -d'=' -f2)
protobuf="protobuf==${protobuf_version}"
${python} -m pip install --quiet --upgrade ${protobuf}
export PATH="$(cygpath -u "${cmake_dir}")":${PATH}
protoc_dir="$(pwd)/third_party/bin/protobuf/v${protobuf_version}"
msbuild_dir="${build_tools_dir}\MSBuild\Current\Bin"
if [ ! -f "${protoc_dir}/bin/protoc.exe" ]; then
rm -rf ${protoc_dir}
Expand Down

0 comments on commit 8b23387

Please sign in to comment.