openframeworks / apothecary

This is the OpenFrameworks library apothecary. It mixes formulas and potions to build and update the C/C++ lib dependencies.
Other
57 stars 52 forks source link

[CMake/pkgconfig] Adding generated install defines to libs folders #405

Open danoli3 opened 4 months ago

danoli3 commented 4 months ago

[CMake/pkgconfig]

To support the future of openFrameworks.

Deploying these assistive library files alongside the binaries allows for easy to link, bind and compile with CMake / PKGconfig and allows for easy versioning alongside now the Apple PKL formats describing the binaries and variant defines for those binaries.

This solves many linking issues in the build processes as these files contain all the info required by the build systems like versions and locations.

Generated files from build system:

Currently the paths are like so:

$1/lib/$PLATFORM/$ARCH/pkgconfig/*pc $1/lib/$PLATFORM/$ARCH/cmake/cmake_install.cmake

Another location could be directly in the location of libraries like the PKL files are currently - depending on further analysis of how many files are generated
like: $1/lib/$PLATFORM/$ARCH/cmake_install.cmake $1/lib/$PLATFORM/$ARCH/zlib.pc

For xcFrameworks this would be within target for each platform:

image
danoli3 commented 4 months ago

Example unedited: PKGConfig file:

prefix=/Users/one/SOURCE/apothecary/apothecary/build/libpng/build_osx_MAC_ARM64/Release
exec_prefix=/Users/one/SOURCE/apothecary/apothecary/build/libpng/build_osx_MAC_ARM64/Release
libdir=/Users/one/SOURCE/apothecary/apothecary/build/libpng/build_osx_MAC_ARM64/Release/lib
includedir=/Users/one/SOURCE/apothecary/apothecary/build/libpng/build_osx_MAC_ARM64/Release/include/libpng16

Name: libpng
Description: Loads and saves PNG files
Version: 1.6.41
Requires.private: zlib
Libs: -L${libdir} -lpng16
Libs.private: -lz -lm
Cflags: -I${includedir}

Patched to be shipped:

prefix=../../../
exec_prefix=../../../
libdir=../
includedir=../../../include/libpng16

Name: libpng
Description: Loads and saves PNG files
Version: 1.6.41
Requires.private: zlib
Libs: -L${libdir} -lpng16
Libs.private: -lz -lm
Cflags: -I${includedir}

CMake files (sometimes seperate with Versions) - hence folder good idea

image