blob: daac5711ca2e8c2136e7b58d74c0a8ccdaa785ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# External Dependencies and Includes
# Finds and configures external libraries (WGPU, GLFW, platform libs)
set(CORE_INCLUDES src third_party)
if(DEMO_CROSS_COMPILE_WIN32)
add_definitions(-DDEMO_CROSS_COMPILE_WIN32)
set(WINDOWS_DEPS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/windows")
set(WGPU_INCLUDE_DIR "${WINDOWS_DEPS_DIR}/include")
set(WGPU_LIBRARY "${WINDOWS_DEPS_DIR}/lib/libwgpu_native.dll.a")
set(GLFW3_INCLUDE_DIR "${WINDOWS_DEPS_DIR}/include")
set(GLFW3_LIBRARY "${WINDOWS_DEPS_DIR}/lib/libglfw3.a")
list(APPEND CORE_INCLUDES ${WGPU_INCLUDE_DIR} ${WGPU_INCLUDE_DIR}/webgpu ${GLFW3_INCLUDE_DIR})
set(DEMO_LIBS ${GLFW3_LIBRARY} ${WGPU_LIBRARY} -lgdi32 -lws2_32 -luser32 -lkernel32 -lshell32 -ladvapi32 -ldwmapi)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
else()
find_library(WGPU_LIBRARY NAMES wgpu_native libwgpu_native REQUIRED)
find_path(WGPU_ROOT_INCLUDE_DIR NAMES wgpu.h REQUIRED)
list(APPEND CORE_INCLUDES ${WGPU_ROOT_INCLUDE_DIR} ${WGPU_ROOT_INCLUDE_DIR}/webgpu-headers)
find_package(glfw3 REQUIRED)
set(DEMO_LIBS glfw ${WGPU_LIBRARY})
endif()
list(APPEND CORE_INCLUDES third_party/glfw3webgpu)
include_directories(${CORE_INCLUDES})
if(APPLE)
set_source_files_properties(src/platform/platform.cc third_party/glfw3webgpu/glfw3webgpu.c PROPERTIES COMPILE_FLAGS "-x objective-c++")
list(APPEND DEMO_LIBS "-framework Metal" "-framework Foundation" "-framework Cocoa" "-framework QuartzCore")
elseif(NOT DEMO_CROSS_COMPILE_WIN32)
list(APPEND DEMO_LIBS pthread m dl)
endif()
|