tint->dawn Add src/dawn/CMakeLists.txt

Promote up some build rules from the root CMakeLists.txt file that are
specific to Dawn.

Bug: dawn:1275
Change-Id: I11e9261ac595f6d71742b20d54dc658a5fa7e996
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79105
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2022-02-04 18:59:15 +00:00 committed by Dawn LUCI CQ
parent c6ccd539e8
commit 7b77855a87
2 changed files with 38 additions and 29 deletions

View File

@ -213,37 +213,13 @@ set(CMAKE_CXX_STANDARD "17")
add_subdirectory(third_party)
add_subdirectory(generator)
add_subdirectory(src/dawn)
add_subdirectory(src/dawn/common)
add_subdirectory(src/dawn/platform)
add_subdirectory(src/dawn/native)
add_subdirectory(src/dawn/wire)
# TODO(dawn:269): Remove once the implementation-based swapchains are removed.
add_subdirectory(src/dawn/utils)
################################################################################
# Samples
################################################################################
if (DAWN_BUILD_SAMPLES)
#TODO(dawn:269): Add this once implementation-based swapchains are removed.
#add_subdirectory(src/dawn/utils)
#add_subdirectory(src/utils)
add_subdirectory(samples/dawn)
endif()
if (DAWN_BUILD_NODE_BINDINGS)
set(NODE_BINDING_DEPS
${NODE_ADDON_API_DIR}
${NODE_API_HEADERS_DIR}
${WEBGPU_IDL_PATH}
)
foreach(DEP ${NODE_BINDING_DEPS})
if (NOT EXISTS ${DEP})
message(FATAL_ERROR
"DAWN_BUILD_NODE_BINDINGS requires missing dependency '${DEP}'\n"
"Please follow the 'Fetch dependencies' instructions at:\n"
"./src/dawn/node/README.md"
)
endif()
endforeach()
if (NOT CMAKE_POSITION_INDEPENDENT_CODE)
message(FATAL_ERROR "DAWN_BUILD_NODE_BINDINGS requires building with DAWN_ENABLE_PIC")
endif()
add_subdirectory(src/dawn/node)
endif()

View File

@ -12,6 +12,39 @@
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
# Dawn projects
###############################################################################
add_subdirectory(common)
add_subdirectory(platform)
add_subdirectory(native)
add_subdirectory(wire)
# TODO(dawn:269): Remove once the implementation-based swapchains are removed.
add_subdirectory(utils)
if (DAWN_BUILD_NODE_BINDINGS)
set(NODE_BINDING_DEPS
${NODE_ADDON_API_DIR}
${NODE_API_HEADERS_DIR}
${WEBGPU_IDL_PATH}
)
foreach(DEP ${NODE_BINDING_DEPS})
if (NOT EXISTS ${DEP})
message(FATAL_ERROR
"DAWN_BUILD_NODE_BINDINGS requires missing dependency '${DEP}'\n"
"Please follow the 'Fetch dependencies' instructions at:\n"
"./src/dawn/node/README.md"
)
endif()
endforeach()
if (NOT CMAKE_POSITION_INDEPENDENT_CODE)
message(FATAL_ERROR "DAWN_BUILD_NODE_BINDINGS requires building with DAWN_ENABLE_PIC")
endif()
add_subdirectory(node)
endif()
###############################################################################
# Dawn headers
###############################################################################