ROCm / MIOpen

AMD's Machine Intelligence Library
https://rocm.docs.amd.com/projects/MIOpen/en/latest/
Other
1.08k stars 227 forks source link

Please provide pkg-config file #2578

Open dengelt opened 11 months ago

dengelt commented 11 months ago

Issue Summary:

I would like to request the addition of pkg-config support in the project build system. Currently, the project relies on CMake for its build configuration, but having a pkg-config file would greatly enhance interoperability with other build systems and ease the integration process for downstream projects.

Description:

As an end-user, integrating projects into different build environments can sometimes be challenging. While CMake is a powerful and widely used build system, having a pkg-config file alongside it would facilitate seamless integration for developers using other build systems, such as Autotools or Meson or making FFI bindings to other languages such as Rust.

Benefits of Adding pkg-config Support:

  1. Interoperability: Developers using build systems other than CMake can easily incorporate the project into their workflows without additional manual configuration.

  2. Dependency Management: pkg-config simplifies the process of managing dependencies by providing a standardized way to query and retrieve information about installed libraries.

  3. Ease of Integration: Projects using pkg-config can be more easily integrated into various development environments, making it more accessible for a broader audience.

Suggested Implementation:

  1. Create a *.pc.in file that contains the necessary variables and information about the project.

  2. Configure the file during the build process using CMake variables to ensure dynamic values like installation paths are correctly handled.

  3. Install the generated *.pc file alongside other artifacts during the installation phase.

Example CMakeLists.txt Changes:

# ... existing CMake configuration ...

# Generate pkg-config file
configure_file(${CMAKE_SOURCE_DIR}/path/to/project.pc.in
               ${CMAKE_BINARY_DIR}/project.pc @ONLY)

# Install the generated pkg-config file
install(FILES ${CMAKE_BINARY_DIR}/project.pc
        DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

Here's another example: https://www.scivision.dev/cmake-generate-pkg-config/

Additional Notes:

Thank you for considering this enhancement request. I believe that adding pkg-config support will contribute to the project's usability and ease of adoption across various development environments.

pfultz2 commented 11 months ago

We would need support for pkgconfig in hip first before it could be implemented in miopen. Also, any generation of pkgconfig files needs to be done by rocm-cmake to ensure consistency across components.

ppanchad-amd commented 5 months ago

@dengelt Internal ticket is created for this enhancement request. Thanks!