summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt21
-rw-r--r--src/cmake/CMakeLists.txt10
-rw-r--r--src/cmake/cpu.cmake25
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
##############################################################################