-
Notifications
You must be signed in to change notification settings - Fork 498
Expand file tree
/
Copy pathbuild-wasm.sh
More file actions
44 lines (33 loc) · 1014 Bytes
/
build-wasm.sh
File metadata and controls
44 lines (33 loc) · 1014 Bytes
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
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
#
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# Copyright 2019 Google LLC
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
set -e
if ! command -v emcmake >/dev/null 2>&1; then
echo "emcmake not found in PATH, please install emscripten SDK and add it to PATH"
exit 1
fi
mkdir -p build/wasm
CMAKE_ARGS=()
# CMake-level configuration
CMAKE_ARGS+=("-DCMAKE_BUILD_TYPE=Release")
CMAKE_ARGS+=("-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
CMAKE_ARGS+=("-DXNNPACK_LIBRARY_TYPE=static")
CMAKE_ARGS+=("-DXNNPACK_BUILD_BENCHMARKS=ON")
CMAKE_ARGS+=("-DXNNPACK_BUILD_TESTS=ON")
# Use-specified CMake arguments go last to allow overridding defaults
CMAKE_ARGS+=($@)
cd build/wasm && emcmake cmake ../.. \
"${CMAKE_ARGS[@]}"
# Cross-platform parallel build
if [ "$(uname)" == "Darwin" ]
then
cmake --build . -- "-j$(sysctl -n hw.ncpu)"
else
cmake --build . -- "-j$(nproc)"
fi