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

Dynamic Runtime Samples #490

Merged
merged 9 commits into from
Nov 21, 2022

Conversation

TomAtkinsonArm
Copy link
Contributor

@TomAtkinsonArm TomAtkinsonArm commented Jul 8, 2022

Description

There is a high chance that we want to reuse cross platform components in many executables. CUSTOM_MAIN aims to reduce duplication of a cross platform main.

CUSTOM_MAIN(context)
{
	// _default is a temporary pattern, this is likely to be replaced in the future

	auto window = windows::_default(context, "A Window");        // < window platform default
	auto fs     = vfs::_default(context);                        // < virtual fs platform default
	auto camera = cameras::_default(context);                    // < get a devices camera AR?
}

Adds sample_main(context). Works similar to a normal main function except it hides the cross platform support.

The minimum code needed for a sample is

#include "components/platform/sample_main.hpp"

#include <iostream>

int sample_main(const components::PlatformContext *context)
{
	return true;
}

Later a Sample Launcher will read library paths and sample info from a JSON file. Allow the user to select a sample to run and then run the sample by loading the dynamic library and calling sample_main. We can extend this to allow for CLI configuration and more.

@TomAtkinsonArm
Copy link
Contributor Author

Closed #488 as this PR includes its changes. Updated description

@TomAtkinsonArm TomAtkinsonArm merged commit 1ac55c6 into KhronosGroup:framework/v2.0 Nov 21, 2022
@tomadamatkinson tomadamatkinson mentioned this pull request May 29, 2024
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework This is relevant to the framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants