1#!/bin/bash -eu 2# Copyright 2019 Google Inc. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16################################################################################ 17 18# TODO(metzman): Use some kind of bash loop here. 19mkdir glslang/build 20pushd glslang/build 21 22cmake -G "Ninja" -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" .. 23ninja 24cp StandAlone/glslangValidator $OUT 25popd 26 27mkdir SPIRV-Tools/build 28pushd SPIRV-Tools/build 29 30# TODO: If cmake respects LDFLAGS, do we need to specify the compilers and their flags? 31# Link failure without LDFLAGS="-lpthread" 32LDFLAGS="-lpthread" cmake -G "Ninja" -DSPIRV_SKIP_TESTS=ON -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" .. 33ninja 34cp tools/spirv-as tools/spirv-dis tools/spirv-val tools/spirv-opt $OUT/ 35popd 36 37mkdir SPIRV-Cross/build 38pushd SPIRV-Cross/build 39cmake -G "Ninja" -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" .. 40ninja 41cp spirv-cross $OUT/ 42 43