diff options
author | 2025-01-09 03:19:31 -0800 | |
---|---|---|
committer | 2025-01-09 16:37:11 +0100 | |
commit | ec68cec6c84e5dc9acaf7828c0118bb71fffc561 (patch) | |
tree | c29e645ea065ba1fe692011db9ee389e8921c918 /src/cmake/cpu.cmake | |
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
Diffstat (limited to 'src/cmake/cpu.cmake')
-rw-r--r-- | src/cmake/cpu.cmake | 25 |
1 files changed, 25 insertions, 0 deletions
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 ############################################################################## |