-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35b7448
commit a828964
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export FUZZER_MACHINE=sapling | ||
export FUZZER_THREADS=20 | ||
|
||
export CC=gcc CXX=g++ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [[ -z ${FUZZER_MACHINE} ]]; then | ||
echo "Did you remember to source experiments/MY_MACHINE/env.sh? (For an appropriate value of MY_MACHINE)" | ||
exit 1 | ||
fi | ||
|
||
function build_legion_config { | ||
config_name="$1" | ||
cmake_build_type="$2" | ||
|
||
build_dir="build_${config_name}" | ||
install_dir="$PWD/install_${config_name}" | ||
|
||
if [[ -e $build_dir ]]; then | ||
return | ||
fi | ||
|
||
mkdir "$build_dir" | ||
pushd "$build_dir" | ||
cmake_flags=( | ||
-DCMAKE_BUILD_TYPE="$cmake_build_type" | ||
-DCMAKE_INSTALL_PREFIX="$install_dir" | ||
-DCMAKE_CXX_STANDARD=17 | ||
-DCMAKE_CXX_FLAGS_DEBUG='-g -O2' # improve performance of debug code | ||
) | ||
if [[ $cmake_build_type = Debug ]]; then | ||
cmake_flags+=( | ||
-DBUILD_SHARED_LIBS=ON # to improve link speed | ||
-DBUILD_MARCH= # to avoid -march=native for valgrind compatibility | ||
) | ||
fi | ||
cmake "${cmake_flags[@]}" .. | ||
make install -j${FUZZER_THREADS:-4} | ||
popd | ||
} | ||
|
||
function build_fuzzer_config { | ||
config_name="$1" | ||
cmake_build_type="$2" | ||
|
||
build_dir="build_${config_name}" | ||
legion_install_dir="$PWD/legion/install_${config_name}" | ||
|
||
if [[ -e $build_dir ]]; then | ||
return | ||
fi | ||
|
||
mkdir "$build_dir" | ||
pushd "$build_dir" | ||
cmake_flags=( | ||
-DCMAKE_BUILD_TYPE="$cmake_build_type" | ||
-DCMAKE_PREFIX_PATH="$legion_install_dir" | ||
-DCMAKE_CXX_FLAGS="-Wall -Werror" | ||
) | ||
cmake "${cmake_flags[@]}" .. | ||
make -j${FUZZER_THREADS:-4} | ||
popd | ||
} | ||
|
||
if [[ ! -e legion ]]; then | ||
git clone https://gitlab.com/StanfordLegion/legion.git | ||
fi | ||
|
||
pushd legion | ||
build_legion_config debug_single Debug | ||
build_legion_config release_single Release | ||
popd | ||
|
||
build_fuzzer_config debug_single RelWithDebInfo | ||
build_fuzzer_config release_single Release |