mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 06:21:13 +01:00
This PR removes optional backend features in favor of run-time selection at the `request_adapter` entry point. Adapters from all supported gpu backends on the platform are reported. It also makes gfx-rs dependency to be public (for now).
35 lines
1.2 KiB
CMake
35 lines
1.2 KiB
CMake
cmake_minimum_required(VERSION 3.11b)
|
|
|
|
project(triangle)
|
|
|
|
set(TARGET_NAME triangle)
|
|
|
|
add_executable(triangle main.c ../framework.c)
|
|
|
|
if(MSVC)
|
|
add_definitions(-DWGPU_TARGET=WGPU_TARGET_WINDOWS)
|
|
target_compile_options(${TARGET_NAME} PRIVATE /W4)
|
|
set(OS_LIBRARIES "userenv" "ws2_32" "Dwmapi" "dbghelp" "d3dcompiler" "D3D12" "D3D11" "DXGI")
|
|
elseif(APPLE)
|
|
add_definitions(-DWGPU_TARGET=WGPU_TARGET_MACOS)
|
|
set(OS_LIBRARIES "-framework Cocoa" "-framework CoreVideo" "-framework IOKit" "-framework QuartzCore")
|
|
target_compile_options(${TARGET_NAME} PRIVATE -x objective-c)
|
|
else(MSVC)
|
|
add_definitions(-DWGPU_TARGET=WGPU_TARGET_LINUX)
|
|
target_compile_options(${TARGET_NAME} PRIVATE -Wall -Wextra -pedantic)
|
|
endif(MSVC)
|
|
|
|
find_package(glfw3 3.3 REQUIRED
|
|
HINTS "$ENV{GLFW3_INSTALL_DIR}"
|
|
)
|
|
|
|
find_library(WGPU_LIBRARY wgpu_native
|
|
HINTS "${CMAKE_CURRENT_SOURCE_DIR}/../../target/debug"
|
|
)
|
|
|
|
target_include_directories(${TARGET_NAME} PUBLIC $ENV{GLFW3_INCLUDE_DIR})
|
|
target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../ffi)
|
|
target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)
|
|
|
|
target_link_libraries(${TARGET_NAME} glfw ${WGPU_LIBRARY} ${OS_LIBRARIES})
|