11#! /bin/bash
22# #
33
4- export CXX_STD=14
4+ # Absolute path to this script, e.g. /home/user/bin/foo.sh
5+ SCRIPT=` readlink -f " $0 " `
6+ # Absolute path this script is in, thus /home/user/bin
7+ SCRIPTDIR=` dirname " $SCRIPT " `
8+ SCRIPTNAME=` basename " $SCRIPT " `
9+
10+ function print_help {
11+ echo " Usage: $SCRIPTNAME [-h] [-c] <install dir>"
12+ echo " Build SCC installation from tar files"
13+ echo " Optional cli arguments:"
14+ echo " -h print help"
15+ echo " -c clean build and install directory before building"
16+ }
17+
18+ CLEAN=0
19+
20+ while [ $# -gt 0 ]; do
21+ unset OPTIND
22+ unset OPTARG
23+ while getopts hc options; do
24+ case $options in
25+ c) CLEAN=1 ;;
26+ h) print_help; exit 0 ;;
27+ esac
28+ done
29+ shift $(( OPTIND- 1 ))
30+ if [ ! -z " $1 " ]; then
31+ INSTALL_ROOT=" $1 "
32+ shift
33+ fi
34+ done
35+
36+ if [ -z " ${INSTALL_ROOT} " ]; then
37+ echo " Missing install dir argument"
38+ exit 1
39+ fi
40+
41+ export CXX_STD=20
542export CC=$( type -p gcc)
643export CXX=$( type -p g++)
744[ -z " ${BUILD_TYPE} " ] && BUILD_TYPE=RelWithDebInfo
8- if [ -z " ${INSTALL_ROOT} " ]; then
9- if [ -z " ${1} " ]; then
10- echo " Missing install dir argument"
11- exit 1
12- fi
13- export INSTALL_ROOT=$1
14- fi
1545export SC_VERSION=2.3.4
1646export SYSTEMC_HOME=${INSTALL_ROOT} /systemc
1747export SYSTEMCAMS_HOME=${INSTALL_ROOT} /systemc
1848export SCC_INSTALL=${INSTALL_ROOT} /scc
19- DISTRO=$( lsb_release -i -s)
20- [ " $DISTRO " == " Ubuntu" ] || BOOST_LIBDIR=--libdir=${SCC_INSTALL} /lib64
21- [ " $DISTRO " == " Ubuntu" ] || YAML_LIBDIR=-DLIB_SUFFIX=64
22- CMAKE_COMMON_SETTINGS=" -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_STANDARD=${CXX_STD} "
49+ OS=$( uname)
50+ if [ $OS == " Linux" ]; then
51+ DISTRO=$( lsb_release -i -s)
52+ else
53+ DISTRO=" Darwin"
54+ fi
55+ if [ " $DISTRO " == " Ubuntu" ]; then
56+ BOOST_LIBDIR=
57+ YAML_LIBDIR=
58+ else
59+ BOOST_LIBDIR=--libdir=${SCC_INSTALL} /lib64
60+ YAML_LIBDIR=-DLIB_SUFFIX=64
61+ fi
62+ # we need to keep CMAKE_POLICY_VERSION_MINIMUM=3.5 unless yaml-cpp, SystemC & SystemC-AMS have fixed their build system
63+ CMAKE_COMMON_SETTINGS=" -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_STANDARD=${CXX_STD} -DCMAKE_POLICY_VERSION_MINIMUM=3.5"
2364BOOST_SETTINGS=" link=static cxxflags='-std=c++${CXX_STD} '"
65+ set -eup -o pipefail
66+ # ###########################################################################################
67+ #
68+ # ###########################################################################################
69+ if [ ${CLEAN} -eq 1 ]; then
70+ echo Removing fmt fmt_* .tar.gz spdlog spdlog_* .tar.gz yaml-cpp yaml-cpp_* .tar.gz scc.tar.gz
71+ rm -rf build ${INSTALL_ROOT} fmt fmt_* .tar.gz spdlog spdlog_* .tar.gz yaml-cpp yaml-cpp_* .tar.gz scc.tar.gz
72+ fi
2473# ###########################################################################################
2574#
2675# ###########################################################################################
2776function build_boost {
2877 export BOOST_LIB_EXCLUDE=contract,fiber,graph,graph_parallel,iostreams,json,locale,log,math,mpi,nowide,python,random,stacktrace,test,timer,wave
2978
30- if [ ! -d boost_1_85_0 ]; then
31- [ -f boost_1_85_0 .tar.bz2 ] || wget https://archives.boost.io/release/1.85 .0/source/boost_1_85_0 .tar.bz2
32- tar xjf boost_1_85_0 .tar.bz2
79+ if [ ! -d boost_1_89_0 ]; then
80+ [ -f boost_1_89_0 .tar.bz2 ] || wget https://archives.boost.io/release/1.89 .0/source/boost_1_89_0 .tar.bz2
81+ tar xjf boost_1_89_0 .tar.bz2
3382 fi
34- (cd boost_1_85_0 ; \
83+ (cd boost_1_89_0 ; \
3584 ./bootstrap.sh --prefix=${SCC_INSTALL} ${BOOST_LIBDIR} --without-libraries=${BOOST_LIB_EXCLUDE} ; \
3685 ./b2 ${BOOST_SETTINGS} install) || exit 2
3786}
@@ -40,26 +89,26 @@ function build_boost {
4089# ###########################################################################################
4190function build_fmt {
4291 if [ ! -d fmt ]; then
43- if [ ! -f fmt_8 .0.1 .tar.gz ]; then
44- git clone --depth 1 --branch 8 .0.1 -c advice.detachedHead=false https://github.com/fmtlib/fmt.git
45- tar czf fmt_8 .0.1 .tar.gz fmt --exclude=.git
92+ if [ ! -f fmt_12 .0.0 .tar.gz ]; then
93+ git clone --depth 1 --branch 12 .0.0 -c advice.detachedHead=false https://github.com/fmtlib/fmt.git
94+ tar czf fmt_12 .0.0 .tar.gz --exclude=.git fmt
4695 else
47- tar xzf fmt_8 .0.1 .tar.gz
96+ tar xzf fmt_12 .0.0 .tar.gz
4897 fi
4998 fi
50- cmake -S fmt -B build/fmt ${CMAKE_COMMON_SETTINGS} -DCMAKE_INSTALL_PREFIX=${SCC_INSTALL} || exit 1
99+ cmake -S fmt -B build/fmt ${CMAKE_COMMON_SETTINGS} -DCMAKE_INSTALL_PREFIX=${SCC_INSTALL} -DFMT_TEST=OFF || exit 1
51100 cmake --build build/fmt -j 10 --target install || exit 2
52101}
53102# ###########################################################################################
54103#
55104# ###########################################################################################
56105function build_spdlog {
57106 if [ ! -d spdlog ]; then
58- if [ ! -f spdlog_1.9.2 .tar.gz ]; then
59- git clone --depth 1 --branch v1.9.2 -c advice.detachedHead=false https://github.com/gabime/spdlog.git
60- tar czf spdlog_1.9.2 .tar.gz spdlog --exclude=.git
107+ if [ ! -f spdlog_1.16.0 .tar.gz ]; then
108+ git clone --depth 1 --branch v1.16.0 -c advice.detachedHead=false https://github.com/gabime/spdlog.git
109+ tar czf spdlog_1.16.0 .tar.gz --exclude=.git spdlog
61110 else
62- tar xzf spdlog_1.9.2 .tar.gz
111+ tar xzf spdlog_1.16.0 .tar.gz
63112 fi
64113 fi
65114 cmake -S spdlog -B build/spdlog ${CMAKE_COMMON_SETTINGS} -DCMAKE_INSTALL_PREFIX=${SCC_INSTALL} || exit 1
@@ -70,11 +119,11 @@ function build_spdlog {
70119# ###########################################################################################
71120function build_yamlcpp {
72121 if [ ! -d yaml-cpp ]; then
73- if [ ! -f yaml-cpp_0.6.3 .tar.gz ]; then
74- git clone --depth 1 --branch yaml-cpp-0.6.3 -c advice.detachedHead=false https://github.com/jbeder/yaml-cpp.git
75- tar czf yaml-cpp_0.6.3 .tar.gz yaml-cpp -- exclude=.git
122+ if [ ! -f yaml-cpp_0.8.0 .tar.gz ]; then
123+ git clone --depth 1 --branch 0.8.0 -c advice.detachedHead=false https://github.com/jbeder/yaml-cpp.git
124+ tar czf yaml-cpp_0.8.0 .tar.gz -- exclude=.git yaml-cpp
76125 else
77- tar xzf yaml-cpp_0.6.3 .tar.gz
126+ tar xzf yaml-cpp_0.8.0 .tar.gz
78127 fi
79128 fi
80129 cmake -S yaml-cpp -B build/yaml-cpp ${CMAKE_COMMON_SETTINGS} -DCMAKE_INSTALL_PREFIX=${SCC_INSTALL} \
@@ -87,11 +136,11 @@ function build_yamlcpp {
87136# ###########################################################################################
88137function build_lz4 {
89138 if [ ! -d lz4 ]; then
90- if [ ! -f lz4_1.9.4 .tar.gz ]; then
91- git clone --depth 1 --branch v1.9.4 -c advice.detachedHead=false https://github.com/lz4/lz4.git
92- tar czf lz4_1.9.4 .tar.gz lz4 --exclude=.git
139+ if [ ! -f lz4_1.10.0 .tar.gz ]; then
140+ git clone --depth 1 --branch v1.10.0 -c advice.detachedHead=false https://github.com/lz4/lz4.git
141+ tar czf lz4_1.10.0 .tar.gz --exclude=.git lz4
93142 else
94- tar xzf lz4_1.9.4 .tar.gz
143+ tar xzf lz4_1.10.0 .tar.gz
95144 fi
96145 fi
97146 make -C lz4 clean all || exit 1
@@ -144,7 +193,7 @@ function build_scc {
144193 (cd scc; git pull; git submodule update --recursive)
145194 tar czf scc.tar.gz --exclude=.git scc
146195 fi
147- cmake -S scc -B build/scc -Wno-dev ${CMAKE_COMMON_SETTINGS} -DCMAKE_INSTALL_PREFIX=${SCC_INSTALL} -DENABLE_CONAN=OFF \
196+ cmake -S scc -B build/scc -Wno-dev ${CMAKE_COMMON_SETTINGS} -DCMAKE_INSTALL_PREFIX=${SCC_INSTALL} \
148197 -DBoost_NO_SYSTEM_PATHS=TRUE -DBOOST_ROOT=${SCC_INSTALL} -DBoost_NO_WARN_NEW_VERSIONS=ON -DBUILD_SCC_LIB_ONLY=ON || exit 1
149198 cmake --build build/scc -j 10 --target install || exit 2
150199}
0 commit comments