• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -eu
2# Copyright 2020 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
18mkdir -p $WORK/build_openexr
19mkdir -p $WORK/build_alembic
20
21# build openexr for alembic
22cd $WORK/build_openexr
23OPENEXR_CMAKE_SETTINGS=(
24  "-D BUILD_SHARED_LIBS=OFF"         # Build static libraries only
25  "-D PYILMBASE_ENABLE=OFF"          # Don't build Python support
26  "-D BUILD_TESTING=OFF"             # Or tests
27  "-D INSTALL_OPENEXR_EXAMPLES=OFF"  # Or examples
28  "-D OPENEXR_LIB_SUFFIX="           # Don't append the version number to library files
29  "-D ILMBASE_LIB_SUFFIX="
30)
31cmake $SRC/openexr ${OPENEXR_CMAKE_SETTINGS[@]}
32make -j$(nproc) && make install
33
34# build alembic
35cd $WORK/build_alembic
36cmake $SRC/alembic -DALEMBIC_SHARED_LIBS=OFF
37make -j$(nproc)
38
39INCLUDES=(
40  "-I $SRC"
41  "-I ${SRC}/alembic/lib"
42  "-I ${WORK}/build_alembic/lib"
43  "-I /usr/local/include/OpenEXR"
44)
45LIBS=("-lImath" "-lIex" "-lHalf")
46
47for fuzzer in $(find $SRC -name '*_fuzzer.cc'); do
48  fuzzer_basename=$(basename -s .cc $fuzzer)
49  $CXX $CXXFLAGS -std=c++11 ${INCLUDES[@]} \
50    $fuzzer $WORK/build_alembic/lib/Alembic/libAlembic.a $LIB_FUZZING_ENGINE \
51    -o $OUT/$fuzzer_basename ${LIBS[@]}
52done
53