-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add the Tofino model source code as a package in the open P4Studio #65
Draft
fruffy
wants to merge
8
commits into
main
Choose a base branch
from
prathima/include_bf_model
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
be32c1a
Integrate tofino-model
pkotikal 714ca0c
libcrafter dependency
pkotikal f9884ed
Disable incorrect logging calls.
fruffy 39dbad7
Fix librafter setup.
fruffy 83a9fc1
Model version?!
fruffy abfbaa9
Cmake cleanups.
fruffy 65bbaf5
More cleanup.
fruffy bdbc37f
Fix compilation failure because of unsanitized input.
fruffy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,6 +107,7 @@ sudo ${SDE_INSTALL}/bin/veth_setup.sh 128 | |
|
||
* bridge | ||
* libcli | ||
* libcrafter | ||
* thrift | ||
* grpc | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from os.path import join, exists | ||
from pathlib import Path | ||
|
||
from dependencies.source.source_dependency_config import SourceDependencyConfig | ||
from utils.processes import execute | ||
|
||
import os | ||
|
||
def download_libcrafter(config: SourceDependencyConfig) -> None: | ||
version = config.dependency_manager().source_dependency_attributes("libcrafter")['version'] | ||
repo_dir = config.download_dir(ensure_exists=False) | ||
if not repo_dir.exists(): | ||
execute("git clone https://github.com/pellegre/libcrafter.git {}".format(repo_dir)) | ||
execute("git -c advice.detachedHead=false checkout {}".format(version), repo_dir) | ||
|
||
|
||
def install_libcrafter(config: SourceDependencyConfig) -> None: | ||
version = config.dependency_manager().source_dependency_attributes("libcrafter")['version'] | ||
|
||
if not config.force and _is_libcrafter_installed(config.install_dir, version): | ||
return | ||
|
||
download_libcrafter(config) | ||
build_dir = config.build_dir(copy_download_dir=True) | ||
build_dir = build_dir / 'libcrafter' | ||
|
||
# Set the environment variable | ||
env = os.environ.copy() | ||
env['LDFLAGS'] = "-Wl,-s" | ||
|
||
execute("./autogen.sh", build_dir) | ||
execute("./configure --prefix={}".format(config.install_dir), build_dir) | ||
execute('make PREFIX={} install -j{}'.format(config.install_dir, config.jobs), build_dir) | ||
execute("sudo ldconfig") | ||
|
||
|
||
def _is_libcrafter_installed(path: Path, version: str) -> bool: | ||
return (path / "lib/libcrafter.so.{}".format(version)).exists() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do you want to merge this PR with this code commented out? Or perhaps wrap them all in an
#ifdef SOME_NEW_SYMBOL_NAME
with the same symbol name as each other, to make them easier to grep and find later when someone wants to update all of these calls? I guess marking them all with an identical unique string in a comment works for that, too.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 will remove these changes later. But I need them to build on Ubuntu 24.04, which is the distribution I am currently using.
The problem is that this code doesn't compile with newer version of GCC/CLang, which enforce the C++ standard correctly.