forked from OpenSees/OpenSees
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmakeUbuntu.sh
More file actions
executable file
·43 lines (30 loc) · 1.22 KB
/
Copy pathmakeUbuntu.sh
File metadata and controls
executable file
·43 lines (30 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
#
# NOTE: assumes conan>2, cmake, gcc, g++ and gfortran, python3-pip and liblapack-dev are apt installed
# and that conan profile detect has been run and available in current env .. see OpenSeesAWS-Ubuntu22.04.sh if lost
export CC=gcc
export CXX=g++
export FC=gfortran
export CMAKE_ARGS=-DCMAKE_POLICY_VERSION_MINIMUM=3.5
BUILD_DIR="build"
OUTPUT_DIR="$HOME/bin/OpenSees"
# Define a helper to print error and stop without closing the terminal
die() {
echo "$1"
exit 1
}
echo "Cleaning up old build directory..."
rm -rf "${BUILD_DIR}"
#
# run conan to install dependencies
#
conan install . --output-folder="${BUILD_DIR}" --build missing -s build_type=Release || die "FAIL: Conan install failed."
#
# run cmake to generate CMakefiles, then build & finally install
#
cmake -B "${BUILD_DIR}" -S . \
-DCMAKE_TOOLCHAIN_FILE="${BUILD_DIR}/build/Release/generators/conan_toolchain.cmake" \
-DCMAKE_BUILD_TYPE=Release || die "FAIL: CMake configure failed."
cmake --build "${BUILD_DIR}" --parallel 4 || die "FAIL: CMake build failed."
cmake --build "${BUILD_DIR}" --target OpenSeesPy || die "FAIL: CMake build failed."
cmake --install "${BUILD_DIR}" --prefix "${OUTPUT_DIR}" || die "FAIL: CMake install failed."