diff --git a/.github/actions/build/entrypoint.sh b/.github/actions/build/entrypoint.sh index bbe3c6ad..fbbf6426 100755 --- a/.github/actions/build/entrypoint.sh +++ b/.github/actions/build/entrypoint.sh @@ -21,12 +21,12 @@ mkdir -p release # Link step expects "release" as dir name ln -s release fastdebug ln -s release debug cd release -cmake .. -DCMAKE_BUILD_TYPE=$OLYMPIA_BUILD_TYPE -DGEN_DEBUG_INFO=OFF +cmake .. -DCMAKE_BUILD_TYPE=$OLYMPIA_BUILD_TYPE -DGEN_DEBUG_INFO=OFF -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/sparta_installed if [ $? -ne 0 ]; then echo "ERROR: Cmake for Sparta framework failed" exit 1 fi -make -j2 +make -j2 install BUILD_SPARTA=$? if [ ${BUILD_SPARTA} -ne 0 ]; then echo "ERROR: build sparta FAILED!!!" @@ -36,7 +36,7 @@ fi cd ${GITHUB_WORKSPACE} mkdir $OLYMPIA_BUILD_TYPE cd $OLYMPIA_BUILD_TYPE -cmake .. -DCMAKE_BUILD_TYPE=$OLYMPIA_BUILD_TYPE -DGEN_DEBUG_INFO=OFF -DSPARTA_BASE=${GITHUB_WORKSPACE}/map/sparta +cmake .. -DCMAKE_BUILD_TYPE=$OLYMPIA_BUILD_TYPE -DGEN_DEBUG_INFO=OFF -DSPARTA_SEARCH_DIR=${GITHUB_WORKSPACE}/sparta_installed if [ $? -ne 0 ]; then echo "ERROR: Cmake for olympia failed" exit 1 diff --git a/CMakeLists.txt b/CMakeLists.txt index d733a73b..f697eab7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,10 +11,12 @@ add_compile_options ( -Werror ################################################################################ # Set up Sparta -if (NOT SPARTA_BASE) - message (FATAL_ERROR "Need to define the location of the Sparta: cmake -DSPARTA_BASE=\"/path/to/sparta\"") -endif () -include (${SPARTA_BASE}/cmake/sparta-config.cmake) +if(IS_DIRECTORY ${SPARTA_SEARCH_DIR}) + set(CMAKE_MODULE_PATH "${SPARTA_SEARCH_DIR}/lib/cmake/sparta" ${CMAKE_MODULE_PATH}) +else() + message (STATUS "If needed, please provide the location where sparta is installed: -DSPARTA_SEARCH_DIR=") +endif() +find_package(Sparta REQUIRED) ################################################################################ # Set up STF library @@ -45,12 +47,6 @@ else() message (FATAL_ERROR "Please provide a CMAKE_BUILD_TYPE: -DCMAKE_BUILD_TYPE=Release|Debug|Profile") endif() -# Sparta/STF linking -link_directories ( - ${SPARTA_BASE}/${SPARTA_BUILD_TYPE} - ${SPARTA_BASE}/${SPARTA_BUILD_TYPE}/simdb - ) - # Profile build flags set(CMAKE_CXX_FLAGS_PROFILE "-O3 -pg -g -ftime-trace") set(CMAKE_CXX_FLAGS_FASTDEBUG "-O3 -g") @@ -59,8 +55,6 @@ set(CMAKE_CXX_FLAGS_FASTDEBUG "-O3 -g") include_directories (core mss) include_directories (SYSTEM mavis) include_directories (SYSTEM stf_lib) -include_directories (SYSTEM ${SPARTA_BASE}) -include_directories (SYSTEM ${SPARTA_BASE}/simdb/include) # The Core, MSS, and the simulator add_subdirectory(core) @@ -77,7 +71,7 @@ add_executable(olympia sim/OlympiaSim.cpp sim/main.cpp ) -target_link_libraries (olympia core mss ${Sparta_LIBS} ${STF_LINK_LIBS}) +target_link_libraries (olympia core mss SPARTA::sparta ${STF_LINK_LIBS}) if (CMAKE_BUILD_TYPE MATCHES "^[Rr]elease") target_link_options (olympia PUBLIC -flto) target_compile_options (olympia PUBLIC -flto) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index a32f1752..a7062672 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -20,3 +20,5 @@ add_library(core CPUFactory.cpp CPUTopology.cpp ) +target_include_directories(core SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(core PUBLIC SPARTA::sparta) diff --git a/core/Dispatch.hpp b/core/Dispatch.hpp index 1de48052..4fe4815d 100644 --- a/core/Dispatch.hpp +++ b/core/Dispatch.hpp @@ -14,10 +14,9 @@ #include "sparta/log/MessageSource.hpp" #include "sparta/statistics/Counter.hpp" #include "sparta/statistics/ContextCounter.hpp" +#include "sparta/statistics/WeightedContextCounter.hpp" #include "sparta/simulation/ResourceFactory.hpp" -#include "test/ContextCounter/WeightedContextCounter.hpp" - #include "Dispatcher.hpp" #include "CoreTypes.hpp" #include "InstGroup.hpp" diff --git a/mss/CMakeLists.txt b/mss/CMakeLists.txt index a25aaf60..7eeafc0c 100644 --- a/mss/CMakeLists.txt +++ b/mss/CMakeLists.txt @@ -3,3 +3,5 @@ add_library(mss BIU.cpp MSS.cpp ) +target_include_directories(mss SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(mss PUBLIC SPARTA::sparta) diff --git a/test/core/common/CMakeLists.txt b/test/core/common/CMakeLists.txt index e87ba6cb..353bb6cf 100644 --- a/test/core/common/CMakeLists.txt +++ b/test/core/common/CMakeLists.txt @@ -4,3 +4,4 @@ project(common_test) add_library(common_test SourceUnit.cpp ) +target_include_directories(common_test SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) diff --git a/test/core/dispatch/CMakeLists.txt b/test/core/dispatch/CMakeLists.txt index be1028b5..b5e556bc 100644 --- a/test/core/dispatch/CMakeLists.txt +++ b/test/core/dispatch/CMakeLists.txt @@ -3,14 +3,13 @@ project(Dispatch_test) add_executable(Dispatch_test Dispatch_test.cpp) target_link_libraries(Dispatch_test core common_test ${STF_LINK_LIBS} ${Sparta_LIBS}) -include(${SPARTA_BASE}/test/TestingMacros.cmake) - file(CREATE_LINK ${SIM_BASE}/mavis/json ${CMAKE_CURRENT_BINARY_DIR}/mavis_isa_files SYMBOLIC) file(CREATE_LINK ${SIM_BASE}/arches ${CMAKE_CURRENT_BINARY_DIR}/arches SYMBOLIC) file(CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/test_cores ${CMAKE_CURRENT_BINARY_DIR}/test_cores SYMBOLIC) file(CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/expected_output ${CMAKE_CURRENT_BINARY_DIR}/expected_output SYMBOLIC) # Single add per cycle +# Note: these macros get defined when find_package(Sparta) is called sparta_named_test(Dispatch_test_Run_Small Dispatch_test small_core.out -c test_cores/test_small_core.yaml) sparta_named_test(Dispatch_test_Run_Medium Dispatch_test medium_core.out -c test_cores/test_medium_core.yaml) sparta_named_test(Dispatch_test_Run_Big Dispatch_test big_core.out -c test_cores/test_big_core.yaml) diff --git a/test/sim/CMakeLists.txt b/test/sim/CMakeLists.txt index 6538a28b..80c91d25 100644 --- a/test/sim/CMakeLists.txt +++ b/test/sim/CMakeLists.txt @@ -1,7 +1,6 @@ project(olympia_test) -# Include the handy testing marcros defined in Sparta -include(${SPARTA_BASE}/test/TestingMacros.cmake) +# Note: these sparta_* macros/functions get defined when find_package(Sparta) is called # This line will make sure olympia is built before running the tests sparta_regress (olympia)