Skip to content

Commit

Permalink
Update P4Runtime and use FetchContent instead of a submodule.
Browse files Browse the repository at this point in the history
  • Loading branch information
fruffy committed Jul 25, 2023
1 parent 56aa810 commit 8d0d915
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
path = test/frameworks/gtest
url = https://github.com/google/googletest.git
ignored = untracked
[submodule "control-plane/p4runtime"]
path = control-plane/p4runtime
url = https://github.com/p4lang/p4runtime.git
[submodule "backends/ebpf/runtime/contrib/libbpf"]
path = backends/ebpf/runtime/contrib/libbpf
url = https://github.com/libbpf/libbpf
Expand Down
19 changes: 18 additions & 1 deletion control-plane/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.


# Print download state while setting up P4Runtime.
set(FETCHCONTENT_QUIET_PREV ${FETCHCONTENT_QUIET})
set(FETCHCONTENT_QUIET OFF)
# Fetch and declare the P4Runtime library.
FetchContent_Declare(
p4runtime
GIT_REPOSITORY https://github.com/p4lang/p4runtime.git
GIT_TAG d76a3640a223f47a43dc34e5565b72e43796ba57
GIT_PROGRESS TRUE
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(p4runtime)
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 ${CMAKE_CURRENT_SOURCE_DIR}/p4runtime/proto)
set (P4RUNTIME_STD_DIR ${p4runtime_SOURCE_DIR}/proto)
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 Expand Up @@ -58,6 +74,7 @@ add_custom_command(OUTPUT ${P4RUNTIME_GEN_SRCS} ${P4RUNTIME_GEN_HDRS}
-I ${P4RUNTIME_STD_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}
--cpp_out ${CMAKE_CURRENT_BINARY_DIR}
--python_out ${CMAKE_CURRENT_BINARY_DIR}
--experimental_allow_proto3_optional
${P4RUNTIME_PROTO}
DEPENDS ${P4RUNTIME_PROTO}
COMMENT "Generating protobuf files"
Expand Down
1 change: 0 additions & 1 deletion control-plane/p4runtime
Submodule p4runtime deleted from 7a322f

0 comments on commit 8d0d915

Please sign in to comment.