microprofile icon indicating copy to clipboard operation
microprofile copied to clipboard

Fixes and improvements: build with meson and versioning

Open romeoxbm opened this issue 1 year ago • 0 comments

This pull request addresses several issues and improvements related to the meson build system and versioning. The following changes have been made:

  1. Set project version in meson.build: The project version has been updated to '5.0' in the meson.build file. This adjustment allows dependent projects to specify the desired version of the microprofile dependency they intend to use. Previously, not setting the version would result in an error message like:

    Dependency microprofile found: NO found undefined but need: '5.0' (overridden)
    ERROR: Dependency 'microprofile' is required but not found.
    

    Note: If the next upcoming release is not version 5.0, I can adjust the version accordingly before merging.

  2. Export symbols: In the previous build setup, symbols were not exported when building microprofile with meson. This pull request fixes the issue. Previously, the project relied on CMake's GenerateExportHeader to generate the export header file when building with CMake, while no such thing was done with meson. In this update, I've defined MICROPROFILE_API in the microprofile main header file, along with MICROPROFILE_EXPORT and MICROPROFILE_IMPORT, to ensure proper symbol exporting. This change enables both CMake and meson to correctly define MICROPROFILE_EXPORT_SYMBOLS and MICROPROFILE_SHARED macros when necessary;

  3. Improved subproject handling and pkg-config generation: The meson.build script now includes logic to detect whether the project is being used as a subproject. In case it is, this change prevents the installation of microprofile's headers and libraries. Additionally, the .pc (pkg-config) file is now generated only when microprofile is not used as a subproject. However, I understand there may be some use cases when one may want to install microprofile, even when it's used as a subproject, so I'm open to discussing any potential extension/improvement.

EDIT: I decided it's probably better for the user to be able to choose if the library should be installed or not, so I've added a new option called install (set by default to false).

Thank you for considering this pull request. Your feedback is highly appreciated, and I'm open to any further adjustments or modifications required for the seamless integration of these changes into the microprofile project.

romeoxbm avatar Aug 29 '23 06:08 romeoxbm