Skip to content

Commit 5cd3107

Browse files
docs: Update dependency install instructions to use setup.sh
Signed-off-by: alokkumardalei-wq <alokkumardalei2@gmail.com>
1 parent 8eecd06 commit 5cd3107

2 files changed

Lines changed: 63 additions & 30 deletions

File tree

docs/user/Build.md

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -97,39 +97,20 @@ it can be uploaded in the "Relevant log output" section of OpenROAD
9797

9898
### Install Dependencies
9999

100-
You may follow our helper script to install dependencies as follows:
100+
We recommend using the `setup.sh` script located in the [OpenROAD-flow-scripts](https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts) repository to install all dependencies. `setup.sh` encapsulates the calls to `DependencyInstaller.sh` and ensures the entire flow environment is configured correctly.
101+
102+
Alternatively, if you are building OpenROAD standalone, you may use our helper script:
101103
``` shell
102104
sudo ./etc/DependencyInstaller.sh -base
103105
./etc/DependencyInstaller.sh -common -local
104106
```
105107

106-
107108
```{warning}
108109
`sudo ./etc/DependencyInstaller.sh [-all|-common]` defaults to
109110
installing packages on /usr/local.
110111
To avoid this bahavior use -local flag or -prefix <PATH> argument.
111112
```
112113

113-
The installer script natively supports the following arguments:
114-
```shell
115-
Options:
116-
-all Install all dependencies (base and common). Requires privileged access.
117-
-base Install base dependencies using package managers. Requires privileged access.
118-
-common Install common dependencies.
119-
-eqy Install equivalence dependencies (yosys, eqy, sby).
120-
-prefix=DIR Install common dependencies in a user-specified directory.
121-
-local Install common dependencies in ${HOME}/.local.
122-
-ci Install dependencies required for CI.
123-
-nocert Disable certificate checks for downloads.
124-
-skip-system-or-tools Skip searching for a system-installed or-tools library.
125-
-save-deps-prefixes=FILE Save OpenROAD build arguments to FILE.
126-
-constant-build-dir Use a constant build directory instead of a random one.
127-
-threads=<N> Limit the number of compiling threads.
128-
-yosys-ver=<VERSION> Specify a custom Yosys version. Used for ORFS.
129-
-verbose Show all output from build commands.
130-
-h, -help Show this help message.
131-
```
132-
133114
### Build OpenROAD
134115

135116
To build with the default options in release mode:

etc/Build.sh

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ while [ "$#" -gt 0 ]; do
102102
cmakeOptions+=("-DENABLE_TESTS=OFF")
103103
;;
104104
-ninja)
105-
cmakeOptions+=("-DCMAKE_C_COMPILER_LAUNCHER=ccache" "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache" "-GNinja")
105+
cmakeOptions+=("-DCMAKE_C_COMPILER_LAUNCHER=ccache")
106+
cmakeOptions+=("-DCMAKE_CXX_COMPILER_LAUNCHER=ccache")
107+
cmakeOptions+=("-GNinja")
106108
isNinja=yes
107109
;;
108110
-cpp20)
@@ -118,10 +120,12 @@ while [ "$#" -gt 0 ]; do
118120
cmakeOptions+=("-DALLOW_WARNINGS=OFF")
119121
;;
120122
-coverage )
121-
cmakeOptions+=("-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_CXX_FLAGS=-fprofile-arcs -ftest-coverage" "-DCMAKE_EXE_LINKER_FLAGS=-lgcov")
123+
cmakeOptions+=("-DCMAKE_BUILD_TYPE=Debug")
124+
cmakeOptions+=("-DCMAKE_CXX_FLAGS=-fprofile-arcs -ftest-coverage")
125+
cmakeOptions+=("-DCMAKE_EXE_LINKER_FLAGS=-lgcov")
122126
;;
123127
-cmake=*)
124-
eval "temp_arr=(${1#*=})"
128+
read -ra temp_arr <<< "${1#*=}"
125129
cmakeOptions+=("${temp_arr[@]}")
126130
;;
127131
-clean )
@@ -167,11 +171,8 @@ if [[ -z "$depsPrefixesFile" ]]; then
167171
fi
168172
fi
169173
if [[ -f "$depsPrefixesFile" ]]; then
170-
while read -r dep; do
171-
if [[ -n "$dep" && "$dep" != \#* ]]; then
172-
cmakeOptions+=("$dep")
173-
fi
174-
done < <(xargs -n1 < "$depsPrefixesFile")
174+
read -ra newOpts <<< "$(cat "$depsPrefixesFile")"
175+
cmakeOptions+=("${newOpts[@]}")
175176
echo "[INFO] Using additional CMake parameters from $depsPrefixesFile"
176177
else
177178
echo "[INFO] Auto-generated prefix file does not exist - CMake will choose the dependencies automatically"
@@ -224,6 +225,57 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
224225
export CMAKE_PREFIX_PATH=$(brew --prefix or-tools)
225226
fi
226227

228+
# ==============================================================================
229+
# PRE-COMPILATION SYSTEM CHECKS
230+
# ==============================================================================
231+
if [[ -t 1 ]]; then
232+
RED=$(tput setaf 1)
233+
GREEN=$(tput setaf 2)
234+
YELLOW=$(tput setaf 3)
235+
NC=$(tput sgr0) # No Color
236+
else
237+
RED=''
238+
GREEN=''
239+
YELLOW=''
240+
NC=''
241+
fi
242+
243+
echo -e "${YELLOW}Running pre-compilation system checks...${NC}"
244+
245+
check_command() {
246+
if ! command -v "$1" &> /dev/null; then
247+
echo -e "${RED}[ERROR] Required dependency '$1' is missing!${NC}"
248+
echo "Please install it using 'sudo ./etc/DependencyInstaller.sh' before building."
249+
exit 1
250+
else
251+
echo -e "${GREEN}[OK] Found $1${NC}"
252+
fi
253+
}
254+
255+
# Essential build tools required for OpenROAD
256+
check_command "cmake"
257+
check_command "bison"
258+
check_command "flex"
259+
check_command "swig"
260+
261+
# Compiler check based on user selection
262+
if [[ "${compiler:-gcc}" == "gcc" ]]; then
263+
check_command "gcc"
264+
check_command "g++"
265+
elif [[ "${compiler}" == "clang" ]]; then
266+
check_command "clang"
267+
check_command "clang++"
268+
elif [[ "${compiler}" == "clang-16" ]]; then
269+
check_command "clang-16"
270+
check_command "clang++-16"
271+
else
272+
# Handle unknown compilers gracefully - suggested by gemini-bot
273+
echo -e "${YELLOW}[WARNING] Unsupported compiler '${compiler}' specified. Skipping compiler pre-compilation check.${NC}"
274+
fi
275+
276+
echo -e "${GREEN}All pre-compilation checks passed! Proceeding...${NC}\n"
277+
# ==============================================================================
278+
227279
echo "[INFO] Using ${numThreads} threads."
228280
if [[ "$isNinja" == "yes" ]]; then
229281
cmake "${cmakeOptions[@]}" -B "${buildDir}" .

0 commit comments

Comments
 (0)