Skip to content

Commit

Permalink
always run _bgfx_crosscompile_use_host_tool
Browse files Browse the repository at this point in the history
  • Loading branch information
bwrsandman committed Jul 16, 2023
1 parent b3dae62 commit 560dcb2
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions cmake/Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,26 @@ list(GET BGFX_INCLUDE_PATH 0 BGFX_INCLUDE_PATH_1) # bgfx::bgfx exports include d
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
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()
macro(_bgfx_crosscompile_use_host_tool TOOL_NAME)
if(NOT TARGET bgfx::${TOOL_NAME})
find_program(
${TOOL_NAME}_EXECUTABLE
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(texturec)
_bgfx_crosscompile_use_host_tool(shaderc)
_bgfx_crosscompile_use_host_tool(texturev)
_bgfx_crosscompile_use_host_tool(geometryv)
endif()
_bgfx_crosscompile_use_host_tool(bin2c)
_bgfx_crosscompile_use_host_tool(texturec)
_bgfx_crosscompile_use_host_tool(shaderc)
_bgfx_crosscompile_use_host_tool(texturev)
_bgfx_crosscompile_use_host_tool(geometryv)

include("${CMAKE_CURRENT_LIST_DIR}/bgfxToolUtils.cmake")
check_required_components("@PROJECT_NAME@")

0 comments on commit 560dcb2

Please sign in to comment.