Closed JimmyLord closed 3 months ago
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.
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?
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?
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.
EXCLUDE_FROM_ALL doesn't do this for you?
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.
I see what you mean.
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 toOn
to match the default forBGFX_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