Skip to content

Commit 1b944a6

Browse files
authored
webgpu: fix two things wrt linux build (#8881)
- Added an explicit link flag for libxcb in backend/CMakeLists.txt - Made a string func inline, otherwise we'd get duplicate definition error during linking. FIXES=419788369
1 parent 318a900 commit 1b944a6

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

filament/backend/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,11 +505,20 @@ if (FILAMENT_SUPPORTS_WEBGPU)
505505
target_compile_definitions(${TARGET} PRIVATE $<$<BOOL:${FILAMENT_WEBGPU_IMMEDIATE_ERROR_HANDLING}>:FILAMENT_WEBGPU_IMMEDIATE_ERROR_HANDLING>)
506506
endif()
507507

508+
# ==================================================================================================
509+
# Linker flags
510+
# ==================================================================================================
511+
508512
target_link_libraries(${TARGET} PRIVATE
509-
${OSMESA_LINKER_FLAGS}
510513
$<$<AND:$<PLATFORM_ID:Linux>,$<CONFIG:Release>>:${LINUX_LINKER_OPTIMIZATION_FLAGS}>
511514
)
512515

516+
if (LINUX AND FILAMENT_SUPPORTS_WEBGPU)
517+
# Unclear why this needs to be explicit while other linux libs do not, but it is necessary for
518+
# WebGPU to build on linux.
519+
target_link_libraries(${TARGET} PRIVATE -lxcb)
520+
endif()
521+
513522
# ==================================================================================================
514523
# Installation
515524
# ==================================================================================================

filament/backend/src/webgpu/WebGPUStrings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ template<typename WebGPUPrintable>
101101
return out.str();
102102
}
103103

104-
[[nodiscard]] std::string adapterInfoToString(wgpu::AdapterInfo const& info) {
104+
[[nodiscard]] inline std::string adapterInfoToString(wgpu::AdapterInfo const& info) {
105105
std::stringstream out;
106106
out << "vendor (" << info.vendorID << ") '" << info.vendor
107107
<< "' device (" << info.deviceID << ") '" << info.device

0 commit comments

Comments
 (0)