ahojnnes ยท GitHub

Summary of Changes

Hello, 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 introduces the capability to build COLMAP as shared libraries, offering an alternative to the default static library build. This change primarily benefits development workflows by potentially speeding up edit-compile-test cycles due to faster incremental linking. The build system has been updated to support this new option, and comprehensive documentation has been added to guide users on its usage and implications.

Highlights

  • Shared Library Build Option: A new CMake option, BUILD_SHARED_LIBS, has been introduced to allow users to build COLMAP as shared libraries instead of the default static libraries. This option is set to OFF by default.
  • CMake Macro Refinement: The COLMAP_ADD_LIBRARY macro in CMakeHelper.cmake has been updated to dynamically determine the library type (static or shared) based on the BUILD_SHARED_LIBS option, removing the previous hardcoded default to STATIC.
  • Documentation Update: The doc/install.rst file now includes a dedicated section on building shared libraries, outlining the command to enable the option and discussing the trade-offs between shared and static libraries (e.g., faster incremental linking vs. runtime performance).
  • GTest/GMock Linking for Shared Libraries: Special handling has been added to src/colmap/util/CMakeLists.txt to correctly link gtest and gmock when building shared libraries. This involves platform-specific linker flags (-Wl,--whole-archive, /WHOLEARCHIVE, -Wl,-force_load) to ensure all symbols are available and avoid duplicate singletons.
  • Library Dependency Adjustments: Several CMakeLists.txt files (src/colmap/retrieval, src/colmap/sensor, src/colmap/ui) have had their PUBLIC_LINK_LIBS and PRIVATE_LINK_LIBS adjusted to correctly propagate dependencies, especially in the context of shared library builds.
Changelog
  • CMakeLists.txt
    • Added BUILD_SHARED_LIBS CMake option, defaulting to OFF.
  • cmake/CMakeHelper.cmake
    • Removed explicit default to STATIC for COLMAP_ADD_LIBRARY_TYPE.
    • Modified add_library call to no longer explicitly specify STATIC type.
    • Removed the FATAL_ERROR for unknown library types.
  • doc/install.rst
    • Added a new section titled 'Shared Libraries' to the installation documentation.
    • Included instructions for enabling BUILD_SHARED_LIBS.
    • Provided a detailed comparison of trade-offs between static and shared libraries.
  • src/colmap/retrieval/CMakeLists.txt
    • Moved colmap_util, colmap_math, and colmap_feature_types from PRIVATE_LINK_LIBS to PUBLIC_LINK_LIBS.
  • src/colmap/sensor/CMakeLists.txt
    • Moved colmap_geometry and colmap_util from PRIVATE_LINK_LIBS to PUBLIC_LINK_LIBS.
  • src/colmap/ui/CMakeLists.txt
    • Added colmap_mvs to PUBLIC_LINK_LIBS.
  • src/colmap/util/CMakeLists.txt
    • Relocated target_sources for testing files to be conditional on TESTS_ENABLED.
    • Implemented conditional linking logic for gtest/gmock based on BUILD_SHARED_LIBS for colmap_util, using platform-specific whole-archive flags.
    • Adjusted colmap_gtest_main linking to include colmap_util publicly and conditionally link GTest::gmock_main for static builds.
Activity
  • No human activity (comments, reviews, etc.) has occurred on this pull request yet.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. โ†ฉ

Read the original on github.com โ†—