-
Notifications
You must be signed in to change notification settings - Fork 7
Use the libmoq tar.gz file #11
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
Summary of ChangesHello @kixelated, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the project's CMake build system to enhance the integration of the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request refactors the handling of the moq dependency by using FetchContent combined with find_package. This is a great improvement over the previous manual IMPORTED library creation, making the build more robust and portable across different platforms. The changes in CMakePresets.json correctly configure the new variables required for fetching the platform-specific moq library archives. I have one minor suggestion to further improve the code structure in CMakeLists.txt.
| if(MOQ_LOCAL) | ||
| add_subdirectory(${MOQ_LOCAL}/rs/libmoq moq) | ||
| target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE moq) | ||
| else() | ||
| include(FetchContent) | ||
| FetchContent_Declare( | ||
| moq | ||
| URL | ||
| https://github.com/kixelated/moq/releases/download/v${MOQ_VERSION}/moq-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}.tar.gz | ||
| URL https://github.com/moq-dev/moq/releases/download/libmoq-v${MOQ_VERSION}/moq-${MOQ_VERSION}-${MOQ_TARGET}.${MOQ_ARCHIVE} | ||
| ) | ||
| FetchContent_MakeAvailable(moq) | ||
|
|
||
| add_library(moq SHARED IMPORTED GLOBAL) | ||
| set_target_properties( | ||
| moq | ||
| PROPERTIES | ||
| IMPORTED_LOCATION "${moq_SOURCE_DIR}/lib/libmoq.dylib" | ||
| INTERFACE_INCLUDE_DIRECTORIES "${moq_SOURCE_DIR}/include" | ||
| ) | ||
| find_package(moq REQUIRED PATHS ${moq_SOURCE_DIR} NO_DEFAULT_PATH) | ||
| target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE moq::moq) | ||
| endif() |
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.
To improve maintainability and avoid duplicating the target_link_libraries call, you could use a variable to store the moq target name within the if/else block and then call target_link_libraries once after the block. This makes the logic for handling the local vs. fetched dependency slightly cleaner by separating the dependency resolution from the linking.
if(MOQ_LOCAL)
add_subdirectory(${MOQ_LOCAL}/rs/libmoq moq)
set(MOQ_TARGET_TO_LINK moq)
else()
include(FetchContent)
FetchContent_Declare(
moq
URL https://github.com/moq-dev/moq/releases/download/libmoq-v${MOQ_VERSION}/moq-${MOQ_VERSION}-${MOQ_TARGET}.${MOQ_ARCHIVE}
)
FetchContent_MakeAvailable(moq)
find_package(moq REQUIRED PATHS ${moq_SOURCE_DIR} NO_DEFAULT_PATH)
set(MOQ_TARGET_TO_LINK moq::moq)
endif()
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ${MOQ_TARGET_TO_LINK})
No description provided.