-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
109 lines (100 loc) · 4.75 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
cmake_minimum_required(VERSION 3.15.0)
if(PERFORMANCE_BUILD STREQUAL "1" OR ACCELSIM_BUILD STREQUAL "1")
set(PROJECT_NAME "NDPSim")
else()
set(PROJECT_NAME "FuncSim")
endif()
project(${PROJECT_NAME})
set(CONAN_DISABLE_CHECK_COMPILER ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Wall -O1")
if(DEFINED MEM_ACCESS_SIZE)
add_definitions(-DMEM_ACCESS_SIZE=${MEM_ACCESS_SIZE})
message("Setting memory access size to ${MEM_ACCESS_SIZE}")
endif()
file(GLOB_RECURSE SRC_FILES
"${CMAKE_SOURCE_DIR}/src/*.h"
"${CMAKE_SOURCE_DIR}/src/*.cc"
)
# conan setup
execute_process(COMMAND "conan" "install" "${CMAKE_SOURCE_DIR}" "--install-folder" "${CMAKE_SOURCE_DIR}/build")
include("${CMAKE_SOURCE_DIR}/build/conanbuildinfo.cmake")
conan_basic_setup()
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/build/bin")
set(LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/build/lib")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-register -Wno-deprecated-declarations -ggdb")
if(PERFORMANCE_BUILD STREQUAL "1" OR ACCELSIM_BUILD STREQUAL "1")
message("Building performance model")
find_package(FLEX)
find_package(BISON)
set(LEXER_OUT "${CMAKE_SOURCE_DIR}/extern/intersim2/lex.yy.c")
set(PARSER_OUT "${CMAKE_SOURCE_DIR}/extern/intersim2/y.tab.c")
BISON_TARGET(PARSER "${CMAKE_SOURCE_DIR}/extern/intersim2/config.y" "${PARSER_OUT}" DEFINES_FILE "${CMAKE_SOURCE_DIR}/extern/intersim2/y.tab.h")
FLEX_TARGET(LEXER "${CMAKE_SOURCE_DIR}/extern/intersim2/config.l" "${LEXER_OUT}")
ADD_FLEX_BISON_DEPENDENCY(LEXER PARSER)
file(GLOB EXTERN_FILES
"${CMAKE_SOURCE_DIR}/extern/ramulator/*.h"
"${CMAKE_SOURCE_DIR}/extern/ramulator/*.cc"
"${CMAKE_SOURCE_DIR}/extern/intersim2/*.h"
"${CMAKE_SOURCE_DIR}/extern/intersim2/*.cc"
"${CMAKE_SOURCE_DIR}/extern/intersim2/*.hpp"
"${CMAKE_SOURCE_DIR}/extern/intersim2/*.cpp"
"${CMAKE_SOURCE_DIR}/extern/intersim2/networks/*.cpp"
"${CMAKE_SOURCE_DIR}/extern/intersim2/allocators/*.cpp"
"${CMAKE_SOURCE_DIR}/extern/intersim2/arbiters/*.cpp"
"${CMAKE_SOURCE_DIR}/extern/intersim2/examples/*.cpp"
"${CMAKE_SOURCE_DIR}/extern/intersim2/power/*.cpp"
"${CMAKE_SOURCE_DIR}/extern/intersim2/routers/*.cpp")
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories("${CMAKE_SOURCE_DIR}/src")
include_directories("${CMAKE_SOURCE_DIR}/extern/ramulator")
include_directories("${CMAKE_SOURCE_DIR}/extern/intersim2")
include_directories("${CMAKE_SOURCE_DIR}/extern/intersim2/networks")
include_directories("${CMAKE_SOURCE_DIR}/extern/intersim2/allocators")
include_directories("${CMAKE_SOURCE_DIR}/extern/intersim2/arbiters")
include_directories("${CMAKE_SOURCE_DIR}/extern/intersim2/examples")
include_directories("${CMAKE_SOURCE_DIR}/extern/intersim2/power")
include_directories("${CMAKE_SOURCE_DIR}/extern/intersim2/routers")
add_compile_definitions(TIMING_SIMULATION)
if(ACCELSIM_BUILD STREQUAL "1")
include_directories("${CMAKE_SOURCE_DIR}/include")
message("Building accelsim model")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DACCELSIM_BUILD -DTIMING_SIMULATION")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMEM_ACCESS_SIZE=32")
else()
set(CMAKE_CXX_STANDARD 17)
message("Building perf_runner model")
endif()
add_library(${PROJECT_NAME}_lib SHARED ${SRC_FILES} ${LEXER_OUT} ${PARSER_OUT} ${EXTERN_FILES}
"${CMAKE_SOURCE_DIR}/include/m2ndp_module.h")
target_link_libraries(${PROJECT_NAME}_lib ${FL_LIBRARIES})
target_link_libraries(${PROJECT_NAME}_lib ${CONAN_LIBS})
include_directories("${CMAKE_SOURCE_DIR}/perf_runner")
if(KVRUN STREQUAL "1")
add_compile_definitions(KVRUN)
message("Building KV RUN")
add_executable(${PROJECT_NAME} "${CMAKE_SOURCE_DIR}/perf_runner/kv_runner.cc"
"${CMAKE_SOURCE_DIR}/perf_runner/kv_runner.h"
"${CMAKE_SOURCE_DIR}/perf_runner/main.cc")
elseif(SCALABILITY STREQUAL "1")
add_compile_definitions(SCALABILITY)
message("Building Scalability")
add_executable(${PROJECT_NAME} "${CMAKE_SOURCE_DIR}/perf_runner/scalability_runner.cc"
"${CMAKE_SOURCE_DIR}/perf_runner/scalability_runner.h"
"${CMAKE_SOURCE_DIR}/perf_runner/main.cc")
else()
add_executable(${PROJECT_NAME} "${CMAKE_SOURCE_DIR}/perf_runner/simulation_runner.h"
"${CMAKE_SOURCE_DIR}/perf_runner/simulation_runner.cc"
"${CMAKE_SOURCE_DIR}/perf_runner/main.cc")
endif()
target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}_lib)
# enable_testing()
# add_subdirectory(test)
else()
message("Building functional model")
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/build/bin")
include_directories("${CMAKE_SOURCE_DIR}/src")
add_executable(${PROJECT_NAME} ${SRC_FILES} "${CMAKE_SOURCE_DIR}/functional_runner/main.cc")
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
endif()