Created
June 27, 2024 12:23
-
-
Save wcandillon/d22b3c5852accc3f69571d6607a57e6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.22.1) | |
cmake_policy(SET CMP0048 NEW) | |
project(webgpu VERSION 1.1.0 LANGUAGES CXX) | |
include(${CMAKE_CURRENT_LIST_DIR}/BundleLibraries.cmake) | |
set(DAWN_BUILD_ANDROID_SAMPLES OFF) | |
set(DAWN_BUILD_SAMPLES OFF) | |
set(TINT_BUILD_TESTS OFF) | |
set(TINT_BUILD_CMD_TOOLS OFF) | |
add_subdirectory(../../../externals/dawn/ dawn) | |
add_library(native_dawn main.cpp) | |
target_link_libraries(native_dawn webgpu_dawn) | |
bundle_libraries(webgpu_c_bundled native_dawn) | |
if(ANDROID) | |
find_library(log-lib log) | |
target_link_libraries(webgpu_c_bundled ${log-lib} android) | |
elseif(IOS) | |
target_link_libraries(webgpu_c_bundled "-framework CoreFoundation" "-framework IOSurface" "-framework Metal" "-framework QuartzCore" "-framework Foundation") | |
endif() |
Thank you so much for taking the time to look at it 🙏
- This sounds like a good approach, I simply copy paste it from tools/android/.../CMakeLists.txt
- This is very likely, I was using chromium/6539
- The plan is to offer only
wgpu
namespace. Does that mean that I may need to take a different approach?
The plan is to offer only wgpu namespace. Does that mean that I may need to take a different approach?
Hmm. Then you likely need to export the symbols from the bundle. I guess in android it doesn't matter, but you could run into issues on mac.
target_compile_definitions(webgpu_dawn PRIVATE "WGPU_IMPLEMENTATION")
target_compile_definitions(webgpu_dawn PUBLIC "WGPU_SHARED_LIBRARY")
yes that 100% correct, how did you know 😅
ran into various problems after i changed dawn to hide symbols by default.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, i've some questions to get an understanding of where you'd want to take this:
Any reason to link with
webgpu_dawn
instead ofdawn_native
directly and compile${WEBGPU_DAWN_NATIVE_PROC_GEN_SOURCES}
?Is this still required?
dawn/common/CMakeLists.txt
was updated to do the right thing in https://dawn-review.googlesource.com/c/dawn/+/194917wgpu
functions from the bundle or do you plan to expose even the public facing classes indawn::native
anddawn::wire
namespace?