Skip to content

Commit

Permalink
ew option to allow "example-common" project to not be included in bui…
Browse files Browse the repository at this point in the history
…ld. (#225)

* Added a new option to allow "example-common" project to not be included in build.

* Set BGFX_BUILD_EXAMPLE_COMMON as a dependent option, it will be set ON if either tools or examples are included in the build, OFF otherwise.

* cmake format

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

---------

Co-authored-by: Sandy <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored May 19, 2024
1 parent e8db646 commit d7f5964
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ cmake_dependent_option(BGFX_BUILD_TOOLS_GEOMETRY "Build bgfx geometry tools." ON
cmake_dependent_option(BGFX_BUILD_TOOLS_TEXTURE "Build bgfx texture tools." ON BGFX_BUILD_TOOLS OFF)
set(BGFX_TOOLS_PREFIX "" CACHE STRING "Prefix name to add to name of tools (to avoid clashes)")
option(BGFX_BUILD_EXAMPLES "Build bgfx examples." ON)
cmake_dependent_option(
BGFX_BUILD_EXAMPLE_COMMON "Build bgfx example-common project." OFF "NOT BGFX_BUILD_EXAMPLES;NOT BGFX_BUILD_TOOLS"
ON
)
option(BGFX_BUILD_TESTS "Build bgfx tests." OFF)
option(BGFX_INSTALL "Create installation target." ON)
cmake_dependent_option(
Expand Down
24 changes: 13 additions & 11 deletions cmake/bgfx/examples.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,19 @@ if(BGFX_CUSTOM_TARGETS)
endif()

# Add common library for examples
add_example(
common
COMMON
DIRECTORIES
${BGFX_DIR}/examples/common/debugdraw
${BGFX_DIR}/examples/common/entry
${BGFX_DIR}/examples/common/font
${BGFX_DIR}/examples/common/imgui
${BGFX_DIR}/examples/common/nanovg
${BGFX_DIR}/examples/common/ps
)
if(BGFX_BUILD_EXAMPLE_COMMON)
add_example(
common
COMMON
DIRECTORIES
${BGFX_DIR}/examples/common/debugdraw
${BGFX_DIR}/examples/common/entry
${BGFX_DIR}/examples/common/font
${BGFX_DIR}/examples/common/imgui
${BGFX_DIR}/examples/common/nanovg
${BGFX_DIR}/examples/common/ps
)
endif()

# Only add examples if set, otherwise we still need exmaples common for tools
if(BGFX_BUILD_EXAMPLES)
Expand Down

0 comments on commit d7f5964

Please sign in to comment.