Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 39 additions & 14 deletions etc/Build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ usage: $0 [OPTIONS]

OPTIONS:
-cmake='-<key>=<value> [-<key>=<value> ...]' User defined cmake options
Note: use single quote after
-cmake= and double quotes if
<key> has multiple <values>
e.g.: -cmake='-DFLAGS="-a -b"'
-compiler=COMPILER_NAME Compiler name: gcc or clang
Default: gcc
Note: use single quote after
-cmake= and double quotes if
<key> has multiple <values>
e.g.: -cmake='-DFLAGS="-a -b"'
-compiler=COMPILER_NAME Compiler name: gcc or clang
Default: gcc
-no-warnings
Compiler warnings are
considered errors, i.e.,
use -Werror flag during build.
-dir=PATH Path to store build files.
Default: ./build
Default: ./build
-coverage Enable cmake coverage options
-clean Remove build dir before compile
-no-gui Disable GUI support
Expand All @@ -50,16 +50,16 @@ OPTIONS:
-cpp20 Use C++20 standard
-build-man Build Man Pages (optional)
-threads=NUM_THREADS Number of threads to use during
compile. Default: \`nproc\` on linux
or \`sysctl -n hw.logicalcpu\` on macOS
compile. Default: \`nproc\` on linux
or \`sysctl -n hw.logicalcpu\` on macOS
-keep-log Keep a compile log in build dir
-help Shows this message
-gpu Enable GPU to accelerate the process
-deps-prefixes-file=FILE File with CMake packages roots,
its content extends -cmake argument.
By default, "openroad_deps_prefixes.txt"
file from OpenROAD's "etc" directory
or from system "/etc".
its content extends -cmake argument.
By default, "openroad_deps_prefixes.txt"
file from OpenROAD's "etc" directory
or from system "/etc".

EOF
exit "${1:-1}"
Expand Down Expand Up @@ -201,6 +201,31 @@ fi
mkdir -p "${buildDir}"
__logging

# ==============================================================================
# OPENROAD ASCII SPLASH SCREEN
# ==============================================================================
if [[ -t 1 ]]; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The script uses tput to set terminal colors, but it doesn't check if the tput command is available. With set -e active, the script will exit with an error if tput is not found. To improve robustness, it's best to verify the command exists before using it.

Suggested change
if [[ -t 1 ]]; then
if [[ -t 1 ]] && command -v tput >/dev/null; then

CYAN=$(tput setaf 6)
NC=$(tput sgr0)
else
CYAN=''
NC=''
fi

cat << EOF
${CYAN}
____ ____ ___ _ ____
/ __ \_ __ ___ _ __ | _ \ / _ \ / \ | _ \
| | | | '_ \ / _ \ '_ \| |_) | | | |/ _ \ | | | |
| |__| | |_) | __/ | | | _ <| |_| / ___ \| |_| |
\____/| .__/ \___|_| |_|_| \_\___/_/ \_\____/
|_|
${NC}
Welcome to the OpenROAD Build System!
=========================================================
EOF
# ==============================================================================

if [[ "$OSTYPE" == "darwin"* ]]; then
export PATH="$(brew --prefix bison)/bin:$(brew --prefix flex)/bin:$PATH"
export CMAKE_PREFIX_PATH=$(brew --prefix or-tools)
Expand All @@ -214,4 +239,4 @@ if [[ "$isNinja" == "yes" ]]; then
exit 0
fi
eval cmake "${cmakeOptions}" -B "${buildDir}" .
eval time cmake --build "${buildDir}" -j "${numThreads}"
eval time cmake --build "${buildDir}" -j "${numThreads}"
Loading