Encapsulated gem5-specific code into wrapper functions to separate the build process (Fail: CMake, gem5: scons). Added some gem5-related FIXMEs. Another CMake related FIXME added. +some cosmetics. Change-Id: Id84b480127b1f13aed6a0ee97f3583f410d531c5
40 lines
1.4 KiB
CMake
40 lines
1.4 KiB
CMake
#### gem5-specific stuff
|
|
if(BUILD_GEM5)
|
|
message(STATUS "[${PROJECT_NAME}] Building gem5 variant ...")
|
|
SET(VARIANT gem5)
|
|
|
|
set(gem5_src_dir ${PROJECT_SOURCE_DIR}/simulators/gem5)
|
|
set(gem5_wrapper ${PROJECT_SOURCE_DIR}/src/core/sal/gem5)
|
|
set(gem5_build_config build/ARM/gem5.debug)
|
|
set(core_count 9)
|
|
|
|
# FIXMEs:
|
|
# - incremental builds working?
|
|
# - dependency for modified .cc files not correctly checked
|
|
# - core_count should be derived from the parent make -jX parameter
|
|
# - make gem5_build_config configurable in CMake
|
|
# (alternative: gem5_build_config is set based on the CMake build
|
|
# config, e.g., "Debug" or "Release")
|
|
|
|
# Enable ExternalProject CMake module
|
|
include(ExternalProject)
|
|
|
|
# Use cmake's external project feature to build gem5 (and link FailGem5)
|
|
ExternalProject_Add(
|
|
FailGem5_binary_external # the (unique) name of this custom target (= external project)
|
|
# Disable update, patch and configure step:
|
|
UPDATE_COMMAND ""
|
|
PATCH_COMMAND ""
|
|
CONFIGURE_COMMAND ""
|
|
SOURCE_DIR ${gem5_src_dir}
|
|
BINARY_DIR ${gem5_src_dir}
|
|
# Build gem5 using scons build system:
|
|
BUILD_COMMAND scons EXTRAS=${gem5_wrapper} ${gem5_build_config} -j${core_count}
|
|
# Disable install step (for now)
|
|
INSTALL_COMMAND ""
|
|
)
|
|
|
|
# Build "fail" library first (will be statically linked to gem5)
|
|
add_dependencies(FailGem5_binary_external fail)
|
|
endif(BUILD_GEM5)
|