Minor improvements on package handling

This commit is contained in:
2024-11-19 10:03:44 +01:00
parent c3eb5e6a62
commit e2342350d0
6 changed files with 55 additions and 25 deletions

View File

@@ -64,7 +64,6 @@ option(DRAMSYS_BUILD_TESTS "Build DRAMSys unit tests" OFF)
option(DRAMSYS_BUILD_BENCHMARKS "Build DRAMSys benchmarks" OFF)
option(DRAMSYS_BUILD_CLI "Build DRAMSys Command Line Tool" ${PROJECT_IS_TOP_LEVEL})
option(DRAMSYS_BUILD_TRACE_ANALYZER "Build DRAMSys Trace Analyzer" OFF)
option(DRAMSYS_WITH_DRAMPOWER "Build with DRAMPower support enabled." OFF)
# Use sane defaults for FetchContent:
# In case we are the top-level project, get everything by default
@@ -125,11 +124,12 @@ if (DRAMSYS_USE_FETCH_CONTENT)
set_target_properties(systemc PROPERTIES SYSTEM TRUE)
endif()
if (DRAMSYS_WITH_DRAMPOWER AND DRAMSYS_USE_FETCH_CONTENT_INTERNAL)
if (DRAMSYS_USE_FETCH_CONTENT_INTERNAL)
FetchContent_Declare(
DRAMPower
GIT_REPOSITORY https://github.com/tukl-msd/DRAMPower
GIT_TAG 9e64a1b
OVERRIDE_FIND_PACKAGE
)
FetchContent_MakeAvailable(DRAMPower)
@@ -140,6 +140,14 @@ find_package(SystemCLanguage REQUIRED)
find_package(SQLite3 REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(DRAMPower)
if (DRAMPower_FOUND)
message(STATUS "Building with DRAMPower")
else()
message(STATUS "Building without DRAMPower")
endif()
###############################################
### Source Directory ###
###############################################

View File

@@ -22,8 +22,8 @@
"inherits": "cmake-pedantic",
"cacheVariables": {
"DRAMSYS_BUILD_TESTS": "ON",
"DRAMSYS_BUILD_TRACE_ANALYZER": "ON",
"DRAMSYS_WITH_DRAMPOWER": "ON"
"DRAMSYS_BUILD_BENCHMARKS": "ON",
"DRAMSYS_BUILD_TRACE_ANALYZER": "ON"
}
},
{
@@ -70,6 +70,19 @@
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -fdiagnostics-color=always"
}
},
{
"name": "dev-local",
"binaryDir": "${sourceDir}/build",
"inherits": [
"dev-mode",
"std"
],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -fdiagnostics-color=always",
"DRAMSYS_USE_FETCH_CONTENT": "OFF"
}
}
]
}

2
NOTICE
View File

@@ -22,7 +22,7 @@ This software uses the following third-party libraries:
License: Qwt License (based on LGPL-2.1)
License URL: https://qwt.sourceforge.io/qwtlicense.html
6. Google Test v1.12.1
6. Google Test v1.15.2
License: BSD-3-Clause
License URL: https://github.com/google/googletest/blob/main/LICENSE

View File

@@ -35,14 +35,23 @@
### benches_dramsys ###
###############################################
option(DRAMSYS_USE_FETCH_CONTENT_GOOGLE_BENCHMARK "Enable FetchContent to provide Google Benchmark" ${DRAMSYS_USE_FETCH_CONTENT})
if (DRAMSYS_USE_FETCH_CONTENT)
if (DRAMSYS_USE_FETCH_CONTENT_GOOGLE_BENCHMARK)
set(BENCHMARK_ENABLE_TESTING OFF)
FetchContent_Declare(
benchmark
URL https://github.com/google/benchmark/archive/refs/tags/v1.8.3.zip
OVERRIDE_FIND_PACKAGE
)
FetchContent_MakeAvailable(benchmark)
endif()
endif()
find_package(benchmark REQUIRED)
add_executable(benches_dramsys
main.cpp
@@ -51,11 +60,10 @@ add_executable(benches_dramsys
)
target_include_directories(benches_dramsys PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(benches_dramsys PROPERTIES FOLDER benches)
target_link_libraries(benches_dramsys
DRAMSys::util
DRAMSys::libdramsys
DRAMSys::simulator
SystemC::systemc
benchmark
benchmark::benchmark
)

View File

@@ -96,18 +96,20 @@ add_library(libdramsys
target_include_directories(libdramsys PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_features(libdramsys PUBLIC cxx_std_17)
target_compile_definitions(libdramsys
PUBLIC
$<$<BOOL:${DRAMPower_FOUND}>:DRAMPOWER>
)
target_link_libraries(libdramsys
PUBLIC
SystemC::systemc
DRAMSys::config
SQLite::SQLite3
$<$<TARGET_EXISTS:DRAMPower>:DRAMPower>
)
target_compile_features(libdramsys PUBLIC cxx_std_17)
if (DRAMSYS_WITH_DRAMPOWER)
target_link_libraries(libdramsys PUBLIC DRAMPower)
target_compile_definitions(libdramsys PUBLIC DRAMPOWER)
endif ()
add_library(DRAMSys::libdramsys ALIAS libdramsys)

View File

@@ -2,14 +2,13 @@ include(GoogleTest)
set(DRAMSYS_TEST_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resources")
option(DRAMSYS_USE_FETCH_CONTENT_GTEST "Enable FetchContent to provide gtest" ${DRAMSYS_USE_FETCH_CONTENT})
option(DRAMSYS_USE_FETCH_CONTENT_GOOGLE_TEST "Enable FetchContent to provide Google Test" ${DRAMSYS_USE_FETCH_CONTENT})
if (DRAMSYS_USE_FETCH_CONTENT)
if (DRAMSYS_USE_FETCH_CONTENT_GTEST)
if (DRAMSYS_USE_FETCH_CONTENT_GOOGLE_TEST)
FetchContent_Declare(
GTest
GIT_REPOSITORY https://github.com/google/googletest
GIT_TAG release-1.12.1
URL https://github.com/google/googletest/releases/download/v1.15.2/googletest-1.15.2.tar.gz
OVERRIDE_FIND_PACKAGE
)