3MFConsortium / lib3mf

lib3mf is an implementation of the 3D Manufacturing Format file standard
http://3mf.io
BSD 2-Clause "Simplified" License
228 stars 92 forks source link

Improvements to CMake + Introduction of CPack based packages #346

Closed vijaiaeroastro closed 4 months ago

vijaiaeroastro commented 6 months ago

Base branch : develop (Right after the 2.3.0-alpha release)

This PR introduces significant enhancements to the CMake infrastructure of lib3mf, detailed as follows:

  1. CMake Configuration: It adds a valid CMake configuration file, lib3mfConfig.cmake, enabling the inclusion of lib3mf as a standard CMake-based C++ library.
  2. CPack Integration: The integration of CPack simplifies the structure of SDK package, which, though comprehensive, previously required additional steps like defining libraries and manually including header paths. With the use of the lib3mfConfig.cmake file, CPack facilitates the generation of CMake packages, including ready-to-install packages for Windows, Linux, and OSX, along with Debian and RPM packages for direct installation on the respective operating systems.
  3. VCPKG Foundation: This update sets the groundwork for VCPKG integration, aiming to achieve a VCPKG deployment of lib3mf, which was a primary motivation behind the CMake improvements.
codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 69.20%. Comparing base (8ceec9c) to head (5be552e).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## feature/cmake-improvements #346 +/- ## =========================================================== Coverage 69.20% 69.20% =========================================================== Files 271 271 Lines 28691 28691 =========================================================== Hits 19855 19855 Misses 8836 8836 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

martinweismann commented 6 months ago

This all looks great!

Tested on windows the CppNew and CPPDynamic new. CPPDynamic works out of the box. The CppNew example's CMakeList does not yet take care of copying over the shared library.

We will need to clearly define what the role of the old sdk will be in the future, and how the examples are made available.

vijaiaeroastro commented 6 months ago

@martinweismann In CppNew, do you expect the library to be copied over to the same location as the target binary ?

martinweismann commented 6 months ago

I think so. That would make the example run out of the box.

vijaiaeroastro commented 6 months ago

I will make the necessary changes.

vijaiaeroastro commented 5 months ago

@martinweismann The necessary CMake changes to fix VCPKG installation are included in the latest commits. For example, VCPKG requires the lib3mfConfig.cmake to be inside the share/lib3mf directory instead of the lib folder. This necessitates changes in the lib3mfConfig.cmake file, as the paths for the lib and bin directories are now different. These changes are dynamically handled in lib3mfConfig.cmake based on whether it is a VCPKG or non-VCPKG installation.