https://github.com/ami-iit/reloc-cpp

Cross-platform CMake/C++ library to get the installation prefix of shared library in a relocatable way.

https://github.com/ami-iit/reloc-cpp

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.8%) to scientific vocabulary

Keywords

binreloc cmake cpp cxx relocatability relocatable relocation
Last synced: 5 months ago · JSON representation

Repository

Cross-platform CMake/C++ library to get the installation prefix of shared library in a relocatable way.

Basic Info
  • Host: GitHub
  • Owner: ami-iit
  • License: bsd-3-clause
  • Language: CMake
  • Default Branch: main
  • Homepage:
  • Size: 21.5 KB
Statistics
  • Stars: 17
  • Watchers: 3
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Topics
binreloc cmake cpp cxx relocatability relocatable relocation
Created over 3 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License

README.md

reloc-cpp

CMake/C++ library to get the installation prefix of a shared library in a relocatable way.

In a nutshell, it permits to avoid the need to hardcode the location of CMAKE_INSTALL_PREFIX in a shared library if you need it to localize other resources installed with the package. This permits to easily move the installation prefix in a location different from CMAKE_INSTALL_PREFIX after the installation (i.e. making it a relocatable installation), as long as the library is compiled as shared. This is useful when the C++ shared library is packaged in package managers that create the package with a given CMAKE_INSTALL_PREFIX and install it with a different prefix, such as conda, vcpkg or conan.

In the case that the library is compiled as static, reloc-cpp will fall back to hardcode CMAKE_INSTALL_PREFIX in the library.

reloc-cpp requires the use of C++ 17 or any later version.

Installation

FetchContent

~~~cmake include(FetchContent) FetchContentDeclare( reloc-cpp GITREPOSITORY https://github.com/ami-iit/reloc-cpp.git GIT_TAG v0.1.0 )

FetchContent_MakeAvailable(reloc-cpp) ~~~

Usage

In your CMake build system you can use reloc-cpp as:

```cmake add_library(yourLibrary)

...

reloccppgenerate(yourLibrary GENERATEDHEADER ${CMAKECURRENTBINARYDIR}/yourLibrarygetInstallPrefix.h GENERATEDFUNCTION yourLibrary::getInstallPrefix) ```

then, you can use it in C++ as:

~~~cpp

include

// This return the value corresponding to CMAKEINSTALLPREFIX std::string installPrefix = yourLibrary::getInstallPrefix().value(); ~~~

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

References

References that were useful as inspiration when developing reloc-cpp: * "Helping C/C++ Packages be Relocatable" presentation * Resourceful: Techniques for installing and accessing resource files using C++ and Python. * "Qt is relocatable" blog post * binreloc: Library for creating relocatable software

Resources that could be useful as an alternative to reloc-cpp: * cmrc: A Resource Compiler in a Single CMake Script

License

BSD-3-Clause

Owner

  • Name: Artificial and Mechanical Intelligence
  • Login: ami-iit
  • Kind: organization
  • Location: Italy

GitHub Events

Total
  • Push event: 2
  • Pull request event: 4
  • Create event: 3
Last Year
  • Push event: 2
  • Pull request event: 4
  • Create event: 3

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 6
  • Total Committers: 1
  • Avg Commits per committer: 6.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 2
  • Committers: 1
  • Avg Commits per committer: 2.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Silvio Traversaro s****o@t****t 6
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 8 months ago

All Time
  • Total issues: 0
  • Total pull requests: 5
  • Average time to close issues: N/A
  • Average time to close pull requests: 1 day
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: 3 days
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • traversaro (7)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/conda-forge-ci.yml actions
  • actions/checkout v2 composite
  • conda-incubator/setup-miniconda v3 composite