diff options
author | Guillaume Solignac <gsoligna@cisco.com> | 2025-01-09 03:19:31 -0800 |
---|---|---|
committer | Guillaume Solignac <gsoligna@cisco.com> | 2025-01-09 16:37:11 +0100 |
commit | ec68cec6c84e5dc9acaf7828c0118bb71fffc561 (patch) | |
tree | c29e645ea065ba1fe692011db9ee389e8921c918 | |
parent | a215f515805bcd671a64e420a1a41ab695fbc935 (diff) |
build: expose VPP_PLATFORM to out-of-tree plugins
We move the VPP_PLATFORM logic from src/CMakeLists.txt to
cmake/cpu.cmake so that out-of-tree plugins can leverage it as well.
Type: improvement
Signed-off-by: Guillaume Solignac <gsoligna@cisco.com>
Change-Id: I767a75f45c07aed7db4034b18ab4b5c67fda06ee
-rw-r--r-- | src/CMakeLists.txt | 21 | ||||
-rw-r--r-- | src/cmake/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/cmake/cpu.cmake | 25 |
3 files changed, 35 insertions, 21 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f6d07be0b79..967c7772ff3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,27 +13,6 @@ cmake_minimum_required(VERSION 3.13) -if(DEFINED VPP_PLATFORM AND VPP_PLATFORM STREQUAL "default") - unset(VPP_PLATFORM) - unset(VPP_PLATFORM CACHE) - set(VPP_PLATFORM_NAME "default") -elseif(DEFINED VPP_PLATFORM) - set(platform_file ${CMAKE_SOURCE_DIR}/cmake/platform/${VPP_PLATFORM}.cmake) - if(NOT EXISTS ${platform_file}) - message(FATAL_ERROR "unknown platform ${VPP_PLATFORM}") - endif() - include(${platform_file}) - set(VPP_PLATFORM_NAME ${VPP_PLATFORM}) -else() - set(VPP_PLATFORM_NAME "default") -endif() - -if (DEFINED VPP_PLATFORM_C_COMPILER_NAMES) - set(CMAKE_C_COMPILER_NAMES ${VPP_PLATFORM_C_COMPILER_NAME}) -else() - set(CMAKE_C_COMPILER_NAMES clang gcc cc) -endif() - project(vpp C) if(NOT DEFINED CMAKE_INSTALL_LIBDIR AND EXISTS "/etc/debian_version") diff --git a/src/cmake/CMakeLists.txt b/src/cmake/CMakeLists.txt index 74cd385a1ce..8f7ad0e8513 100644 --- a/src/cmake/CMakeLists.txt +++ b/src/cmake/CMakeLists.txt @@ -25,3 +25,13 @@ install( COMPONENT vpp-dev ) + +install( + DIRECTORY + platform/ + + DESTINATION + ${VPP_LIBRARY_DIR}/cmake/vpp/platform + + COMPONENT vpp-dev +) diff --git a/src/cmake/cpu.cmake b/src/cmake/cpu.cmake index 25e966dcf7a..b1b802a5506 100644 --- a/src/cmake/cpu.cmake +++ b/src/cmake/cpu.cmake @@ -22,6 +22,31 @@ macro(set_log2_cacheline_size var n) endmacro() ############################################################################## +# Platform selection +############################################################################## + +if(DEFINED VPP_PLATFORM AND VPP_PLATFORM STREQUAL "default") + unset(VPP_PLATFORM) + unset(VPP_PLATFORM CACHE) + set(VPP_PLATFORM_NAME "default") +elseif(DEFINED VPP_PLATFORM) + set(platform_file ${CMAKE_CURRENT_LIST_DIR}/platform/${VPP_PLATFORM}.cmake) + if(NOT EXISTS ${platform_file}) + message(FATAL_ERROR "unknown platform ${VPP_PLATFORM}") + endif() + include(${platform_file}) + set(VPP_PLATFORM_NAME ${VPP_PLATFORM}) +else() + set(VPP_PLATFORM_NAME "default") +endif() + +if (DEFINED VPP_PLATFORM_C_COMPILER_NAMES) + set(CMAKE_C_COMPILER_NAMES ${VPP_PLATFORM_C_COMPILER_NAME}) +else() + set(CMAKE_C_COMPILER_NAMES clang gcc cc) +endif() + +############################################################################## # Cache line size ############################################################################## |