-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
build.sh
33 lines (26 loc) · 1.17 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
set -euxo pipefail
if [[ "${target_platform}" == osx-* ]]; then
export LDFLAGS="${LDFLAGS} -lz -framework CoreFoundation -Xlinker -undefined -Xlinker dynamic_lookup"
# Force C++17 to workaround symbol visibility issues
export CXXFLAGS=${CXXFLAGS/std=c++14/std=c++17}
sed -i -e 's/c++14/c++17/g' .bazelrc
else
export LDFLAGS="${LDFLAGS} -lrt"
fi
source gen-bazel-toolchain
CUSTOM_BAZEL_OPTIONS="--bazel_options=--crosstool_top=//bazel_toolchain:toolchain --bazel_options=--logging=6 --bazel_options=--verbose_failures --bazel_options=--toolchain_resolution_debug"
if [[ "${target_platform}" == "osx-64" ]]; then
# Tensorflow doesn't cope yet with an explicit architecture (darwin_x86_64) on osx-64 yet.
TARGET_CPU=darwin
fi
if [[ "${target_platform}" == "osx-arm64" ]]; then
${PYTHON} build/build.py --target_cpu_features default --enable_mkl_dnn ${CUSTOM_BAZEL_OPTIONS} --target_cpu ${TARGET_CPU}
else
${PYTHON} build/build.py --target_cpu_features default --enable_mkl_dnn ${CUSTOM_BAZEL_OPTIONS} --bazel_options=--cpu --bazel_options=${TARGET_CPU}
fi
# Clean up to speedup postprocessing
pushd build
bazel clean
popd
${PYTHON} -m pip install dist/jaxlib-*.whl