Package your third parties

The SolAR framework is using the meta dependencies management tool Remaken supporting Conan, VCPKG and its native C++ packaging structure based on pkg-config description files.

Remaken uses a packagedependencies.txt file defining all dependencies of your project (more information in the documentation of remaken). This file will be interpreted by the QMake build script tools used by the SolAR framework. Thus, by maintaining a simple dependency file describing the third parties used by your project, you will be able to download the dependencies, link and build you project, and install and deploy your solution with all its dependencies in a very simple way.

Let’s describe now how to package the third parties required by your module in order to be compliant with the dependency manager and the build and install pipeline used by SolAR. Two solutions are presented next: The Remaken native solution and Conan.

Remaken native solution

To create your package, you have to create the following folder structure:

DependencyName
|- DependencyVersion (X.X.X)
|-- interfaces
|--- [here your header files]
|-- lib
|--- architecture (x86_64, arm64, ...)
|---- mode (shared or static)
|----- release
|------ [your libraries here in release mode]
|----- debug
|------ [your libraries here in debug mode]
|-- remaken-DependencyName.pc
|-- packagedependencies.txt (if your Dependency requires third-parties)
|-- DependencyName-DependencyVersion_remakeninfo.txt

remaken-DependencyName.pc

This file is used by pkg-config to provide the necessary details for compilng and linking a program to a library.

If this file is not already provided with your third party, you will have to create it:

remaken-DependencyName.pc
libname=DependencyName
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/interfaces
Name: DependencyName
Description: The DependencyName library
Version: DependencyVersion
Requires:
Libs: -L${libdir} -l${libname}
Libs.private: ${libdir}/${pfx}${libname}.${lext}
Cflags: -I${includedir}

For more information concerning the syntax of this pkg-config file, you can take a look to the pkg-config guide.

packagedependencies.txt

Remaken and the SolAR build pipeline support the recursive dependency download, link, and installation. But in order to do so, your package must precise its own dependencies in the packagedependencies.txt. To know how to add a sub-dependency to your dependency, take a look to the Remaken documentation on github, or check the numerous samples of packagedependencies.txt available in the SolAR framework.

DependencyName-DependencyVersion_remakeninfo.txt

This file is specific to remaken, and define the platform, the C++ version and the runtime version used to build your dependency. This file is similar to the conaninfo.txt used by conan.

DependencyName-DependencyVersion_remakeninfo.txt
platform=win-cl-14.1
cppstd=17

Artifact Packager

When the previous files, your interfaces and you binaries are ready and well-placed in the folder structure detailed above, you can package the dependency by using the tool ArtifactPackager.

Just run the artifact packager at the root folder of your package, and it will automatically create two folders, one for the debug version and the other one for the release version, each of them containing a zip file. The name format of the created files includes the name of your dependency, its version, the supported architecture, its build mode (shared or static) as well as its configuration (debug or release). This format of package name must be respected and will be used by remaken to find the dependency required for a requested development environment.

Share your package online

In order for Remaken to find the package corresponding to the requested dependency, with the good version, for the good architecture (x86_64 or arm64), mode (share or static) and configuration (debug or release), you have to respect the following formatting rules concerning the URL to download your package: URL_root/DependencyName/version/platform/package_name.zip

Where:

  • URL_root is the URL where you host your packages. For example, for the SolAR project, most of the dependencies are stored in the releases space of the binaries repository with the following URL: https://github/SolarFramework/binaries/releases/download. This is the URL that is entered in the packagedependencies.txt file.

  • DependencyName is the name of your dependency (tinyXML, OpenCV, Ceres, G2O, etc.).

  • version with the X.X.X format.

  • platform win, linux, android, etc.

  • package_name the file name of the package created by the Artifact Packager.

On GitHub, when a new release or a new dependency is published, we respect for each release the following tag in order to respect this previous URL format: DependencyName/version/platform.

Conan

Third party packaging can quickly become tedious, especially when source package managers, such as Conan, already provide you a solution to download ready-to-use packages for a large range of popular third parties hosted on public repositories (Conan center).

To add your Conan package to your solution using Remaken, you can take a look at the Remaken documentation.