Recent breaking changes in the DRAMSys API require user code to be updated. These updates have been applied to the gem5 integration. Furthermore, as DRAMSys started to use CMake dependency management, it is no longer sensible to maintain two separate build systems for DRAMSys. The use of the DRAMSys integration in gem5 will therefore from now on require that CMake is installed on the target machine. Additionally, support for snapshots have been implemented into DRAMSys and coupled with gem5's checkpointing API.
79 lines
2.9 KiB
Python
79 lines
2.9 KiB
Python
# Copyright (c) 2022 Fraunhofer IESE
|
|
# All rights reserved
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions are
|
|
# met: redistributions of source code must retain the above copyright
|
|
# notice, this list of conditions and the following disclaimer;
|
|
# redistributions in binary form must reproduce the above copyright
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
# documentation and/or other materials provided with the distribution;
|
|
# neither the name of the copyright holders nor the names of its
|
|
# contributors may be used to endorse or promote products derived from
|
|
# this software without specific prior written permission.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
import os
|
|
import subprocess
|
|
|
|
Import("env")
|
|
|
|
build_root = Dir("../..").abspath
|
|
build_current = Dir(".").abspath
|
|
src_root = Dir(".").srcnode().abspath
|
|
scons_root = Dir("#").abspath
|
|
|
|
# See if we got a cloned DRAMSys repo as a subdirectory and set the
|
|
# HAVE_DRAMSys flag accordingly
|
|
if not os.path.exists(Dir(".").srcnode().abspath + "/DRAMSys"):
|
|
env["HAVE_DRAMSYS"] = False
|
|
Return()
|
|
|
|
env["HAVE_DRAMSYS"] = True
|
|
|
|
subprocess.run(
|
|
[
|
|
"cmake",
|
|
f"-S{src_root}",
|
|
f"-B{build_current}",
|
|
"-DCMAKE_BUILD_TYPE=Release",
|
|
f"-DSCONS_SOURCE_DIR:STRING={scons_root}",
|
|
"-DDRAMSYS_BUILD_CLI=OFF"
|
|
],
|
|
check=True
|
|
)
|
|
|
|
subprocess.run(
|
|
["cmake", "--build", build_current],
|
|
check=True
|
|
)
|
|
|
|
env.Append(LIBS="DRAMSys_libdramsys")
|
|
env.Append(LIBPATH=Dir("./DRAMSys/src/libdramsys").abspath)
|
|
|
|
env.Append(LIBS="DRAMSys_Configuration")
|
|
env.Append(LIBPATH=Dir("./DRAMSys/src/configuration").abspath)
|
|
|
|
env.Append(LIBS="sqlite3")
|
|
env.Append(LIBPATH=Dir("./DRAMSys/lib/sqlite3").abspath)
|
|
|
|
env.Append(CPPPATH=src_root + "/DRAMSys/src/libdramsys")
|
|
env.Append(CPPPATH=src_root + "/DRAMSys/src/configuration")
|
|
env.Append(CPPPATH=src_root + "/DRAMSys/src/util")
|
|
env.Append(CPPPATH=src_root + "/DRAMSys/lib/nlohmann_json/include")
|
|
|
|
env.Prepend(CPPDEFINES=[("SYSTEMC_VERSION", 20191203)])
|
|
env.Prepend(CPPDEFINES=[("DRAMSYS_RESOURCE_DIR",
|
|
'\\"' + os.getcwd() + '/DRAMSys/configs' + '\\"')])
|