3 # Copyright (c) 2020 The Khronos Group Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
19 # This is required to run any git command in the docker since owner will
20 # have changed between the clone environment, and the docker container.
21 # Marking the root of the repo as safe for ownership changes.
22 git config
--global --add safe.directory
/app
25 echo "Detected $NUM_CORES cores for building"
27 DIR
="$( cd "$
( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
28 VERSION
=$
(sed -n '0,/^v20/ s/^v\(20[0-9.]*\).*/\1/p' $DIR/..
/..
/CHANGES
).
${GITHUB_RUN_NUMBER:-0}
29 echo "Version: $VERSION"
39 -DCMAKE_BUILD_TYPE=Release \
42 emmake
make -j $
(( $NUM_CORES )) SPIRV-Tools-static
44 echo Building js interface
49 ..
/..
/source
/wasm
/spirv-tools.cpp \
50 source
/libSPIRV-Tools.a \
59 cp source
/wasm
/spirv-tools.d.ts out
/$type/
60 sed -e 's/\("version"\s*:\s*\).*/\1"'$VERSION'",/' source
/wasm
/package.json
> out
/$type/package.json
61 cp source
/wasm
/README.md out
/$type/
64 cp build
/$type/spirv-tools.js out
/$type/
65 gzip -9 -k -f out
/$type/spirv-tools.js
66 if [ -e build
/$type/spirv-tools.wasm
] ; then
67 cp build
/$type/spirv-tools.wasm out
/$type/
68 gzip -9 -k -f out
/$type/spirv-tools.wasm
72 if [ ! -d external
/spirv-headers
] ; then
77 echo Building
${BASH_REMATCH[1]}
79 -DSPIRV_COLOR_TERMINAL=OFF\
80 -DSPIRV_SKIP_TESTS=ON\
81 -DSPIRV_SKIP_EXECUTABLES=ON