summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
author童宗振 <[email protected]>2023-12-27 04:05:09 +0000
committer陆秋文 <[email protected]>2023-12-27 04:05:09 +0000
commitb269cd473f22c60203ed50804dc7a26638e6964f (patch)
tree09bba165529645cafa57243c78ea58d679b946dd /CMakeLists.txt
parent8711dcbb38389e8a3a2fc5ad3f33408a5db5bb2d (diff)
build DPDK as a support library.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt33
1 files changed, 16 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 218f43b..34ae792 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,19 +9,27 @@ endif()
project(marsio)
+message("CMake version: ${CMAKE_VERSION}")
+
+set(COREI7 "corei7")
+set(ICELAKE_SERVER "icelake-server")
+set(ZNVER1 "znver1")
+set(SUPPORTED_MACHINES ${COREI7} ${ICELAKE_SERVER} ${ZNVER1})
+
if(NOT MACHINE)
set(MACHINE "corei7")
endif()
-set(RTE_MARCH ${MACHINE})
+list(FIND SUPPORTED_MACHINES ${MACHINE} INDEX)
+if(${INDEX} GREATER -1)
+ message(STATUS "current MACHINE is ${MACHINE}.")
+else()
+ message(FATAL_ERROR "${MACHINE} is not in the support machines list.")
+endif()
# Include Modules
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
-find_package(DPDK REQUIRED)
-link_directories(${DPDK_LIBRARY_DIR})
-include_directories(${DPDK_INCLUDE_DIR})
-
find_package(PCAP REQUIRED)
link_directories(${PCAP_LIBRARY_DIR})
include_directories(${PCAP_INCLUDE_DIR})
@@ -96,25 +104,16 @@ set(MR_INSTALL_LDCONFDIR /etc/ld.so.conf.d/)
set(MR_INSTALL_SYSUNITCONFDIR /etc/sysconfig/)
set(MR_INSTALL_PROFILEDIR /etc/profile.d/)
-set(MR_INSTALL_LIBDIR_RELATIVE_PATH ${MACHINE}/lib)
-set(MR_INSTALL_BINDIR_RELATIVE_PATH ${MACHINE}/bin)
-set(MR_INSTALL_INCLUDEDIR_RELATIVE_PATH ${MACHINE}/include)
-
-
-set(MR_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/${MACHINE}/lib)
-
set(ALTERANTIVES_PRIORITY 300)
-if(RTE_MARCH STREQUAL "corei7" )
+if(MACHINE STREQUAL ${COREI7})
set(ALTERANTIVES_PRIORITY 300)
-elseif(RTE_MARCH STREQUAL "icelake-server" )
+elseif(MACHINE STREQUAL ${ICELAKE_SERVER})
set(ALTERANTIVES_PRIORITY 200)
-elseif(RTE_MARCH STREQUAL "znver1" )
+elseif(MACHINE STREQUAL ${ZNVER1})
set(ALTERANTIVES_PRIORITY 100)
endif()
-
-
exec_program(pkg-config ARGS systemd --variable=systemdsystemunitdir OUTPUT_VARIABLE MR_INSTALL_SYSUNITDIR)
add_subdirectory(${CMAKE_SOURCE_DIR}/support)