Merge branch 'legacy_systemc' into 'develop'
build: re-add support for legacy SystemC installations See merge request ems/astdm/modeling.dram/dram.sys.5!145
This commit is contained in:
@@ -67,6 +67,7 @@ option(DRAMSYS_BUILD_BENCHMARKS "Build DRAMSys benchmarks" OFF)
|
||||
option(DRAMSYS_BUILD_CLI "Build DRAMSys Command Line Tool" ${PROJECT_IS_TOP_LEVEL})
|
||||
option(DRAMSYS_BUILD_TOOLS "Build DRAMSys Tools" OFF)
|
||||
option(DRAMSYS_BUILD_TRACE_ANALYZER "Build DRAMSys Trace Analyzer" OFF)
|
||||
option(DRAMSYS_USE_LEGACY_SYSTEMC_INSTALLATION "Use SystemC installed with autotools (set SYSTEMC_HOME)" OFF)
|
||||
|
||||
# Use sane defaults for FetchContent:
|
||||
# In case we are the top-level project, get everything by default
|
||||
@@ -144,7 +145,17 @@ if (DRAMSYS_USE_FETCH_CONTENT)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(SystemCLanguage REQUIRED)
|
||||
# Special handling of SystemC:
|
||||
# Normally, we require the user to have SystemC installed by CMake
|
||||
# However, there are some cases where SystemC is still installed by autotools
|
||||
# In this case, try to find SystemC using FindSystemC and SYSTEMC_HOME
|
||||
if (DRAMSYS_USE_LEGACY_SYSTEMC_INSTALLATION)
|
||||
message(STATUS "Using legacy SystemC installed with autotools")
|
||||
find_package(SystemC MODULE REQUIRED)
|
||||
else()
|
||||
find_package(SystemCLanguage REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(SQLite3 REQUIRED)
|
||||
find_package(DRAMUtils REQUIRED)
|
||||
find_package(DRAMPower REQUIRED)
|
||||
|
||||
46
cmake/FindSystemC.cmake
Normal file
46
cmake/FindSystemC.cmake
Normal file
@@ -0,0 +1,46 @@
|
||||
# User must provide SYSTEMC_HOME
|
||||
# Defines:
|
||||
# SystemC_FOUND
|
||||
# SystemC_INCLUDE_DIRS
|
||||
# SystemC_LIBRARIES
|
||||
# SystemC_VERSION (optional)
|
||||
# SystemC::systemc (imported target)
|
||||
|
||||
if (NOT DEFINED SYSTEMC_HOME)
|
||||
message(FATAL_ERROR "SYSTEMC_HOME is not defined. Please set it to your SystemC installation directory.")
|
||||
endif()
|
||||
|
||||
find_library(SystemC_LIBRARY
|
||||
NAMES systemc systemc-ar
|
||||
HINTS ${SYSTEMC_HOME}
|
||||
PATH_SUFFIXES
|
||||
lib
|
||||
lib64
|
||||
lib-linux
|
||||
lib-linux64
|
||||
lib-macos
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
if (NOT SystemC_LIBRARY)
|
||||
message(FATAL_ERROR "SystemC library not found in ${SYSTEMC_HOME}")
|
||||
endif()
|
||||
|
||||
set(SystemC_VERSION "")
|
||||
set(SystemC_INCLUDE_DIR "${SYSTEMC_HOME}/include")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(SystemC
|
||||
REQUIRED_VARS SystemC_LIBRARY SystemC_INCLUDE_DIR
|
||||
VERSION_VAR SystemC_VERSION
|
||||
)
|
||||
|
||||
mark_as_advanced(SystemC_INCLUDE_DIR SystemC_LIBRARY)
|
||||
|
||||
if (SystemC_FOUND)
|
||||
add_library(SystemC::systemc UNKNOWN IMPORTED)
|
||||
set_target_properties(SystemC::systemc PROPERTIES
|
||||
IMPORTED_LOCATION "${SystemC_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SystemC_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
Reference in New Issue
Block a user