summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt17
-rw-r--r--src/cmake/VPPConfig.cmake4
-rw-r--r--src/cmake/exec.cmake2
-rw-r--r--src/cmake/library.cmake2
-rw-r--r--src/cmake/plugin.cmake4
-rw-r--r--src/tools/vppapigen/CMakeLists.txt2
-rw-r--r--src/vpp-api/vapi/CMakeLists.txt2
7 files changed, 20 insertions, 13 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2e3cf6b1d68..59c7512a044 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -50,9 +50,11 @@ set(CMAKE_C_COMPILER_TARGET ${CMAKE_SYSTEM_PROCESSOR}-linux-gnu)
##############################################################################
check_c_compiler_flag("-Wno-address-of-packed-member"
compiler_flag_no_address_of_packed_member)
+set(VPP_RUNTIME_DIR "bin" CACHE STRING "Relative runtime directory path")
+set(VPP_LIBRARY_DIR "lib" CACHE STRING "Relative library directory path")
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${VPP_RUNTIME_DIR})
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${VPP_LIBRARY_DIR})
if (CMAKE_BUILD_TYPE)
set(CMAKE_C_FLAGS "-g -fPIC -Werror -Wall ${CMAKE_C_FLAGS}")
@@ -107,12 +109,12 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
# sanitizers
##############################################################################
-option(ENABLE_SANITIZE_ADDR "Enable Address Sanitizer" OFF)
-if (ENABLE_SANITIZE_ADDR)
+option(VPP_ENABLE_SANITIZE_ADDR "Enable Address Sanitizer" OFF)
+if (VPP_ENABLE_SANITIZE_ADDR)
set(CMAKE_C_FLAGS "-fsanitize=address --param asan-stack=0 -DCLIB_SANITIZE_ADDR ${CMAKE_C_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "-fsanitize=address ${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "-fsanitize=address ${CMAKE_SHARED_LINKER_FLAGS}")
-endif (ENABLE_SANITIZE_ADDR)
+endif (VPP_ENABLE_SANITIZE_ADDR)
##############################################################################
# install config
@@ -139,7 +141,10 @@ include(cmake/plugin.cmake)
##############################################################################
# subdirs - order matters
##############################################################################
-if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
+option(VPP_HOST_TOOLS_ONLY "Build only host tools" OFF)
+if(VPP_HOST_TOOLS_ONLY)
+ set(SUBDIRS tools/vppapigen cmake)
+elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
find_package(OpenSSL REQUIRED)
set(SUBDIRS
vppinfra svm vlib vlibmemory vlibapi vnet vpp vat vcl plugins
diff --git a/src/cmake/VPPConfig.cmake b/src/cmake/VPPConfig.cmake
index 870c2a5b182..21da59d68ba 100644
--- a/src/cmake/VPPConfig.cmake
+++ b/src/cmake/VPPConfig.cmake
@@ -33,7 +33,9 @@ if (compiler_flag_no_address_of_packed_member)
add_definitions(-Wno-address-of-packed-member)
endif()
-include(CheckCCompilerFlag)
+set(VPP_RUNTIME_DIR "bin" CACHE STRING "Relative runtime directory path")
+set(VPP_LIBRARY_DIR "lib" CACHE STRING "Relative library directory path")
+
include(${CMAKE_CURRENT_LIST_DIR}/cpu.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/api.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/library.cmake)
diff --git a/src/cmake/exec.cmake b/src/cmake/exec.cmake
index d5e837084e9..7bfd5751c83 100644
--- a/src/cmake/exec.cmake
+++ b/src/cmake/exec.cmake
@@ -30,7 +30,7 @@ macro(add_vpp_executable exec)
add_dependencies(${exec} ${ARG_DEPENDS})
endif()
if(NOT ARG_NO_INSTALL)
- install(TARGETS ${exec} DESTINATION bin)
+ install(TARGETS ${exec} DESTINATION ${VPP_RUNTIME_DIR})
endif()
endmacro()
diff --git a/src/cmake/library.cmake b/src/cmake/library.cmake
index dc14ae59e46..d6a63d325e9 100644
--- a/src/cmake/library.cmake
+++ b/src/cmake/library.cmake
@@ -34,7 +34,7 @@ macro(add_vpp_library lib)
endif()
install(
TARGETS ${lib}
- DESTINATION lib
+ DESTINATION ${VPP_LIBRARY_DIR}
COMPONENT ${ARG_COMPONENT}
)
diff --git a/src/cmake/plugin.cmake b/src/cmake/plugin.cmake
index 2e2749a440e..bf40aa504a7 100644
--- a/src/cmake/plugin.cmake
+++ b/src/cmake/plugin.cmake
@@ -86,13 +86,13 @@ macro(add_vpp_plugin name)
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/vpp_api_test_plugins)
install(
TARGETS ${test_plugin_name}
- DESTINATION lib/vpp_api_test_plugins
+ DESTINATION ${VPP_LIBRARY_DIR}/vpp_api_test_plugins
COMPONENT ${PLUGIN_COMPONENT}
)
endif()
install(
TARGETS ${plugin_name}
- DESTINATION lib/vpp_plugins
+ DESTINATION ${VPP_LIBRARY_DIR}/vpp_plugins
COMPONENT ${PLUGIN_COMPONENT}
)
endmacro()
diff --git a/src/tools/vppapigen/CMakeLists.txt b/src/tools/vppapigen/CMakeLists.txt
index 9fb00817ea9..bfabc3a670c 100644
--- a/src/tools/vppapigen/CMakeLists.txt
+++ b/src/tools/vppapigen/CMakeLists.txt
@@ -14,7 +14,7 @@
install(
FILES vppapigen.py
RENAME vppapigen
- DESTINATION bin
+ DESTINATION ${VPP_RUNTIME_DIR}
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
diff --git a/src/vpp-api/vapi/CMakeLists.txt b/src/vpp-api/vapi/CMakeLists.txt
index 4c74ae80928..04e7edd5f2a 100644
--- a/src/vpp-api/vapi/CMakeLists.txt
+++ b/src/vpp-api/vapi/CMakeLists.txt
@@ -55,6 +55,6 @@ install(
vapi_cpp_gen.py
vapi_json_parser.py
- DESTINATION bin
+ DESTINATION ${VPP_RUNTIME_DIR}
COMPONENT vpp-dev
)