Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using all pipeline nodes from a single executable #1208

Closed
wants to merge 6 commits into from

Conversation

p12tic
Copy link
Contributor

@p12tic p12tic commented Aug 26, 2022

This will make it possible to compile the reusable parts of the executables once and then link into whatever destination needed, be it a part of user application, a standalone executable or a shared library.

Ability to not require usage of multiple executables is especially important on certain mobile platforms where this is not supported.

The idea behind the implementation is relatively simple: all aliceVision executables are compiled through a single CMake function (alicevision_add_software) and all entry points of these executables are already named as aliceVision_main. If alicevision_add_software is modified to compile the reusable code as a static library and redefine aliceVision_main to a unique symbol, then all of such static libraries can be easily combined into a single executable.

The current solution is the minimal one and the most simple one (whole PR is only around a hundred of lines). Going into the future we can expose the pipeline nodes better and provide more user-friendly API.

Many of the samples implement parts of the pipeline, so it makes sense
to use the same aliceVision_main() API as for the rest of pipeline
nodes.
Many of the samples implement parts of the pipeline, so it makes sense
to use the same aliceVision_main() API as for the rest of pipeline
nodes.
Currently main() of the executables defined in the project resides in
aliceVision/system/main.hpp file which is #included into each of the
executables. This makes it impossible to compile the executable code as
a static library.

Injecting main() exclusively via CMake avoids this problem.
This will make it possible to compile the reusable parts of the
executables once and then link into whatever destination needed, be it a
part of user application, a standalone executable or a shared library.
This will make it possible to link multiple pipeline nodes into a single
executable.
This ensures that we accidentally don't create two static libraries with
duplicate symbols. In any duplicate symbols should be hidden by using
unnamed namespaces or `static`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant