Skip to content

Commit

Permalink
Fix DPDK directory paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
fruffy committed Jul 25, 2023
1 parent 8d0d915 commit 78a2c7b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 7 additions & 6 deletions backends/dpdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,30 @@ include_directories(${P4C_BINARY_DIR}/control-plane)
################ Proto
set (DPDK_P4RUNTIME_DIR ${CMAKE_CURRENT_SOURCE_DIR}/control-plane/proto)
set (DPDK_P4RUNTIME_INFO_PROTO ${DPDK_P4RUNTIME_DIR}/p4info.proto)
set (DPDK_P4RUNTIME_INFO_GEN_SRCS ${P4C_BINARY_DIR}/p4/config/dpdk/p4info.pb.cc)
set (DPDK_P4RUNTIME_INFO_GEN_HDRS ${P4C_BINARY_DIR}/p4/config/dpdk/p4info.pb.h)
set (DPDK_P4RUNTIME_INFO_GEN_SRCS ${CMAKE_CURRENT_BINARY_DIR}/p4/config/dpdk/p4info.pb.cc)
set (DPDK_P4RUNTIME_INFO_GEN_HDRS ${CMAKE_CURRENT_BINARY_DIR}/p4/config/dpdk/p4info.pb.h)
# The generated code for protobuf has an excessive number of warnings
# Silence -Warray-bounds as the root issue is out of our control: https://github.com/protocolbuffers/protobuf/issues/7140
set_source_files_properties(${DPDK_P4RUNTIME_INFO_GEN_SRCS} PROPERTIES
COMPILE_FLAGS "-Wno-unused-parameter -Wno-array-bounds")

add_custom_target (dpdk_runtime_dir
${CMAKE_COMMAND} -E make_directory
${P4C_BINARY_DIR}/p4/config/dpdk)
${CMAKE_CURRENT_BINARY_DIR}/p4/config/dpdk)
# Generate source code from .proto using protoc. The output is
# placed in the build directory inside `control-plane` directory
add_custom_command(
OUTPUT ${DPDK_P4RUNTIME_INFO_GEN_SRCS} ${DPDK_P4RUNTIME_INFO_GEN_HDRS}
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
--proto_path ${DPDK_P4RUNTIME_DIR}
--proto_path ${P4C_SOURCE_DIR}/control-plane/p4runtime/proto
--cpp_out ${P4C_BINARY_DIR}/p4/config/dpdk
--python_out ${P4C_BINARY_DIR}/p4/config/dpdk
--proto_path ${P4RUNTIME_STD_DIR}
--cpp_out ${CMAKE_CURRENT_BINARY_DIR}/p4/config/dpdk
--python_out ${CMAKE_CURRENT_BINARY_DIR}/p4/config/dpdk
${DPDK_P4RUNTIME_INFO_PROTO}
DEPENDS ${DPDK_P4RUNTIME_INFO_PROTO} dpdk_runtime_dir
COMMENT "Generating protobuf files for p4info on target DPDK."
)
add_dependencies(dpdk_runtime_dir controlplane)

add_library(dpdk_runtime STATIC ${DPDK_P4RUNTIME_INFO_GEN_SRCS})
target_include_directories(dpdk_runtime
Expand Down
6 changes: 4 additions & 2 deletions control-plane/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ set(FETCHCONTENT_QUIET ${FETCHCONTENT_QUIET_PREV})
message("Done with setting up P4Runtime for P4C.")

# The standard P4Runtime protocol buffers message definitions live in the PI
# repo, which is included in this repo as a submodule.
set (P4RUNTIME_STD_DIR ${p4runtime_SOURCE_DIR}/proto)
# repo, which is included in this repo as a git module.
set(P4RUNTIME_STD_DIR ${p4runtime_SOURCE_DIR}/proto CACHE INTERNAL
"Path to the P4Runtime directory."
)
set (P4RUNTIME_INFO_PROTO ${P4RUNTIME_STD_DIR}/p4/config/v1/p4info.proto)
set (P4RUNTIME_INFO_GEN_SRCS ${CMAKE_CURRENT_BINARY_DIR}/p4/config/v1/p4info.pb.cc)
set (P4RUNTIME_INFO_GEN_HDRS ${CMAKE_CURRENT_BINARY_DIR}/p4/config/v1/p4info.pb.h)
Expand Down

0 comments on commit 78a2c7b

Please sign in to comment.