summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2021-05-25 19:28:21 +0200
committerFlorin Coras <florin.coras@gmail.com>2021-05-27 20:53:50 +0000
commit7cf80af582a12fba4b547b1f2b01c27b8295f84c (patch)
tree8649b130b4c8f0c179232c10a7d5bee71f08097d
parent9303b10897324d5af1645ed3069303328221dd93 (diff)
build: kindly ask python not to polute src/
Type: make Change-Id: I1ec82e0f3c19dee79f942996339240c73d4e380c Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/cmake/api.cmake8
-rw-r--r--src/vpp-api/vapi/CMakeLists.txt4
3 files changed, 7 insertions, 6 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1730e7b669e..84631203265 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -73,6 +73,7 @@ set(VPP_LIBRARY_DIR "lib" CACHE STRING "Relative library directory path")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${VPP_RUNTIME_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${VPP_LIBRARY_DIR})
set(VPP_BINARY_DIR ${CMAKE_BINARY_DIR}/CMakeFiles)
+set(PYENV PYTHONPYCACHEPREFIX=${CMAKE_BINARY_DIR}/CMakeFile/__pycache__)
if (CMAKE_BUILD_TYPE)
add_compile_options(-g -fPIC -Werror -Wall)
diff --git a/src/cmake/api.cmake b/src/cmake/api.cmake
index 007a9060023..831c2b1e32d 100644
--- a/src/cmake/api.cmake
+++ b/src/cmake/api.cmake
@@ -38,7 +38,7 @@ function(vpp_generate_api_c_header file)
add_custom_command (
OUTPUT ${OUTPUT_HEADERS}
COMMAND mkdir -p ${output_dir}
- COMMAND ${VPP_APIGEN}
+ COMMAND ${PYENV} ${VPP_APIGEN}
ARGS ${includedir} --includedir ${CMAKE_SOURCE_DIR} --input ${CMAKE_CURRENT_SOURCE_DIR}/${file} --outputdir ${output_dir} --output ${output_name}
DEPENDS ${VPP_APIGEN} ${CMAKE_CURRENT_SOURCE_DIR}/${file}
COMMENT "Generating API header ${output_name}"
@@ -63,7 +63,7 @@ function(vpp_generate_api_json_header file dir component)
endif()
add_custom_command (OUTPUT ${output_name}
COMMAND mkdir -p ${output_dir}
- COMMAND ${VPP_APIGEN}
+ COMMAND ${PYENV} ${VPP_APIGEN}
ARGS ${includedir} --includedir ${CMAKE_SOURCE_DIR} --input ${CMAKE_CURRENT_SOURCE_DIR}/${file} JSON --output ${output_name}
DEPENDS ${VPP_APIGEN} ${CMAKE_CURRENT_SOURCE_DIR}/${file}
COMMENT "Generating API header ${output_name}"
@@ -94,7 +94,7 @@ function(vpp_generate_vapi_c_header f)
add_custom_command(
OUTPUT ${output_name}
WORKING_DIRECTORY ${VPP_BINARY_DIR}/vpp-api/vapi
- COMMAND ${VPP_VAPI_C_GEN}
+ COMMAND ${PYENV} ${VPP_VAPI_C_GEN}
ARGS --remove-path ${input}
DEPENDS ${input} ${VPP_VAPI_C_GEN_DEPENDS}
COMMENT "Generating VAPI C header ${output_name}"
@@ -121,7 +121,7 @@ function (vpp_generate_vapi_cpp_header f)
add_custom_command(
OUTPUT ${output_name}
WORKING_DIRECTORY ${VPP_BINARY_DIR}/vpp-api/vapi
- COMMAND ${VPP_VAPI_CPP_GEN}
+ COMMAND ${PYENV} ${VPP_VAPI_CPP_GEN}
ARGS --gen-h-prefix=vapi --remove-path ${input}
DEPENDS ${input} ${VPP_VAPI_CPP_GEN_DEPENDS}
COMMENT "Generating VAPI C++ header ${output_name}"
diff --git a/src/vpp-api/vapi/CMakeLists.txt b/src/vpp-api/vapi/CMakeLists.txt
index 626971f9108..53034bd27b8 100644
--- a/src/vpp-api/vapi/CMakeLists.txt
+++ b/src/vpp-api/vapi/CMakeLists.txt
@@ -69,7 +69,7 @@ if(SUBUNIT_INCLUDE_DIR AND SUBUNIT_LIB)
add_custom_command(
OUTPUT fake.api.vapi.h
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/vapi_c_gen.py
+ COMMAND ${PYENV} ${CMAKE_CURRENT_SOURCE_DIR}/vapi_c_gen.py
ARGS --remove-path ${CMAKE_CURRENT_SOURCE_DIR}/fake.api.json
DEPENDS fake.api.json
COMMENT "Generating fake VAPI C header ${output_name}"
@@ -78,7 +78,7 @@ if(SUBUNIT_INCLUDE_DIR AND SUBUNIT_LIB)
add_custom_command(
OUTPUT fake.api.vapi.hpp
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/vapi_cpp_gen.py
+ COMMAND ${PYENV} ${CMAKE_CURRENT_SOURCE_DIR}/vapi_cpp_gen.py
ARGS --remove-path ${CMAKE_CURRENT_SOURCE_DIR}/fake.api.json
DEPENDS fake.api.json
COMMENT "Generating fake VAPI C++ header ${output_name}"