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 | 97b880e | 2020-09-09 16:39:00 +0000 | [diff] [blame] | 15 | if (NOT TARGET spirv-cross) |
| 16 | set(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS ON CACHE BOOL "" FORCE) |
| 17 | set(SPIRV_CROSS_ENABLE_TESTS OFF CACHE BOOL "" FORCE) |
| 18 | set(SPIRV_CROSS_SKIP_INSTALL ON CACHE BOOL "" FORCE) |
| 19 | |
| 20 | message(STATUS "Dawn: using spirv-cross at ${DAWN_SPIRV_CROSS_DIR}") |
| 21 | add_subdirectory(${DAWN_SPIRV_CROSS_DIR}) |
| 22 | endif() |
| 23 | |
Corentin Wallez | 7fe6efb | 2020-02-05 17:16:05 +0000 | [diff] [blame] | 24 | if (NOT TARGET SPIRV-Headers) |
Corentin Wallez | 42450c6 | 2020-04-10 17:04:31 +0000 | [diff] [blame] | 25 | set(SPIRV_HEADERS_SKIP_EXAMPLES ON CACHE BOOL "" FORCE) |
| 26 | set(SPIRV_HEADERS_SKIP_INSTALL ON CACHE BOOL "" FORCE) |
Corentin Wallez | 7fe6efb | 2020-02-05 17:16:05 +0000 | [diff] [blame] | 27 | |
| 28 | message(STATUS "Dawn: using SPIRV-Headers at ${DAWN_SPIRV_HEADERS_DIR}") |
| 29 | add_subdirectory(${DAWN_SPIRV_HEADERS_DIR}) |
| 30 | endif() |
| 31 | |
| 32 | if (NOT TARGET SPIRV-Tools) |
Corentin Wallez | 42450c6 | 2020-04-10 17:04:31 +0000 | [diff] [blame] | 33 | set(SPIRV_SKIP_TESTS ON CACHE BOOL "" FORCE) |
| 34 | set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "" FORCE) |
| 35 | set(SKIP_SPIRV_TOOLS_INSTALL ON CACHE BOOL "" FORCE) |
Corentin Wallez | 7fe6efb | 2020-02-05 17:16:05 +0000 | [diff] [blame] | 36 | |
| 37 | message(STATUS "Dawn: using SPIRV-Tools at ${DAWN_SPIRV_TOOLS_DIR}") |
| 38 | add_subdirectory(${DAWN_SPIRV_TOOLS_DIR}) |
| 39 | endif() |
| 40 | |
Corentin Wallez | 7fe6efb | 2020-02-05 17:16:05 +0000 | [diff] [blame] | 41 | if (DAWN_BUILD_EXAMPLES) |
| 42 | if (NOT TARGET glfw) |
Corentin Wallez | 42450c6 | 2020-04-10 17:04:31 +0000 | [diff] [blame] | 43 | set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) |
| 44 | set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) |
| 45 | set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) |
Corentin Wallez | 7fe6efb | 2020-02-05 17:16:05 +0000 | [diff] [blame] | 46 | |
| 47 | message(STATUS "Dawn: using GLFW at ${DAWN_GLFW_DIR}") |
| 48 | add_subdirectory(${DAWN_GLFW_DIR}) |
| 49 | endif() |
| 50 | |
| 51 | if (NOT TARGET glm) |
| 52 | message(STATUS "Dawn: using GLM at ${DAWN_GLM_DIR}") |
| 53 | add_subdirectory(${DAWN_GLM_DIR}) |
| 54 | endif() |
| 55 | endif() |
Corentin Wallez | 215b537 | 2020-02-15 00:39:13 +0000 | [diff] [blame] | 56 | |
Corentin Wallez | a943919 | 2021-03-22 21:23:36 +0000 | [diff] [blame] | 57 | if (NOT TARGET libtint) |
| 58 | message(STATUS "Dawn: using Tint at ${DAWN_TINT_DIR}") |
| 59 | add_subdirectory(${DAWN_TINT_DIR}) |
dan sinclair | bb3d798 | 2020-10-23 13:10:20 +0000 | [diff] [blame] | 60 | endif() |
| 61 | |
Corentin Wallez | 215b537 | 2020-02-15 00:39:13 +0000 | [diff] [blame] | 62 | # Header-only library for khrplatform.h |
| 63 | add_library(dawn_khronos_platform INTERFACE) |
dan sinclair | ecd46ab | 2020-10-20 17:43:00 +0000 | [diff] [blame] | 64 | target_sources(dawn_khronos_platform INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/khronos/KHR/khrplatform.h") |
| 65 | target_include_directories(dawn_khronos_platform INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/khronos") |
Corentin Wallez | d353ca0 | 2020-02-18 02:12:35 +0000 | [diff] [blame] | 66 | |
| 67 | # Header-only library for Vulkan headers |
| 68 | add_library(dawn_vulkan_headers INTERFACE) |
| 69 | target_sources(dawn_vulkan_headers INTERFACE |
dan sinclair | ecd46ab | 2020-10-20 17:43:00 +0000 | [diff] [blame] | 70 | "${CMAKE_CURRENT_SOURCE_DIR}/khronos/vulkan/vk_icd.h" |
| 71 | "${CMAKE_CURRENT_SOURCE_DIR}/khronos/vulkan/vk_layer.h" |
| 72 | "${CMAKE_CURRENT_SOURCE_DIR}/khronos/vulkan/vk_platform.h" |
| 73 | "${CMAKE_CURRENT_SOURCE_DIR}/khronos/vulkan/vk_sdk_platform.h" |
| 74 | "${CMAKE_CURRENT_SOURCE_DIR}/khronos/vulkan/vulkan.h" |
| 75 | "${CMAKE_CURRENT_SOURCE_DIR}/khronos/vulkan/vulkan_core.h" |
Corentin Wallez | d353ca0 | 2020-02-18 02:12:35 +0000 | [diff] [blame] | 76 | ) |
dan sinclair | ecd46ab | 2020-10-20 17:43:00 +0000 | [diff] [blame] | 77 | target_include_directories(dawn_vulkan_headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/khronos") |