-
Notifications
You must be signed in to change notification settings - Fork 190
Build refactor + Windows #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build refactor + Windows #16
Conversation
Thanks for this effort! Appreciate the diligence on this, it's always an uphill battle keeping C++ build complexity under control. Can you think of ways to simplifying or consolidating duplicate aspects of build code between the examples? On one hand, I like self-contained examples and am fine with some duplication. However the amount of supporting code per example is increasing so it might be worth it. What do you think? |
That commit simplifies things a bit on the cmake side, not sure what to do with the makefiles. The only thing that needs to change file to file is TARGET. |
CMakeLists.txt
Outdated
add_library(gpu SHARED ${SRC_LIB}) | ||
set_target_properties(gpu PROPERTIES LINKER_LANGUAGE CXX) | ||
# Add subdirectories for examples | ||
add_subdirectory(examples/hello_world) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make a CMakeLists.txt in the examples folder and include the examples in that instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense, keep the root CMakeLists to building the library, I like that. Will handle this with the Makefile changes from Austin.
The option I lean toward might be to have one Makefile in the examples directory. Then we can also compress the repeated patterns using a default rule like this: Another option is to keep the separate Makefiles and use If you want to leave the Makefile simplification out of scope for this PR that's fine too, there's already quite a lot here. |
One Makefile in the examples folder seems like a great idea. I do not think it will be too difficult, I will experiment with some structures for it soon. Good synergy for this PR. |
We're building the library but nothing is exported yet, will scope exports for FFI usage to a new PR. Opened #17 |
Had to apt-get the following for WSL, not sure if it's worth adding to the readme.
|
Could add in a bullet in the "Quick Start: Building and Running" section after "Only on Linux systems ..." something like: "- Only on Windows WSL - Install vulkan and libx11 ..." |
endif() | ||
message(STATUS "Using WebGPU distribution tag: ${WEBGPU_TAG}") | ||
|
||
if (WEBGPU_TAG STREQUAL "dawn") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the time I think I ran into some issues trying to pin to a specific commit in the dawn branch, probably mostly due to my cmake knowledge limitations (i could get it to pin to a commit hash on main, but had issues with commit hashes on the branch).
If you know of an easy way to do it, that might be preferable for reproducibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give me a couple of tags to test with? Was this working before?
@@ -7,6 +7,10 @@ | |||
#include "gpu.h" // createContext, createTensor, createKernel, dispatchKernel, | |||
// wait, resetCommandBuffer, toCPU | |||
|
|||
#ifndef M_PI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC this is because _USE_MATH_DEFINES
is not set in MSVC builds -- maybe a better approach is to define that value as a preprocessor directive in CMakeLists and Makefile.
Some of the build targets need updating: https://github.com/AnswerDotAI/gpu.cpp/actions/runs/10002790401/job/27650314641?pr=16 |
…ept for wsl2) native branching code, provide feedback on file load failure in shadertui, minor examples build cleanups
Happy to receive feedback before merge on this build refactor and windows support addition.
libdawn_x64_Release.zip
Release build works on Windows. Only tested hello_world, will test WSL and other variants before merge.
Requesting testers for varying linux distros and MacOS.