mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 16:24:24 +00:00
5ca57374f6
PowerPreference::Default will now prefer discrete GPUs when on AC power and will prefer integrated GPUs while on battery power (i.e. the battery is discharging).
35 lines
1.2 KiB
CMake
35 lines
1.2 KiB
CMake
cmake_minimum_required(VERSION 3.11b)
|
|
|
|
project(compute)
|
|
|
|
set(TARGET_NAME compute)
|
|
|
|
add_executable(compute 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" "setupapi")
|
|
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})
|