-
Notifications
You must be signed in to change notification settings - Fork 351
Fix CMake build support #1303
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
base: main
Are you sure you want to change the base?
Fix CMake build support #1303
Conversation
@@ -1,36 +0,0 @@ | |||
#!/bin/bash |
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.
Why remove these?
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.
The removal of install_deps.sh was unintentional sir. This script is essential for setting up the build environment and installing dependencies, regardless of whether we're using autotools or CMake for building. I'll restore this file in the next revision of the PR.
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.
Can you revert the file to the original version please? The blank line changes are just adding unnecessary noise to the PR. (I suggest a separate PR if you're wanting to adjust whitespace for readability.)
README.md
Outdated
@@ -1,340 +0,0 @@ | |||
# BEHAVIORAL MODEL (bmv2) |
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.
You should not remove the top level README.md file.
If parts of its contents should change because of changes in the rest of your PR, then please do propose changes to it.
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.
sure sir I'll do it soon.
It looks like The DCO check is also failing. If you look at this PR's Github page, and click on the line for the "DCO" test, it gives detailed instructions on how you can enbale that check to pass. |
sure sir i will fix it soon... |
.github/workflows/test.yml
Outdated
echo "Adding cmake repository..." | ||
sudo apt-get update | ||
sudo apt-get install -y software-properties-common | ||
sudo apt-add-repository -y ppa:kitware/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.
Why do you need to add this repository? cmake should be in the default repositories for Ubuntu 22.04/24.04
And you're doing an install of cmake in the cmake.yml workflow without adding a new ppa.
.github/workflows/cmake.yml
Outdated
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 |
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 we need to build on 20.04? The existing tests are using either ubuntu-latest or ubuntu-22.04
.github/workflows/cmake.yml
Outdated
name: ${{ matrix.config.name }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 |
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.
Please move to v4 to use the same version as the other workflows.
May need to add:
with:
submodules: recursive
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.
sure sir !I’ll update actions/checkout to v4 and include submodules: recursive to align with the other workflow.
.github/workflows/test.yml
Outdated
@@ -38,16 +38,42 @@ jobs: | |||
- uses: actions/checkout@v4 | |||
with: | |||
submodules: 'recursive' | |||
- name: Install system dependencies | |||
run: | | |||
echo "Adding cmake repository..." |
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.
Why are you doing cmake installation here and not in the Dockerfile(s)?
.github/workflows/test.yml
Outdated
- name: Prepare build directory | ||
run: | | ||
docker run --rm -w /behavioral-model bm /bin/bash -c " | ||
mkdir -p build && | ||
cd build && | ||
cmake -DWITH_PDFIXED=ON -DWITH_PI=ON -DWITH_STRESS_TESTS=ON -DENABLE_DEBUGGER=ON -DENABLE_WERROR=ON -DENABLE_COVERAGE=$GCOV .." |
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.
Isn't this already handled in the Dockerfile?
targets/l2_switch/CMakeLists.txt
Outdated
@@ -0,0 +1,43 @@ | |||
# Include directories | |||
include_directories( | |||
${CMAKE_CURRENT_SOURCE_DIR} |
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 need to include the current source dir?
Applies to all the other target CMakeLists.txt files.
targets/l2_switch/CMakeLists.txt
Outdated
# Include directories | ||
include_directories( | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
${CMAKE_CURRENT_BINARY_DIR} |
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.
Why do you need the current binary dir?
) | ||
|
||
# Create l2_switch executable | ||
add_executable(l2_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.
Are you hitting any issue having a library and executable with the same name? A Google search indicates that this used to be a problem -- but perhaps its not any more?
This was the recommended solution for having a library and executable with the same name: https://discourse.cmake.org/t/how-to-use-the-same-name-for-a-target-and-a-library/5044
third_party/spdlog/CMakeLists.txt
Outdated
@@ -0,0 +1,16 @@ | |||
# spdlog is a header-only library, so we just need to install the headers | |||
file(GLOB_RECURSE SPDLOG_HEADERS "bm/spdlog/*.h" "bm/spdlog/*.cc") |
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.
Is this doing anything? I don't see SPDLOG_HEADERS used anywhere.
thrift_src/CMakeLists.txt
Outdated
${THRIFT_GEN_CPP_DIR}/Standard.cpp | ||
${THRIFT_GEN_CPP_DIR}/Standard.h |
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.
These files will appear multiple times in the ALL_THRIFT_CPP_FILES var (once for each iteration). Should we care? Probably not too dangerous as it is only being used in the add_library call.
A few high-level comments from my initial review:
|
@sudhanshu112233shukla I'd started looking at addressing some of the build issues since you were busy wrapping up your semester. Changes I'd made are in: #1305 (At least one of your changes from today has gone a bit too far: you've replaced some |
yes sir !!
yes sir!! i saw those changes soon i will review it. i just saw that , i fix it soon |
Signed-off-by: sudhanshu shukla <161225935+sudhanshu112233shukla@users.noreply.github.com>
Signed-off-by: sudhanshu shukla <161225935+sudhanshu112233shukla@users.noreply.github.com>
Signed-off-by: sudhanshu shukla <161225935+sudhanshu112233shukla@users.noreply.github.com>
Signed-off-by: sudhanshu shukla <161225935+sudhanshu112233shukla@users.noreply.github.com>
…nstallation - Update Ubuntu version to 22.04 - Update actions/checkout to v4 - Add submodules: recursive - Add parallel build with -j Signed-off-by: sudhanshu shukla <161225935+sudhanshu112233shukla@users.noreply.github.com>
Signed-off-by: sudhanshu shukla <161225935+sudhanshu112233shukla@users.noreply.github.com>
Signed-off-by: sudhanshu shukla <161225935+sudhanshu112233shukla@users.noreply.github.com>
Signed-off-by: sudhanshu shukla <161225935+sudhanshu112233shukla@users.noreply.github.com>
8d9ce4a
to
03cd866
Compare
Signed-off-by: sudhanshu shukla <161225935+sudhanshu112233shukla@users.noreply.github.com>
… handling Signed-off-by: sudhanshu shukla <161225935+sudhanshu112233shukla@users.noreply.github.com>
Signed-off-by: sudhanshu shukla <161225935+sudhanshu112233shukla@users.noreply.github.com>
35b0e30
E262
to
62cf955
Compare
Signed-off-by: sudhanshu shukla <161225935+sudhanshu112233shukla@users.noreply.github.com>
Signed-off-by: sudhanshu shukla <161225935+sudhanshu112233shukla@users.noreply.github.com>
Signed-off-by: sudhanshu shukla <161225935+sudhanshu112233shukla@users.noreply.github.com>
Signed-off-by: sudhanshu shukla <161225935+sudhanshu112233shukla@users.noreply.github.com>
Signed-off-by: sudhanshu shukla <161225935+sudhanshu112233shukla@users.noreply.github.com>
This PR implements a comprehensive CMake build system for the behavioral-model project, providing an alternative to the existing autotools build system while maintaining full compatibility with all supported platforms.
Key changes:
The implementation ensures that all existing functionality works correctly with the new build system, and all tests pass. This provides developers with a modern, cross-platform build alternative while maintaining backward compatibility.
Fixes #1254