Skip to content
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

Added Dependency Management for ReaderWriterQueue and Pistache #43

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

nicolo-mn
Copy link

@nicolo-mn nicolo-mn commented Jan 18, 2025

This PR addresses Issue #14.

As requested, I tested the code from PR #41, but I encountered build issues: the libraries were fetched without updating the target usages, and fetching Pistache from the master branch introduced a dependency on libcurl4-openssl-dev.

To resolve these issues, I updated the target usages and switched to fetching a specific tagged release of Pistache instead of the master branch. The selected tag corresponds to the version available in the Debian 12 stable repository, as the latest (very recent) version introduces an additional dependency, as mentioned above. I also updated the README and moved the management of both Pistache and ReaderWriterQueue from CMakeLists.txt to cmake/dependencies.cmake alongside the other fetched dependencies.

I built and executed the project on a Debian 12 (stable) machine with SoftRoCE to ensure all dependencies are fetched, included, and linked correctly.

This is my first PR for this project so please be patient with me, and I’ll be happy to make any additional changes or fixes as needed.

Summary by CodeRabbit

Release Notes

  • Dependencies
    • Added readerwriterqueue library version 1.0.6
    • Updated pistache library to version 0.0.5
  • Build Configuration
    • Refined dependency management for library inclusion
    • Updated CMake configuration for more precise library linking

Copy link

coderabbitai bot commented Jan 18, 2025

Walkthrough

The pull request introduces changes to the project's dependency management and build configuration. The modifications focus on updating the Pistache library usage from a package config method to a static library approach. Additionally, new dependencies like readerwriterqueue have been added to the project. The changes primarily affect the CMake configuration files, updating dependency versions and inclusion methods, with corresponding updates to the README to reflect the new software requirements.

Changes

File Change Summary
CMakeLists.txt Replaced PkgConfig::Pistache with pistache_static for include directories and library linking.
README.md Added specific versions for pistache (0.0.5) and new dependency readerwriterqueue (1.0.6).
cmake/dependencies.cmake Added new dependencies readerwriterqueue and libpistache with specific versions and fetch instructions; modified googletest dependency handling.

Sequence Diagram

sequenceDiagram
    participant CM as CMake
    participant RWQ as ReaderWriterQueue
    participant Pistache as Pistache Library
    participant GT as GoogleTest

    CM->>RWQ: Fetch dependency v1.0.6
    CM->>Pistache: Fetch library v0.0.5
    CM->>GT: Conditionally fetch if testing enabled
    CM->>CM: Configure build targets
Loading

Poem

🐰 Cmake's magic, dependencies dance,
Pistache and queues in a coding romance!
Static libraries, versions precise,
Build system tweaks that are oh-so-nice
A rabbit's delight in dependency glee! 🛠️


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b8cee45 and 06997a7.

📒 Files selected for processing (2)
  • CMakeLists.txt (1 hunks)
  • cmake/dependencies.cmake (1 hunks)
🔇 Additional comments (2)
cmake/dependencies.cmake (1)

67-79: Verify if ReaderWriterQueue requires any build options.

The dependency configuration follows the project's pattern and uses a pinned version which is good. However, let's verify if any build options (like tests, examples) should be disabled.

✅ Verification successful

No build options needed for ReaderWriterQueue

The library is header-only with a minimal CMake configuration that doesn't expose any build options. The current dependency configuration is correct as is.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if ReaderWriterQueue has CMake options we should configure
curl -s https://raw.githubusercontent.com/cameron314/readerwriterqueue/v1.0.6/CMakeLists.txt | grep -i "option("

Length of output: 114


Script:

#!/bin/bash
# First, let's check the repository structure at v1.0.6
curl -s "https://api.github.com/repos/cameron314/readerwriterqueue/git/trees/v1.0.6?recursive=1" | jq -r '.tree[].path' | grep -i 'cmake\|CMakeLists.txt'

# Alternatively, let's check the raw content directly
curl -sI https://raw.githubusercontent.com/cameron314/readerwriterqueue/v1.0.6/CMakeLists.txt

Length of output: 1136


Script:

#!/bin/bash
# Fetch and display CMakeLists.txt content
curl -s https://raw.githubusercontent.com/cameron314/readerwriterqueue/v1.0.6/CMakeLists.txt

# Also check for any other potential configuration files
curl -s "https://api.github.com/repos/cameron314/readerwriterqueue/git/trees/v1.0.6?recursive=1" | jq -r '.tree[].path' | grep -i '\.cmake$'

Length of output: 616

CMakeLists.txt (1)

Line range hint 71-77: Verify if PkgConfig is still needed.

Since Pistache is now managed through FetchContent, let's verify if PkgConfig is still required by other dependencies.

✅ Verification successful

PkgConfig is required and should be kept

PkgConfig is still needed for configuring required dependencies:

  • librdmacm (RDMA Connection Manager)
  • libibverbs (InfiniBand Verbs)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check remaining PkgConfig usage
rg "pkg_check_modules" --type cmake

Length of output: 189

Comment on lines +81 to +93
###
# pistache
###
find_package(libpistache 0.0.5 EXACT QUIET)
if(NOT libpistache_FOUND)
message(STATUS "Downloading and building libpistache dependency")
FetchContent_Declare(
libpistache
GIT_REPOSITORY https://github.com/pistacheio/pistache
GIT_TAG 0.0.5
)
FetchContent_MakeAvailable(libpistache)
endif()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add CMAKE_ARGS to disable unnecessary Pistache features.

While using a pinned version that matches Debian 12 stable is good, we should also disable unnecessary Pistache features to minimize build time and dependencies.

Add these build options:

 FetchContent_Declare(
   libpistache
   GIT_REPOSITORY https://github.com/pistacheio/pistache
   GIT_TAG        0.0.5
+  CMAKE_ARGS
+    -DPISTACHE_BUILD_TESTS=OFF
+    -DPISTACHE_BUILD_EXAMPLES=OFF
+    -DPISTACHE_BUILD_DOCS=OFF
 )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
###
# pistache
###
find_package(libpistache 0.0.5 EXACT QUIET)
if(NOT libpistache_FOUND)
message(STATUS "Downloading and building libpistache dependency")
FetchContent_Declare(
libpistache
GIT_REPOSITORY https://github.com/pistacheio/pistache
GIT_TAG 0.0.5
)
FetchContent_MakeAvailable(libpistache)
endif()
###
# pistache
###
find_package(libpistache 0.0.5 EXACT QUIET)
if(NOT libpistache_FOUND)
message(STATUS "Downloading and building libpistache dependency")
FetchContent_Declare(
libpistache
GIT_REPOSITORY https://github.com/pistacheio/pistache
GIT_TAG 0.0.5
CMAKE_ARGS
-DPISTACHE_BUILD_TESTS=OFF
-DPISTACHE_BUILD_EXAMPLES=OFF
-DPISTACHE_BUILD_DOCS=OFF
)
FetchContent_MakeAvailable(libpistache)
endif()

Comment on lines +183 to +184
target_include_directories(resource_manager SYSTEM PUBLIC $<TARGET_PROPERTY:pistache_static,INTERFACE_INCLUDE_DIRECTORIES>)
target_link_libraries(resource_manager PRIVATE pistache_static)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Missing required dependencies for Pistache

The current configuration is incomplete. Based on Pistache's requirements, the following changes are needed:

  • Add find_package(OpenSSL REQUIRED COMPONENTS SSL Crypto)
  • Update target_link_libraries to include required dependencies:
    target_link_libraries(resource_manager PRIVATE 
      pistache_static
      Threads::Threads
      OpenSSL::SSL
      OpenSSL::Crypto
    )
🔗 Analysis chain

Verify Pistache dependencies are properly linked.

The switch to static linking is good, but we should verify that all required Pistache dependencies are properly linked.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check Pistache dependencies
ast-grep --pattern 'target_link_libraries($$$pistache_static$$$)' | grep -B2 -A2 'target_link_libraries'

# Verify if Pistache requires additional system libraries
curl -s https://raw.githubusercontent.com/pistacheio/pistache/0.0.5/CMakeLists.txt | grep -i "find_package"

Length of output: 330


Script:

#!/bin/bash
# Check for required dependencies in CMakeLists.txt
echo "=== Checking for required dependencies ==="
rg "find_package\((Threads|OpenSSL)" -A 2

echo -e "\n=== Checking resource_manager linking ==="
rg "target_link_libraries.*resource_manager.*" -B 2 -A 2

Length of output: 679

@mcopik
Copy link
Contributor

mcopik commented Jan 25, 2025

@nicolo-mn Thanks for the PR; it looks very nice! I wouldn't say it's your first :-)

Two questions:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants