mirror of
https://github.com/bkaradzic/bgfx.cmake.git
synced 2026-02-17 21:12:35 +01:00
Useful for packagers like pacman and vcpkg to add custom cmake logic instead of patching code.
37 lines
1.5 KiB
CMake
37 lines
1.5 KiB
CMake
@PACKAGE_INIT@
|
|
|
|
if(@BGFX_CMAKE_USER_SCRIPT_PRESENT@)
|
|
include("${CMAKE_CURRENT_LIST_DIR}/@BGFX_CMAKE_USER_SCRIPT_INSTALL_NAME@")
|
|
endif()
|
|
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
|
|
get_target_property(BGFX_INCLUDE_PATH bgfx::bgfx INTERFACE_INCLUDE_DIRECTORIES)
|
|
list(GET BGFX_INCLUDE_PATH 0 BGFX_INCLUDE_PATH_1) # bgfx::bgfx exports include directory twice?
|
|
set(BGFX_SHADER_INCLUDE_PATH ${BGFX_INCLUDE_PATH_1}/bgfx)
|
|
|
|
# If cross compiling, we need a host-compatible version of shaderc to compile shaders
|
|
if(@CMAKE_CROSSCOMPILING@)
|
|
macro(_bgfx_crosscompile_use_host_tool TOOL_NAME)
|
|
if(NOT TARGET bgfx::${TOOL_NAME})
|
|
find_program(
|
|
${TOOL_NAME}_EXECUTABLE REQUIRED
|
|
NAMES bgfx-${TOOL_NAME} ${TOOL_NAME}
|
|
PATHS /usr/bin #
|
|
${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/packages/bgfx_x64-linux/tools/bgfx
|
|
${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/packages/bgfx_x64-windows/tools/bgfx
|
|
${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/packages/bgfx_x64-osx/tools/bgfx
|
|
)
|
|
add_executable(bgfx::${TOOL_NAME} IMPORTED)
|
|
set_target_properties(bgfx::${TOOL_NAME} PROPERTIES IMPORTED_LOCATION "${${TOOL_NAME}_EXECUTABLE}")
|
|
endif()
|
|
endmacro()
|
|
|
|
_bgfx_crosscompile_use_host_tool(bin2c)
|
|
_bgfx_crosscompile_use_host_tool(shaderc)
|
|
_bgfx_crosscompile_use_host_tool(texturec)
|
|
_bgfx_crosscompile_use_host_tool(texturev)
|
|
_bgfx_crosscompile_use_host_tool(geometryv)
|
|
endif()
|
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/bgfxToolUtils.cmake")
|
|
check_required_components("@PROJECT_NAME@")
|