Skip to content

Commit

Permalink
#0: Add ccache option to build_metal.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavle Josipovic authored and pavlejosipovic committed Jun 3, 2024
1 parent 0631eb1 commit e08a919
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions build_metal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ show_help() {
echo "Usage: $0 [-h] [-e]"
echo " -h Show this help message."
echo " -e Enable CMAKE_EXPORT_COMPILE_COMMANDS."
echo " -c Enable ccache for the build."
}

# Parse CLI options
export_compile_commands="OFF"
while getopts "he" opt; do
enable_ccache="OFF"
while getopts "hec" opt; do
case ${opt} in
h )
show_help
Expand All @@ -65,6 +67,9 @@ while getopts "he" opt; do
e )
export_compile_commands="ON"
;;
c )
enable_ccache="ON"
;;
\? )
show_help
exit 1
Expand All @@ -89,7 +94,13 @@ else
fi

echo "Building tt-metal"
cmake -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++-17 -DCMAKE_EXPORT_COMPILE_COMMANDS=$export_compile_commands
cmake_args="-B build -G Ninja -DCMAKE_CXX_COMPILER=clang++-17 -DCMAKE_EXPORT_COMPILE_COMMANDS=$export_compile_commands"

if [ "$enable_ccache" = "ON" ]; then
cmake_args="$cmake_args -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
fi

cmake $cmake_args
cmake --build build --target install # <- this is a general cmake way, can also just run `ninja install -C build`

echo "Building cpp tests"
Expand Down

0 comments on commit e08a919

Please sign in to comment.