mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-14 03:11:29 +00:00
CMake updates.
This CL updates the CMake file to allow building Dawn with WGSL support enabled. A few other required fixes are included. Bug: None Change-Id: I11a09710f0ad075a07e23c44ff884826850655e7 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30841 Commit-Queue: dan sinclair <dsinclair@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
24e6369261
commit
bb3d7981ec
@ -69,6 +69,7 @@ option(DAWN_ENABLE_METAL "Enable compilation of the Metal backend" ${ENABLE_META
|
|||||||
option(DAWN_ENABLE_NULL "Enable compilation of the Null backend" ON)
|
option(DAWN_ENABLE_NULL "Enable compilation of the Null backend" ON)
|
||||||
option(DAWN_ENABLE_OPENGL "Enable compilation of the OpenGL backend" ${ENABLE_OPENGL})
|
option(DAWN_ENABLE_OPENGL "Enable compilation of the OpenGL backend" ${ENABLE_OPENGL})
|
||||||
option(DAWN_ENABLE_VULKAN "Enable compilation of the Vulkan backend" ${ENABLE_VULKAN})
|
option(DAWN_ENABLE_VULKAN "Enable compilation of the Vulkan backend" ${ENABLE_VULKAN})
|
||||||
|
option(DAWN_ENABLE_WGSL "Enable WGSL support" OFF)
|
||||||
option(DAWN_ALWAYS_ASSERT "Enable assertions on all build types" OFF)
|
option(DAWN_ALWAYS_ASSERT "Enable assertions on all build types" OFF)
|
||||||
option(DAWN_USE_X11 "Enable support for X11 surface" ${USE_X11})
|
option(DAWN_USE_X11 "Enable support for X11 surface" ${USE_X11})
|
||||||
|
|
||||||
@ -84,6 +85,7 @@ set(DAWN_SHADERC_DIR "${DAWN_THIRD_PARTY_DIR}/shaderc" CACHE STRING "Directory i
|
|||||||
set(DAWN_SPIRV_CROSS_DIR "${DAWN_THIRD_PARTY_DIR}/spirv-cross" CACHE STRING "Directory in which to find SPIRV-Cross")
|
set(DAWN_SPIRV_CROSS_DIR "${DAWN_THIRD_PARTY_DIR}/spirv-cross" CACHE STRING "Directory in which to find SPIRV-Cross")
|
||||||
set(DAWN_SPIRV_HEADERS_DIR "${DAWN_THIRD_PARTY_DIR}/spirv-headers" CACHE STRING "Directory in which to find SPIRV-Headers")
|
set(DAWN_SPIRV_HEADERS_DIR "${DAWN_THIRD_PARTY_DIR}/spirv-headers" CACHE STRING "Directory in which to find SPIRV-Headers")
|
||||||
set(DAWN_SPIRV_TOOLS_DIR "${DAWN_THIRD_PARTY_DIR}/SPIRV-Tools" CACHE STRING "Directory in which to find SPIRV-Tools")
|
set(DAWN_SPIRV_TOOLS_DIR "${DAWN_THIRD_PARTY_DIR}/SPIRV-Tools" CACHE STRING "Directory in which to find SPIRV-Tools")
|
||||||
|
set(DAWN_TINT_DIR "${DAWN_THIRD_PARTY_DIR}/tint" CACHE STRING "Directory in which to find Tint")
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Dawn's public and internal "configs"
|
# Dawn's public and internal "configs"
|
||||||
@ -123,6 +125,9 @@ endif()
|
|||||||
if (DAWN_ENABLE_VULKAN)
|
if (DAWN_ENABLE_VULKAN)
|
||||||
target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_BACKEND_VULKAN")
|
target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_BACKEND_VULKAN")
|
||||||
endif()
|
endif()
|
||||||
|
if (DAWN_ENABLE_WGSL)
|
||||||
|
target_compile_definitions(dawn_internal_config INTERFACE "-DDAWN_ENABLE_WGSL=1")
|
||||||
|
endif()
|
||||||
if (DAWN_USE_X11)
|
if (DAWN_USE_X11)
|
||||||
target_compile_definitions(dawn_internal_config INTERFACE "DAWN_USE_X11")
|
target_compile_definitions(dawn_internal_config INTERFACE "DAWN_USE_X11")
|
||||||
endif()
|
endif()
|
||||||
@ -130,7 +135,6 @@ if (WIN32)
|
|||||||
target_compile_definitions(dawn_internal_config INTERFACE "NOMINMAX" "WIN32_LEAN_AND_MEAN")
|
target_compile_definitions(dawn_internal_config INTERFACE "NOMINMAX" "WIN32_LEAN_AND_MEAN")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD "14")
|
set(CMAKE_CXX_STANDARD "14")
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -144,6 +148,8 @@ add_subdirectory(src/dawn)
|
|||||||
add_subdirectory(src/dawn_platform)
|
add_subdirectory(src/dawn_platform)
|
||||||
add_subdirectory(src/dawn_native)
|
add_subdirectory(src/dawn_native)
|
||||||
add_subdirectory(src/dawn_wire)
|
add_subdirectory(src/dawn_wire)
|
||||||
|
# TODO(dawn:269): Remove once the implementation-based swapchains are removed.
|
||||||
|
add_subdirectory(src/utils)
|
||||||
|
|
||||||
if (DAWN_BUILD_EXAMPLES)
|
if (DAWN_BUILD_EXAMPLES)
|
||||||
add_subdirectory(src/utils)
|
add_subdirectory(src/utils)
|
||||||
|
@ -25,6 +25,10 @@ if(BUILD_SHARED_LIBS)
|
|||||||
target_compile_definitions(dawn_native PRIVATE "DAWN_NATIVE_SHARED_LIBRARY")
|
target_compile_definitions(dawn_native PRIVATE "DAWN_NATIVE_SHARED_LIBRARY")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(DAWN_ENABLE_WGSL)
|
||||||
|
target_link_libraries(dawn_native PRIVATE libtint)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_sources(dawn_native PRIVATE
|
target_sources(dawn_native PRIVATE
|
||||||
"${DAWN_INCLUDE_DIR}/dawn_native/DawnNative.h"
|
"${DAWN_INCLUDE_DIR}/dawn_native/DawnNative.h"
|
||||||
"${DAWN_INCLUDE_DIR}/dawn_native/dawn_native_export.h"
|
"${DAWN_INCLUDE_DIR}/dawn_native/dawn_native_export.h"
|
||||||
@ -159,7 +163,7 @@ target_link_libraries(dawn_native
|
|||||||
spirv-cross-glsl
|
spirv-cross-glsl
|
||||||
spirv-cross-hlsl
|
spirv-cross-hlsl
|
||||||
spirv-cross-msl
|
spirv-cross-msl
|
||||||
SPIRV-Tools
|
SPIRV-Tools-opt
|
||||||
)
|
)
|
||||||
|
|
||||||
if (DAWN_USE_X11)
|
if (DAWN_USE_X11)
|
||||||
|
7
third_party/CMakeLists.txt
vendored
7
third_party/CMakeLists.txt
vendored
@ -78,6 +78,13 @@ if (DAWN_BUILD_EXAMPLES)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (DAWN_BUILD_WGSL)
|
||||||
|
if (NOT TARGET libtint)
|
||||||
|
message(STATUS "Dawn: using Tint at ${DAWN_TINT_DIR}")
|
||||||
|
add_subdirectory(${DAWN_TINT_DIR})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Header-only library for khrplatform.h
|
# Header-only library for khrplatform.h
|
||||||
add_library(dawn_khronos_platform INTERFACE)
|
add_library(dawn_khronos_platform INTERFACE)
|
||||||
target_sources(dawn_khronos_platform INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/khronos/KHR/khrplatform.h")
|
target_sources(dawn_khronos_platform INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/khronos/KHR/khrplatform.h")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user