Corentin Wallez | 7fe6efb | 2020-02-05 17:16:05 +0000 | [diff] [blame] | 1 | # Copyright 2020 The Dawn Authors |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
Aleksi Sapon | 9a10674 | 2021-09-28 16:48:01 +0000 | [diff] [blame] | 15 | # Don't build testing in third_party dependencies |
| 16 | set(BUILD_TESTING OFF) |
| 17 | |
Corentin Wallez | 7fe6efb | 2020-02-05 17:16:05 +0000 | [diff] [blame] | 18 | if (NOT TARGET SPIRV-Headers) |
Corentin Wallez | 42450c6 | 2020-04-10 17:04:31 +0000 | [diff] [blame] | 19 | set(SPIRV_HEADERS_SKIP_EXAMPLES ON CACHE BOOL "" FORCE) |
| 20 | set(SPIRV_HEADERS_SKIP_INSTALL ON CACHE BOOL "" FORCE) |
Corentin Wallez | 7fe6efb | 2020-02-05 17:16:05 +0000 | [diff] [blame] | 21 | |
| 22 | message(STATUS "Dawn: using SPIRV-Headers at ${DAWN_SPIRV_HEADERS_DIR}") |
Aleksi Sapon | 9a10674 | 2021-09-28 16:48:01 +0000 | [diff] [blame] | 23 | add_subdirectory(${DAWN_SPIRV_HEADERS_DIR} "${CMAKE_CURRENT_BINARY_DIR}/spirv-headers") |
Corentin Wallez | 7fe6efb | 2020-02-05 17:16:05 +0000 | [diff] [blame] | 24 | endif() |
| 25 | |
| 26 | if (NOT TARGET SPIRV-Tools) |
Corentin Wallez | 42450c6 | 2020-04-10 17:04:31 +0000 | [diff] [blame] | 27 | set(SPIRV_SKIP_TESTS ON CACHE BOOL "" FORCE) |
| 28 | set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "" FORCE) |
| 29 | set(SKIP_SPIRV_TOOLS_INSTALL ON CACHE BOOL "" FORCE) |
Corentin Wallez | 7fe6efb | 2020-02-05 17:16:05 +0000 | [diff] [blame] | 30 | |
| 31 | message(STATUS "Dawn: using SPIRV-Tools at ${DAWN_SPIRV_TOOLS_DIR}") |
Aleksi Sapon | 9a10674 | 2021-09-28 16:48:01 +0000 | [diff] [blame] | 32 | add_subdirectory(${DAWN_SPIRV_TOOLS_DIR} "${CMAKE_CURRENT_BINARY_DIR}/spirv-tools") |
Corentin Wallez | 7fe6efb | 2020-02-05 17:16:05 +0000 | [diff] [blame] | 33 | endif() |
| 34 | |
Alexander Vestin | f2556ab | 2022-03-25 13:18:46 +0000 | [diff] [blame] | 35 | if (NOT TARGET glfw AND DAWN_SUPPORTS_GLFW_FOR_WINDOWING) |
Ben Clayton | 0ecd67a | 2021-09-23 20:13:53 +0000 | [diff] [blame] | 36 | set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) |
| 37 | set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) |
| 38 | set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) |
| 39 | |
| 40 | message(STATUS "Dawn: using GLFW at ${DAWN_GLFW_DIR}") |
Aleksi Sapon | 9a10674 | 2021-09-28 16:48:01 +0000 | [diff] [blame] | 41 | add_subdirectory(${DAWN_GLFW_DIR} "${CMAKE_CURRENT_BINARY_DIR}/glfw") |
Ben Clayton | 0ecd67a | 2021-09-23 20:13:53 +0000 | [diff] [blame] | 42 | endif() |
| 43 | |
Corentin Wallez | a943919 | 2021-03-22 21:23:36 +0000 | [diff] [blame] | 44 | if (NOT TARGET libtint) |
| 45 | message(STATUS "Dawn: using Tint at ${DAWN_TINT_DIR}") |
Stephen White | 25b3ed1 | 2022-02-08 15:32:00 +0000 | [diff] [blame] | 46 | set(TINT_BUILD_GLSL_WRITER ON) |
| 47 | # Don't build the samples because they require glslang and Dawn does not |
| 48 | # provide this third_party dependency. |
| 49 | set(TINT_BUILD_SAMPLES OFF) |
James Price | 38197e7 | 2022-01-11 16:34:55 +0000 | [diff] [blame] | 50 | # TODO(crbug.com/tint/455): Tint does not currently build with CMake when |
| 51 | # BUILD_SHARED_LIBS=1, so always build it as static for now. |
| 52 | set(BUILD_SHARED_LIBS_SAVED ${BUILD_SHARED_LIBS}) |
| 53 | set(BUILD_SHARED_LIBS 0) |
Aleksi Sapon | 9a10674 | 2021-09-28 16:48:01 +0000 | [diff] [blame] | 54 | add_subdirectory(${DAWN_TINT_DIR} "${CMAKE_CURRENT_BINARY_DIR}/tint") |
James Price | 38197e7 | 2022-01-11 16:34:55 +0000 | [diff] [blame] | 55 | set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_SAVED}) |
dan sinclair | bb3d798 | 2020-10-23 13:10:20 +0000 | [diff] [blame] | 56 | endif() |
| 57 | |
Brandon Jones | a04663c | 2021-09-23 20:36:03 +0000 | [diff] [blame] | 58 | if (NOT TARGET libabsl) |
| 59 | message(STATUS "Dawn: using Abseil at ${DAWN_ABSEIL_DIR}") |
Aleksi Sapon | 9a10674 | 2021-09-28 16:48:01 +0000 | [diff] [blame] | 60 | add_subdirectory(${DAWN_ABSEIL_DIR} "${CMAKE_CURRENT_BINARY_DIR}/abseil") |
Brandon Jones | a04663c | 2021-09-23 20:36:03 +0000 | [diff] [blame] | 61 | endif() |
| 62 | |
Corentin Wallez | 215b537 | 2020-02-15 00:39:13 +0000 | [diff] [blame] | 63 | # Header-only library for khrplatform.h |
| 64 | add_library(dawn_khronos_platform INTERFACE) |
dan sinclair | ecd46ab | 2020-10-20 17:43:00 +0000 | [diff] [blame] | 65 | target_sources(dawn_khronos_platform INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/khronos/KHR/khrplatform.h") |
| 66 | target_include_directories(dawn_khronos_platform INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/khronos") |
Corentin Wallez | d353ca0 | 2020-02-18 02:12:35 +0000 | [diff] [blame] | 67 | |
| 68 | # Header-only library for Vulkan headers |
| 69 | add_library(dawn_vulkan_headers INTERFACE) |
| 70 | target_sources(dawn_vulkan_headers INTERFACE |
dan sinclair | ecd46ab | 2020-10-20 17:43:00 +0000 | [diff] [blame] | 71 | "${CMAKE_CURRENT_SOURCE_DIR}/khronos/vulkan/vk_icd.h" |
| 72 | "${CMAKE_CURRENT_SOURCE_DIR}/khronos/vulkan/vk_layer.h" |
| 73 | "${CMAKE_CURRENT_SOURCE_DIR}/khronos/vulkan/vk_platform.h" |
| 74 | "${CMAKE_CURRENT_SOURCE_DIR}/khronos/vulkan/vk_sdk_platform.h" |
| 75 | "${CMAKE_CURRENT_SOURCE_DIR}/khronos/vulkan/vulkan.h" |
| 76 | "${CMAKE_CURRENT_SOURCE_DIR}/khronos/vulkan/vulkan_core.h" |
Corentin Wallez | d353ca0 | 2020-02-18 02:12:35 +0000 | [diff] [blame] | 77 | ) |
dan sinclair | ecd46ab | 2020-10-20 17:43:00 +0000 | [diff] [blame] | 78 | target_include_directories(dawn_vulkan_headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/khronos") |