Refactor CMakeLists and GitLab CI/CD pipeline

- Remove nested minimum required to supress warnings.
- Declare SystemC as system library to supress warnings in headers.
- Add a BUILD_SHARED_LIBS option
- Remove hardcoded STATIC in various add_library calls to honor the
  BUILD_SHARED_LIBS option
- Remove _deps/ directory from the build directory in GitLab pipeline
- Remove *.tdb files after test stage in pipeline
- Set Ninja as the default generator for the dev preset and re-enable
  colored diagnostics
This commit is contained in:
2024-06-28 09:04:34 +02:00
parent 3159cf038b
commit 5dd7c22a74
13 changed files with 17 additions and 21 deletions

View File

@@ -14,6 +14,7 @@ build:
after_script:
- find . -name "*.o" -type f -delete
- find . -name "*.a" -type f -delete
- rm -r build/coverage/_deps
artifacts:
paths:
- build/coverage
@@ -26,6 +27,8 @@ test:
script:
- cd build/coverage
- ctest --output-on-failure -j$(nproc)
after_script:
- find . -name "*.tdb" -type f -delete
artifacts:
paths:
- build/coverage

View File

@@ -89,6 +89,8 @@ set(DRAMSYS_RESOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/configs")
set(DRAMSYS_EXTENSIONS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extensions")
### Build options ###
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
option(DRAMSYS_BUILD_TESTS "Build DRAMSys unit tests" OFF)
option(DRAMSYS_BUILD_BENCHMARKS "Build DRAMSys benchmarks" OFF)
option(DRAMSYS_VERBOSE_CMAKE_OUTPUT "Show detailed CMake output" OFF)
@@ -156,6 +158,9 @@ if (NOT TARGET SystemC::systemc)
FetchContent_MakeAvailable(systemc)
endif()
# Set include directories to SYSTEM to suppress warnings
set_target_properties(systemc PROPERTIES SYSTEM TRUE)
### DRAMPower ###
if (DRAMSYS_WITH_DRAMPOWER)
FetchContent_Declare(

View File

@@ -62,7 +62,7 @@
},
{
"name": "dev",
"generator": "Unix Makefiles",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"inherits": [
"dev-mode",
@@ -70,8 +70,8 @@
],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic"
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -fdiagnostics-color=always"
}
}
]
}
}

View File

@@ -35,8 +35,6 @@
### benches_dramsys ###
###############################################
cmake_minimum_required(VERSION 3.1.0)
project(benches_dramsys)
add_executable(${PROJECT_NAME}

View File

@@ -41,7 +41,7 @@ project(DRAMSys_Configuration)
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS *.cpp)
file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS *.h;*.hpp)
add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES} ${HEADER_FILES})
add_library(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES})
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
@@ -57,4 +57,4 @@ target_compile_definitions(${PROJECT_NAME}
add_library(DRAMSys::config ALIAS ${PROJECT_NAME})
build_source_group()
build_source_group()

View File

@@ -41,7 +41,7 @@ project(DRAMSys_libdramsys)
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS *.cpp)
file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS *.h;*.hpp)
add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES} ${HEADER_FILES})
add_library(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES})
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

View File

@@ -45,7 +45,7 @@ file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS *.h;*.hpp)
list(FILTER SOURCE_FILES EXCLUDE REGEX "main.cpp")
add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES} ${HEADER_FILES})
add_library(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES})
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

View File

@@ -41,7 +41,7 @@ project(DRAMSys_Util)
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS *.cpp)
file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS *.h;*.hpp)
add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES} ${HEADER_FILES})
add_library(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES})
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

View File

@@ -2,8 +2,6 @@
### tests_configuration ###
###############################################
cmake_minimum_required(VERSION 3.1.0)
project(tests_configuration)
add_executable(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/test_configuration.cpp)

View File

@@ -2,8 +2,6 @@
### tests_dramsys ###
###############################################
cmake_minimum_required(VERSION 3.1.0)
project(tests_dramsys)
file(GLOB_RECURSE SOURCE_FILES *.cpp)

View File

@@ -35,8 +35,6 @@
### tests_regression ###
###############################################
cmake_minimum_required(VERSION 3.1.0)
project(tests_regression)
find_program(SqlDiff sqldiff)

View File

@@ -2,8 +2,6 @@
### tests_simulator ###
###############################################
cmake_minimum_required(VERSION 3.1.0)
project(tests_simulator)
add_executable(${PROJECT_NAME}

View File

@@ -2,8 +2,6 @@
### tests_util ###
###############################################
cmake_minimum_required(VERSION 3.1.0)
project(tests_util)
file(GLOB_RECURSE SOURCE_FILES *.cpp)
@@ -20,4 +18,4 @@ target_link_libraries(${PROJECT_NAME}
gtest_discover_tests(${PROJECT_NAME})
build_source_group()
build_source_group()