mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-21 23:11:01 +01:00
resolve PR comments
- pass backends from the Makefile to the CMakeLists file - add check to see if the BACKEND argument is set - add dbghelp lib file
This commit is contained in:
1 parent
747defd01b
commit
9b0607973e
2 files changed
+16
-9
No files matched your search
@@ -71,7 +71,7 @@ ffi/wgpu-remote.h: wgpu-remote/cbindgen.toml $(wildcard wgpu-native/**/*.rs wgp
|
||||
rustup run nightly cbindgen wgpu-remote >$(FFI_DIR)/wgpu-remote.h
|
||||
|
||||
examples-native: lib-native $(FFI_DIR)/wgpu.h examples/hello_triangle_c/main.c
|
||||
cd examples/hello_triangle_c && $(CREATE_BUILD_DIR) && cd build && cmake .. && make
|
||||
cd examples/hello_triangle_c && $(CREATE_BUILD_DIR) && cd build && cmake .. -DBACKEND=$(FEATURE_RUST) && make
|
||||
|
||||
examples-remote: lib-remote $(FFI_DIR)/wgpu-remote.h examples/hello_remote_c/main.c
|
||||
cd examples/hello_remote_c && $(CREATE_BUILD_DIR) && cd build && cmake .. && make
|
||||
@@ -3,20 +3,27 @@ cmake_minimum_required(VERSION 3.11b)
|
||||
project(hello_triangle)
|
||||
|
||||
set(TARGET_NAME hello_triangle)
|
||||
set(feature-native)
|
||||
|
||||
set(BACKEND_VULKAN "vulkan")
|
||||
set(BACKEND_METAL "metal")
|
||||
set(BACKEND_DX12 "dx12")
|
||||
set(AVAILABLE_BACKENDS ${BACKEND_VULKAN} ${BACKEND_METAL} ${BACKEND_DX12})
|
||||
|
||||
if(NOT DEFINED BACKEND)
|
||||
message(FATAL_ERROR "Backend has not been set, please do so by using the -DBACKEND= argument. \
|
||||
Available backends: ${AVAILABLE_BACKENDS}")
|
||||
endif()
|
||||
|
||||
add_executable(hello_triangle main.c)
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-DWGPU_TARGET=WGPU_TARGET_WINDOWS)
|
||||
target_compile_options(${TARGET_NAME} PRIVATE /W4)
|
||||
set(GLFW_LIBRARY glfw3)
|
||||
|
||||
target_link_libraries(${TARGET_NAME} userenv ws2_32 Dwmapi)
|
||||
|
||||
if ("${feature-native}" STREQUAL "dx12")
|
||||
target_link_libraries(${TARGET_NAME} d3dcompiler D3D12 DXGI)
|
||||
set(OS_LIBRARIES "userenv" "ws2_32" "Dwmapi" "dbghelp")
|
||||
if("${BACKEND}" STREQUAL "${BACKEND_DX12}")
|
||||
list(APPEND OS_LIBRARIES "d3dcompiler" "D3D12" "DXGI")
|
||||
endif()
|
||||
|
||||
elseif(APPLE)
|
||||
add_definitions(-DWGPU_TARGET=WGPU_TARGET_MACOS)
|
||||
set(OS_LIBRARIES "-framework Cocoa" "-framework CoreVideo" "-framework IOKit" "-framework QuartzCore")
|
||||
@@ -34,4 +41,4 @@ find_library(WGPU_LIBRARY wgpu_native
|
||||
HINTS "${CMAKE_CURRENT_SOURCE_DIR}/../../target/debug"
|
||||
)
|
||||
|
||||
target_link_libraries(${TARGET_NAME} ${GLFW_LIBRARY} ${WGPU_LIBRARY} ${OS_LIBRARIES})
|
||||
target_link_libraries(${TARGET_NAME} ${GLFW_LIBRARY} ${WGPU_LIBRARY} ${OS_LIBRARIES})
|
||||
Reference in new issue
Block a user