numam/CMakeLists.txt

86 lines
3.8 KiB
CMake
Raw Normal View History

2020-11-13 14:46:27 +00:00
cmake_minimum_required(VERSION 3.0)
project(khat)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
2022-03-20 14:17:26 +00:00
find_package(PkgConfig REQUIRED)
2022-06-22 15:40:48 +00:00
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
2022-03-20 14:17:26 +00:00
pkg_check_modules(DPDK libdpdk)
pkg_check_modules(SPDK spdk_event_bdev spdk_env_dpdk)
pkg_check_modules(SPDK_SYS spdk_syslibs)
pkg_check_modules(UUID uuid)
2022-06-22 15:40:48 +00:00
pkg_check_modules(TOPO bsdtopo)
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
-Wno-zero-length-array
-Wno-gnu-zero-variadic-macro-arguments
2022-06-22 15:40:48 +00:00
-march=native)
2023-05-01 19:18:34 +00:00
set(C_FLAGS -O2 -g -Wall -Wextra -Werror -std=c2x
2022-06-22 15:40:48 +00:00
-Wno-deprecated-declarations
-Wno-address-of-packed-member
-Wno-zero-length-array
-Wno-gnu-zero-variadic-macro-arguments
-march=native)
2020-11-13 14:46:27 +00:00
include_directories(${CMAKE_SOURCE_DIR}/inc)
2022-06-22 15:40:48 +00:00
include_directories()
2020-11-13 14:46:27 +00:00
2023-03-15 22:43:37 +00:00
set(LIBNTR_C_FLAGS -O3 -g -Wall -Wextra -Werror -std=c2x)
set(LIBGEN_CC_FLAGS -O3 -g -Wall -Wextra -Werror -std=c++17)
2022-06-22 15:40:48 +00:00
add_library(ntr SHARED libntr/ntr.c)
target_compile_options(ntr PRIVATE ${LIBNTR_C_FLAGS})
2022-06-22 15:40:48 +00:00
add_library(gen SHARED libgen/generator.cc libgen/loadgen.cc)
target_link_libraries(gen PRIVATE pthread ntr ${TOPO_LINK_LIBRARIES} nms)
target_compile_options(gen PRIVATE ${LIBGEN_CC_FLAGS} ${TOPO_CFLAGS})
add_library(netsup SHARED net/libnetsup/dpdk.cc net/libnetsup/portconf.cc)
target_link_libraries(netsup PRIVATE ntr ${DPDK_LINK_LIBRARIES})
target_compile_options(netsup PRIVATE ${LIBGEN_CC_FLAGS} ${DPDK_CFLAGS})
2022-06-22 15:40:48 +00:00
add_library(nms SHARED libnms/alloc.c)
target_link_libraries(nms PRIVATE ${TOPO_LINK_LIBRARIES})
target_compile_options(nms PRIVATE ${TOPO_CFLAGS})
2022-03-20 14:17:26 +00:00
add_executable(khat EXCLUDE_FROM_ALL net/khat.cc)
2022-06-22 15:40:48 +00:00
target_link_libraries(khat PRIVATE pthread ntr gen netsup nms ${DPDK_LINK_LIBRARIES} ${TOPO_LINK_LIBRARIES})
target_compile_options(khat PRIVATE ${CC_FLAGS} ${DPDK_CFLAGS} ${TOPO_CFLAGS})
2022-03-20 14:17:26 +00:00
add_executable(cat EXCLUDE_FROM_ALL net/cat.cc)
2022-06-22 15:40:48 +00:00
target_link_libraries(cat PRIVATE pthread ntr gen netsup nms ${DPDK_LINK_LIBRARIES} ${TOPO_LINK_LIBRARIES})
target_compile_options(cat PRIVATE ${CC_FLAGS} ${DPDK_CFLAGS} ${TOPO_CFLAGS})
2020-11-13 14:46:27 +00:00
2022-03-20 14:17:26 +00:00
add_executable(rat EXCLUDE_FROM_ALL net/rat.cc)
2022-06-22 15:40:48 +00:00
target_link_libraries(rat PRIVATE pthread ntr gen netsup nms ${DPDK_LINK_LIBRARIES} ${TOPO_LINK_LIBRARIES})
target_compile_options(rat PRIVATE ${CC_FLAGS} ${DPDK_CFLAGS} ${TOPO_CFLAGS})
2020-11-13 14:46:27 +00:00
2022-03-28 16:47:46 +00:00
add_executable(birb EXCLUDE_FROM_ALL storage/birb.cc storage/io_gen.cc storage/drivers/bdev.cc storage/drivers/bdev_thread.cc storage/drivers/nvme.cc storage/drivers/nvme_thread.cc)
2022-03-20 14:17:26 +00:00
target_include_directories(birb PRIVATE ${SPDK_INCLUDE_DIRS} ${DPDK_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS})
target_compile_options(birb PRIVATE ${CC_FLAGS} ${SPDK_CFLAGS} ${UUID_CFLAGS})
target_link_directories(birb PRIVATE ${SPDK_LIBRARY_DIRS} ${SPDK_SYS_STATIC_LIBRARY_DIRS} ${UUID_LIBRARY_DIRS})
2022-06-22 15:40:48 +00:00
target_link_libraries(birb PRIVATE pthread ntr gen -Wl,--whole-archive ${SPDK_LIBRARIES} -Wl,--no-whole-archive ${SPDK_SYS_STATIC_LIBRARIES})
2022-02-21 13:41:40 +00:00
add_executable(birb_posix EXCLUDE_FROM_ALL storage/birb_posix.cc storage/io_gen.cc)
target_compile_options(birb_posix PRIVATE ${CC_FLAGS})
2022-06-22 15:40:48 +00:00
target_link_libraries(birb_posix PRIVATE pthread ntr gen)
2022-03-28 16:47:46 +00:00
2022-02-21 13:41:40 +00:00
add_executable(memloadgen util/memloadgen.cc)
2022-11-01 10:01:23 +00:00
target_link_libraries(memloadgen PRIVATE pthread gen ntr nms ${TOPO_LINK_LIBRARIES})
2022-06-22 15:40:48 +00:00
target_compile_options(memloadgen PRIVATE ${CC_FLAGS} ${TOPO_CFLAGS})
2023-05-01 19:18:34 +00:00
add_executable(mornafah util/mornafah.c)
target_link_libraries(mornafah PRIVATE pthread gen ntr nms ${TOPO_LINK_LIBRARIES})
target_compile_options(mornafah PRIVATE ${C_FLAGS} ${TOPO_CFLAGS})
2022-06-22 15:40:48 +00:00
add_executable(nms_test tests/nms_test.c)
set_target_properties(nms_test PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tests)
target_link_libraries(nms_test PRIVATE nms)
target_compile_options(nms_test PRIVATE ${C_FLAGS})