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

ew option to allow "example-common" project to not be included in build. #225

Merged
merged 3 commits into from
May 19, 2024

Conversation

JimmyLord
Copy link

I added a new option BGFX_BUILD_EXAMPLE_COMMON to allow users to opt out of the example-common project from being added to their solutions. It defaults to On to match the default for BGFX_BUILD_EXAMPLES which relies on it.

I created a new option to allow users to continue to use example-common in their project without adding the rest of the examples and to preserve the existing behaviour.

Fixes #224

@JimmyLord JimmyLord requested a review from bwrsandman as a code owner April 16, 2024 17:24
@bwrsandman
Copy link
Collaborator

Thanks for your PR.
It's missing one piece though. Example common is used in the tools (geometryc, geometryv, shaderc, texturev) etc.

I would really like to see this as a cmake_dependent_option too.

@JimmyLord
Copy link
Author

I took another look and changed the code to:

cmake_dependent_option(BGFX_BUILD_EXAMPLE_COMMON "Build bgfx example-common project." ON "NOT BGFX_BUILD_EXAMPLES;NOT BGFX_BUILD_TOOLS" ON)

Ideally, that first "ON" should be an "OFF", so if both the examples and tools were off the common project would also be off, but that would change the old behaviour. So, at the moment, people still need to explicitly disable example-common.

Which do you think is the better default?

@bwrsandman
Copy link
Collaborator

Makes sense to only compile what's needed.
I think ideally, there shouldn't be an option and cmake should figure it out.
Have you considered using EXCLUDE_FROM_ALL?

…N if either tools or examples are included in the build, OFF otherwise.
CMakeLists.txt Outdated Show resolved Hide resolved
@JimmyLord
Copy link
Author

Okay, I set it up as a dependent option that only includes example-common if either the tools or examples projects are included in the build.

This produces a minimum set of projects in the solution if those options are disabled.

@bwrsandman
Copy link
Collaborator

EXCLUDE_FROM_ALL doesn't do this for you?

@JimmyLord
Copy link
Author

Thanks, since I use visual studio for development, I can work around the issue with EXCLUDE_FROM_DEFAULT_BUILD instead, it's more or less the same option.

Even with this, I still end up with an extra project in the solution that isn't needed. It's not a big deal, but it clutters searches and file opening with files that aren't in use in the project.

@bwrsandman
Copy link
Collaborator

I see what you mean.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link
Collaborator

@bwrsandman bwrsandman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and validated it doesn't cause problems

@bwrsandman bwrsandman merged commit d7f5964 into bkaradzic:master May 19, 2024
13 checks passed
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.

examples-common project is added when BGFX_BUILD_EXAMPLES option is turned off.
2 participants