Skip to content

Commit

Permalink
tint->dawn: Move examples -> samples/dawn
Browse files Browse the repository at this point in the history
Bug: dawn:1275
Change-Id: I4824aaabc2c2b55a609a6e1370959394b93463b8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79103
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
  • Loading branch information
ben-clayton authored and Dawn LUCI CQ committed Feb 4, 2022
1 parent 9fb7a51 commit a675075
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ group("all") {
"src/tests:dawn_tests",
]
if (dawn_standalone) {
deps += [ "examples:dawn_samples" ]
deps += [ "samples/dawn:samples" ]
}
}

Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ set(ENABLE_OPENGLES OFF)
set(ENABLE_DESKTOP_GL OFF)
set(ENABLE_VULKAN OFF)
set(USE_X11 OFF)
set(BUILD_EXAMPLE OFF)
set(BUILD_SAMPLES OFF)
if (WIN32)
set(ENABLE_D3D12 ON)
if (NOT WINDOWS_STORE)
Expand All @@ -102,7 +102,7 @@ endif()

# Current examples are depend on GLFW
if (DAWN_SUPPORTS_GLFW_FOR_WINDOWING)
set(BUILD_EXAMPLE ON)
set(BUILD_SAMPLES ON)
endif()

option_if_not_defined(DAWN_ENABLE_D3D12 "Enable compilation of the D3D12 backend" ${ENABLE_D3D12})
Expand All @@ -114,7 +114,7 @@ option_if_not_defined(DAWN_ENABLE_VULKAN "Enable compilation of the Vulkan backe
option_if_not_defined(DAWN_ALWAYS_ASSERT "Enable assertions on all build types" OFF)
option_if_not_defined(DAWN_USE_X11 "Enable support for X11 surface" ${USE_X11})

option_if_not_defined(DAWN_BUILD_EXAMPLES "Enables building Dawn's exmaples" ${BUILD_EXAMPLE})
option_if_not_defined(DAWN_BUILD_SAMPLES "Enables building Dawn's samples" ${BUILD_SAMPLES})
option_if_not_defined(DAWN_BUILD_NODE_BINDINGS "Enables building Dawn's NodeJS bindings" OFF)

option_if_not_defined(DAWN_ENABLE_PIC "Build with Position-Independent-Code enabled" OFF)
Expand Down Expand Up @@ -220,10 +220,10 @@ add_subdirectory(src/dawn/wire)
# TODO(dawn:269): Remove once the implementation-based swapchains are removed.
add_subdirectory(src/dawn/utils)

if (DAWN_BUILD_EXAMPLES)
if (DAWN_BUILD_SAMPLES)
#TODO(dawn:269): Add this once implementation-based swapchains are removed.
#add_subdirectory(src/dawn/utils)
add_subdirectory(examples)
add_subdirectory(samples/dawn)
endif()

if (DAWN_BUILD_NODE_BINDINGS)
Expand Down
File renamed without changes.
23 changes: 11 additions & 12 deletions examples/BUILD.gn → samples/dawn/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import("../scripts/dawn_overrides_with_defaults.gni")
import("../../scripts/dawn_overrides_with_defaults.gni")

group("dawn_samples") {
group("samples") {
deps = [
":Animometer",
":CHelloTriangle",
Expand All @@ -25,7 +25,7 @@ group("dawn_samples") {
}

# Static library to contain code and dependencies common to all samples
static_library("dawn_sample_utils") {
static_library("utils") {
sources = [
"SampleUtils.cpp",
"SampleUtils.h",
Expand All @@ -34,7 +34,6 @@ static_library("dawn_sample_utils") {
# Export all of these as public deps so that `gn check` allows includes
public_deps = [
"${dawn_root}/src/dawn:cpp",
"${dawn_root}/src/dawn:proc",
"${dawn_root}/src/dawn/common",
"${dawn_root}/src/dawn/native",
"${dawn_root}/src/dawn/utils",
Expand All @@ -45,10 +44,10 @@ static_library("dawn_sample_utils") {
public_configs = [ "${dawn_root}/src/dawn/common:internal_config" ]
}

# Template for samples to avoid listing dawn_sample_utils as a dep every time
template("dawn_sample") {
# Template for samples to avoid listing utils as a dep every time
template("sample") {
executable(target_name) {
deps = [ ":dawn_sample_utils" ]
deps = [ ":utils" ]
forward_variables_from(invoker, "*", [ "deps" ])

if (defined(invoker.deps)) {
Expand All @@ -57,22 +56,22 @@ template("dawn_sample") {
}
}

dawn_sample("CppHelloTriangle") {
sample("CppHelloTriangle") {
sources = [ "CppHelloTriangle.cpp" ]
}

dawn_sample("CHelloTriangle") {
sample("CHelloTriangle") {
sources = [ "CHelloTriangle.cpp" ]
}

dawn_sample("ComputeBoids") {
sample("ComputeBoids") {
sources = [ "ComputeBoids.cpp" ]
}

dawn_sample("Animometer") {
sample("Animometer") {
sources = [ "Animometer.cpp" ]
}

dawn_sample("ManualSwapChainTest") {
sample("ManualSwapChainTest") {
sources = [ "ManualSwapChainTest.cpp" ]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 4 additions & 5 deletions examples/SampleUtils.cpp → samples/dawn/SampleUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@

#include "SampleUtils.h"

#include "GLFW/glfw3.h"
#include "dawn/common/Assert.h"
#include "dawn/common/Log.h"
#include "dawn/common/Platform.h"
#include "dawn/common/SystemUtils.h"
#include "dawn/dawn_proc.h"
#include "dawn/dawn_wsi.h"
#include "dawn/native/DawnNative.h"
#include "dawn/utils/BackendBinding.h"
#include "dawn/utils/GLFWUtils.h"
#include "dawn/utils/TerribleCommandBuffer.h"
#include "dawn/wire/WireClient.h"
#include "dawn/wire/WireServer.h"

#include <dawn/dawn_proc.h>
#include <dawn/dawn_wsi.h>
#include <dawn/native/DawnNative.h>
#include "GLFW/glfw3.h"

#include <algorithm>
#include <cstring>

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/dawn/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ config("internal_config") {
# Only internal Dawn targets can use this config, this means only targets in
# this BUILD.gn file and related subdirs.
visibility = [
"${dawn_root}/examples/*",
"${dawn_root}/samples/dawn/*",
"${dawn_root}/src/*",
"${dawn_root}/src/dawn/*",
]
Expand Down

0 comments on commit a675075

Please sign in to comment.