2020-11-13 14:46:27 +00:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
|
2021-02-10 19:06:27 +00:00
|
|
|
find_program(CC_GCC clang)
|
|
|
|
find_program(CXX_GCC clang++)
|
2020-11-17 01:07:50 +00:00
|
|
|
|
|
|
|
set(CMAKE_C_COMPILER ${CC_GCC})
|
|
|
|
set(CMAKE_CXX_COMPILER ${CXX_GCC})
|
|
|
|
|
2020-11-13 14:46:27 +00:00
|
|
|
project(khat)
|
|
|
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
|
|
|
|
find_package(dpdk REQUIRED)
|
2021-02-10 19:06:27 +00:00
|
|
|
find_package(Hwloc REQUIRED)
|
2020-11-13 14:46:27 +00:00
|
|
|
|
2020-11-18 01:01:55 +00:00
|
|
|
set(CC_FLAGS -O2 -g -Wall -Wextra -Werror -std=c++11
|
|
|
|
-Wno-deprecated-declarations
|
|
|
|
-Wno-address-of-packed-member
|
2021-02-10 19:06:27 +00:00
|
|
|
-Wno-zero-length-array
|
|
|
|
-Wno-gnu-zero-variadic-macro-arguments
|
|
|
|
-msse4
|
|
|
|
-mavx)
|
|
|
|
|
2020-11-13 14:46:27 +00:00
|
|
|
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/inc)
|
|
|
|
include_directories(${dpdk_INCLUDE_DIRS})
|
2021-02-10 19:06:27 +00:00
|
|
|
include_directories(${Hwloc_INCLUDE_DIRS})
|
2020-11-13 14:46:27 +00:00
|
|
|
|
2021-02-16 10:14:43 +00:00
|
|
|
set(LIBNM_CC_FLAGS -O2 -g -Wall -Wextra -Werror -std=c++11 -mavx -msse4)
|
2021-02-10 19:06:27 +00:00
|
|
|
set(LIBNTR_C_FLAGS -O2 -g -Wall -Wextra -Werror -std=c11)
|
|
|
|
set(LIBGEN_CC_FLAGS -O2 -g -Wall -Wextra -Werror -std=c++11)
|
|
|
|
|
2021-03-04 03:22:06 +00:00
|
|
|
set(KHAT_LINKLIBS pthread nm ntr ${dpdk_LIBRARIES})
|
|
|
|
set(CAT_LINKLIBS pthread nm ntr gen ${dpdk_LIBRARIES})
|
|
|
|
set(RAT_LINKLIBS pthread nm ntr gen ${dpdk_LIBRARIES})
|
2022-02-21 13:41:40 +00:00
|
|
|
set(MEMLOAD_LINKLIBS pthread nm ntr)
|
2020-11-13 14:46:27 +00:00
|
|
|
|
2021-02-10 19:06:27 +00:00
|
|
|
add_library(ntr libntr/ntr.c)
|
|
|
|
target_compile_options(ntr PRIVATE ${LIBNTR_C_FLAGS})
|
|
|
|
|
|
|
|
add_library(gen libgen/generator.cc)
|
|
|
|
target_compile_options(gen PRIVATE ${LIBGEN_CC_FLAGS})
|
|
|
|
|
2021-03-04 03:22:06 +00:00
|
|
|
add_library(nm libnm/nm.cc libnm/alloc.cc libnm/loadgen.cc libnm/topo.cc)
|
|
|
|
target_link_libraries(nm gen ${Hwloc_LIBRARIES})
|
|
|
|
target_compile_options(nm PRIVATE ${LIBNM_CC_FLAGS})
|
|
|
|
|
|
|
|
add_executable(khat net/khat.cc)
|
|
|
|
target_link_libraries(khat ${KHAT_LINKLIBS})
|
2020-11-13 14:46:27 +00:00
|
|
|
target_compile_options(khat PRIVATE ${CC_FLAGS})
|
2021-02-10 19:06:27 +00:00
|
|
|
target_link_options(khat PRIVATE -L /usr/local/lib)
|
2020-11-13 14:46:27 +00:00
|
|
|
|
2021-03-04 03:22:06 +00:00
|
|
|
add_executable(cat net/cat.cc)
|
|
|
|
target_link_libraries(cat ${CAT_LINKLIBS})
|
2020-11-13 14:46:27 +00:00
|
|
|
target_compile_options(cat PRIVATE ${CC_FLAGS})
|
2021-02-10 19:06:27 +00:00
|
|
|
target_link_options(cat PRIVATE -L /usr/local/lib)
|
2020-11-13 14:46:27 +00:00
|
|
|
|
2021-03-04 03:22:06 +00:00
|
|
|
add_executable(rat net/rat.cc)
|
|
|
|
target_link_libraries(rat ${RAT_LINKLIBS})
|
2021-02-10 19:06:27 +00:00
|
|
|
target_compile_options(rat PRIVATE ${CC_FLAGS})
|
2022-02-21 13:41:40 +00:00
|
|
|
target_link_options(rat PRIVATE -L /usr/local/lib)
|
|
|
|
|
|
|
|
add_executable(memloadgen util/memloadgen.cc)
|
|
|
|
target_link_libraries(memloadgen ${MEMLOAD_LINKLIBS})
|
|
|
|
target_compile_options(memloadgen PRIVATE ${CC_FLAGS})
|
|
|
|
target_link_options(memloadgen PRIVATE -L /usr/local/lib)
|