mirror of
https://github.com/bkaradzic/bgfx.cmake.git
synced 2026-02-17 21:12:35 +01:00
tools: Use dependent options
This commit is contained in:
@@ -26,18 +26,22 @@ if(MSVC AND (MSVC_VERSION GREATER_EQUAL 1914))
|
||||
add_compile_options("/Zc:__cplusplus")
|
||||
endif()
|
||||
|
||||
include(CMakeDependentOption)
|
||||
|
||||
option(BX_AMALGAMATED "Amalgamated bx build for faster compilation" OFF)
|
||||
option(BX_CONFIG_DEBUG "Log debug messages (default: on in debug)" OFF)
|
||||
option(BGFX_AMALGAMATED "Amalgamated bgfx build for faster compilation" OFF)
|
||||
option(BGFX_BUILD_TOOLS "Build bgfx tools." ON)
|
||||
option(BGFX_BUILD_TOOLS_BIN2C "Build bx binary to c converter." ON)
|
||||
option(BGFX_BUILD_TOOLS_SHADER "Build bgfx shader tools." ON)
|
||||
option(BGFX_BUILD_TOOLS_GEOMETRY "Build bgfx geometry tools." ON)
|
||||
option(BGFX_BUILD_TOOLS_TEXTURE "Build bgfx texture tools." ON)
|
||||
cmake_dependent_option(BGFX_BUILD_TOOLS_BIN2C "Build bx binary to c converter." ON BGFX_BUILD_TOOLS OFF)
|
||||
cmake_dependent_option(BGFX_BUILD_TOOLS_SHADER "Build bgfx shader tools." ON BGFX_BUILD_TOOLS OFF)
|
||||
cmake_dependent_option(BGFX_BUILD_TOOLS_GEOMETRY "Build bgfx geometry tools." ON BGFX_BUILD_TOOLS OFF)
|
||||
cmake_dependent_option(BGFX_BUILD_TOOLS_TEXTURE "Build bgfx texture tools." ON BGFX_BUILD_TOOLS OFF)
|
||||
option(BGFX_BUILD_EXAMPLES "Build bgfx examples." ON)
|
||||
option(BGFX_BUILD_TESTS "Build bgfx tests." OFF)
|
||||
option(BGFX_INSTALL "Create installation target." ON)
|
||||
option(BGFX_INSTALL_EXAMPLES "Install examples and their runtimes." OFF)
|
||||
cmake_dependent_option(
|
||||
BGFX_INSTALL_EXAMPLES "Install examples and their runtimes." OFF "BGFX_INSTALL;BGFX_BUILD_EXAMPLES" OFF
|
||||
)
|
||||
option(BGFX_CUSTOM_TARGETS "Include convenience custom targets." ON)
|
||||
option(BGFX_CONFIG_MULTITHREADED "Build bgfx with multithreaded configuration" ON)
|
||||
option(BGFX_CONFIG_RENDERER_WEBGPU "Enable the webgpu renderer" OFF)
|
||||
@@ -201,21 +205,19 @@ if(BGFX_INSTALL)
|
||||
install(FILES ${BGFX_CMAKE_USER_SCRIPT} DESTINATION "${config_install_dir}")
|
||||
endif()
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/bgfxToolUtils.cmake DESTINATION "${config_install_dir}")
|
||||
if(BGFX_BUILD_TOOLS)
|
||||
if(BGFX_BUILD_TOOLS_BIN2C)
|
||||
install(TARGETS bin2c EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
if(BGFX_BUILD_TOOLS_SHADER)
|
||||
install(TARGETS shaderc EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
if(BGFX_BUILD_TOOLS_GEOMETRY)
|
||||
install(TARGETS geometryc EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
install(TARGETS geometryv EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
if(BGFX_BUILD_TOOLS_TEXTURE)
|
||||
install(TARGETS texturec EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
install(TARGETS texturev EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
if(BGFX_BUILD_TOOLS_BIN2C)
|
||||
install(TARGETS bin2c EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
if(BGFX_BUILD_TOOLS_SHADER)
|
||||
install(TARGETS shaderc EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
if(BGFX_BUILD_TOOLS_GEOMETRY)
|
||||
install(TARGETS geometryc EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
install(TARGETS geometryv EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
if(BGFX_BUILD_TOOLS_TEXTURE)
|
||||
install(TARGETS texturec EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
install(TARGETS texturev EXPORT "${TARGETS_EXPORT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
|
||||
# install examples
|
||||
|
||||
@@ -26,7 +26,7 @@ target_link_libraries(geometryc PRIVATE bx bgfx-vertexlayout ${MESHOPTIMIZER_LIB
|
||||
target_compile_definitions(geometryc PRIVATE "-D_CRT_SECURE_NO_WARNINGS")
|
||||
set_target_properties(geometryc PROPERTIES FOLDER "bgfx/tools")
|
||||
|
||||
if(BGFX_BUILD_TOOLS AND BGFX_CUSTOM_TARGETS)
|
||||
if(BGFX_BUILD_TOOLS_GEOMETRY AND BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools geometryc)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ target_sources(geometryv PRIVATE ${GEOMETRYV_SOURCES})
|
||||
target_link_libraries(geometryv example-common)
|
||||
set_target_properties(geometryv PROPERTIES FOLDER "bgfx/tools")
|
||||
|
||||
if(BGFX_BUILD_TOOLS AND BGFX_CUSTOM_TARGETS)
|
||||
if(BGFX_BUILD_TOOLS_GEOMETRY AND BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools geometryv)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ target_sources(shaderc PRIVATE ${SHADERC_SOURCES})
|
||||
|
||||
set_target_properties(geometryc PROPERTIES FOLDER "bgfx/tools")
|
||||
|
||||
if(BGFX_BUILD_TOOLS AND BGFX_CUSTOM_TARGETS)
|
||||
if(BGFX_BUILD_TOOLS_SHADER AND BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools shaderc)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ target_sources(texturev PRIVATE ${TEXTUREV_SOURCES})
|
||||
target_link_libraries(texturev PRIVATE example-common)
|
||||
set_target_properties(texturev PROPERTIES FOLDER "bgfx/tools")
|
||||
|
||||
if(BGFX_BUILD_TOOLS AND BGFX_CUSTOM_TARGETS)
|
||||
if(BGFX_BUILD_TOOLS_TEXTURE AND BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools texturev)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ target_sources(texturec PRIVATE ${TEXTUREC_SOURCES})
|
||||
target_link_libraries(texturec PRIVATE bimg_decode bimg_encode bimg)
|
||||
set_target_properties(texturec PROPERTIES FOLDER "bgfx/tools")
|
||||
|
||||
if(BGFX_BUILD_TOOLS AND BGFX_CUSTOM_TARGETS)
|
||||
if(BGFX_BUILD_TOOLS_TEXTURE AND BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools texturec)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ target_sources(bin2c PRIVATE ${BIN2C_SOURCES})
|
||||
target_link_libraries(bin2c PRIVATE bx)
|
||||
set_target_properties(bin2c PROPERTIES FOLDER "bgfx/tools")
|
||||
|
||||
if(BGFX_BUILD_TOOLS AND BGFX_CUSTOM_TARGETS)
|
||||
if(BGFX_BUILD_TOOLS_BIN2C AND BGFX_CUSTOM_TARGETS)
|
||||
add_dependencies(tools bin2c)
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user