-
Notifications
You must be signed in to change notification settings - Fork 463
[bmv2] path fixes for finding BMv2 #5228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0f56289
to
b50439c
Compare
It looks like these are paths searching for And I guess the purpose is to run those programs for the subset of backend BMv2 tests that run the BMv2 software switch, e.g. the BMv2 P4 programs that have STF tests checked in? I often run such tests on Ubuntu Linux systems that I install BMv2 and p4c from source, but I also always install the |
Yes, I believe this is for the case where the programs are compiled but not installed. Potentially useful for developers who don't want to have to do an install each time they rebuild the model 🙂 The cmake |
cmake/FindBMV2.cmake
Outdated
@@ -1,7 +1,7 @@ | |||
set(BMV2_SIMPLE_SWITCH_SEARCH_PATHS | |||
${CMAKE_INSTALL_PREFIX}/bin | |||
${P4C_SOURCE_DIR}/../behavioral-model/build/targets/simple_switch | |||
${P4C_SOURCE_DIR}/../../behavioral-model/build/targets/simple_switch) | |||
${P4C_SOURCE_DIR}/../behavioral-model/targets/simple_switch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of hacky but not worse than before...
These path hints should probably be an option you can pass to CMake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to clean this up a little before merging.
Here are a couple of possibilities for how change the set statement:
set(BMV2_SIMPLE_SWITCH_SEARCH_PATHS
${CMAKE_INSTALL_PREFIX}/bin)
${BMV2_SOURCE_DIR}/targets/simple_switch)
set(BMV2_SIMPLE_SWITCH_SEARCH_PATHS
${CMAKE_INSTALL_PREFIX}/bin)
if(DEFINED BMV2_SOURCE_DIR)
set(BMV2_SIMPLE_SWITCH_SEARCH_PATHS
${BMV2_SIMPLE_SWITCH_SEARCH_PATHS}
${BMV2_SOURCE_DIR}/targets/simple_switch )
endif()
The first is simple and easy to read, but it has the downside of searching /targets/simple_switch
if BMV2_SOURCE_DIR
is set. The second is quite a bit more verbose but it avoids adding a phantom search directory when BMV2_SOURCE_DIR
it not set.
Do you have a preference? Or do you have an alternative style suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second option sounds good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed a new commit that implements this.
Two changes for finding BMv2: - Remove "build" from the search paths. BMv2 targets are built in behavioral-model/targets/... and not in behavioral-model/build/targets/... - Correct search path variable name in pna_nic error message. Signed-off-by: Glen Gibb <gleng@ai-fabrics.com>
Look in BMV2_SOURCE_DIR/targets/... for BMv2 programs if the variable is set.
b50439c
to
07dc086
Compare
Two changes for finding BMv2:
behavioral-model/targets/...
and not inbehavioral-model/build/targets/...
Is there any env where BMv2 targets are built in
build/targets
? The README.md instructions always build intargets
.