Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tell cmake to add boost includes for core and mss #36

Closed
wants to merge 8 commits into from
6 changes: 3 additions & 3 deletions .github/actions/build/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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!!!"
Expand All @@ -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
Expand Down
20 changes: 7 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <args> -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=<directory>")
endif()
find_package(Sparta REQUIRED)

################################################################################
# Set up STF library
Expand Down Expand Up @@ -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")
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 1 addition & 2 deletions core/Dispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions mss/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions test/core/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ project(common_test)
add_library(common_test
SourceUnit.cpp
)
target_include_directories(common_test SYSTEM PRIVATE ${Boost_INCLUDE_DIRS})
3 changes: 1 addition & 2 deletions test/core/dispatch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 1 addition & 2 deletions test/sim/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down