-
Notifications
You must be signed in to change notification settings - Fork 188
/
Copy pathgpu.cmake
40 lines (34 loc) · 1.34 KB
/
gpu.cmake
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
34
35
36
37
38
39
40
set(FILENAME "gpu.hpp")
# Setup project root here.
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}")
set(PROJECT_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
else()
get_filename_component(PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
get_filename_component(PROJECT_ROOT ${PROJECT_ROOT} DIRECTORY)
set(PROJECT_ROOT "${PROJECT_ROOT}/")
endif()
message(STATUS "PROJECT_ROOT: ${PROJECT_ROOT}")
# Add sources
set(GPU_SOURCES
"${PROJECT_ROOT}/gpu.cpp"
"${PROJECT_ROOT}/numeric_types/half.cpp"
)
# Add headers
set(GPU_HEADERS
"${PROJECT_ROOT}/gpu.hpp"
"${PROJECT_ROOT}/utils/logging.hpp"
"${PROJECT_ROOT}/utils/array_utils.hpp"
"${PROJECT_ROOT}/numeric_types/half.hpp"
)
# Create the STATIC library for gpu
add_library(gpu STATIC ${GPU_SOURCES} ${GPU_HEADERS})
set_target_properties(gpu PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(gpu PUBLIC "${PROJECT_ROOT}")
if(NOT EMSCRIPTEN)
target_include_directories(gpu PUBLIC "${DAWN_BUILD_DIR}/gen/include/")
target_include_directories(gpu PUBLIC "${DAWN_BUILD_DIR}/gen/include/dawn/")
target_include_directories(gpu PUBLIC "${DAWN_DIR}/include/")
else()
target_include_directories(gpu PUBLIC "${DAWN_BUILD_DIR}/gen/src/emdawnwebgpu/include/")
target_include_directories(gpu PUBLIC "${DAWN_BUILD_DIR}/gen/src/emdawnwebgpu/include/webgpu/")
endif()