mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-13 02:41:28 +00:00
Add samples to BUILD.gn and their deps to DEPS
Also add missing GLFW DEPS entry
This commit is contained in:
parent
d2969a7d3d
commit
4d7d1697fa
90
BUILD.gn
90
BUILD.gn
@ -168,6 +168,10 @@ config("dawn_internal") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
configs = [ ":libdawn_public" ]
|
configs = [ ":libdawn_public" ]
|
||||||
|
|
||||||
|
# Only internal Dawn targets can use this config, this means only targets in
|
||||||
|
# this BUILD.gn file.
|
||||||
|
visibility = [ ":*" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Executable needs an rpath to find our shared libraries on OSX
|
# Executable needs an rpath to find our shared libraries on OSX
|
||||||
@ -885,3 +889,89 @@ test("dawn_end2end_tests") {
|
|||||||
"src/tests/end2end/ViewportOrientationTests.cpp",
|
"src/tests/end2end/ViewportOrientationTests.cpp",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Dawn samples, only in standalone builds
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
if (dawn_standalone) {
|
||||||
|
# Static library to contain code and dependencies common to all samples
|
||||||
|
static_library("dawn_sample_utils") {
|
||||||
|
sources = [
|
||||||
|
"examples/SampleUtils.cpp",
|
||||||
|
"examples/SampleUtils.h",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Export all of these as public deps so that `gn check` allows includes
|
||||||
|
public_deps = [
|
||||||
|
":dawn_common",
|
||||||
|
":dawn_utils",
|
||||||
|
":libdawn",
|
||||||
|
":libdawn_native",
|
||||||
|
":libdawn_wire",
|
||||||
|
"third_party:glfw",
|
||||||
|
]
|
||||||
|
public_configs = [ ":dawn_internal" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Template for samples to avoid listing dawn_sample_utils as a dep every time
|
||||||
|
template("dawn_sample") {
|
||||||
|
executable(target_name) {
|
||||||
|
deps = [
|
||||||
|
":dawn_sample_utils",
|
||||||
|
]
|
||||||
|
forward_variables_from(invoker, "*", [ "deps" ])
|
||||||
|
|
||||||
|
if (defined(invoker.deps)) {
|
||||||
|
deps += invoker.deps
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dawn_sample("CppHelloTriangle") {
|
||||||
|
sources = [
|
||||||
|
"examples/CppHelloTriangle.cpp",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
dawn_sample("CHelloTriangle") {
|
||||||
|
sources = [
|
||||||
|
"examples/CHelloTriangle.cpp",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
dawn_sample("ComputeBoids") {
|
||||||
|
sources = [
|
||||||
|
"examples/ComputeBoids.cpp",
|
||||||
|
]
|
||||||
|
deps = [
|
||||||
|
"third_party:glm",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
dawn_sample("Animometer") {
|
||||||
|
sources = [
|
||||||
|
"examples/Animometer.cpp",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
dawn_sample("CubeReflection") {
|
||||||
|
sources = [
|
||||||
|
"examples/CubeReflection.cpp",
|
||||||
|
]
|
||||||
|
deps = [
|
||||||
|
"third_party:glm",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
dawn_sample("glTFViewer") {
|
||||||
|
sources = [
|
||||||
|
"examples/glTFViewer/Camera.inl",
|
||||||
|
"examples/glTFViewer/glTFViewer.cpp",
|
||||||
|
]
|
||||||
|
deps = [
|
||||||
|
"third_party:glm",
|
||||||
|
"third_party:tiny_gltf_loader",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
17
DEPS
17
DEPS
@ -26,7 +26,7 @@ deps = {
|
|||||||
'url': '{chromium_git}/chromium/src/testing@4d706fd80be9e8989aec5235540e7b46d0672826',
|
'url': '{chromium_git}/chromium/src/testing@4d706fd80be9e8989aec5235540e7b46d0672826',
|
||||||
'condition': 'dawn_standalone',
|
'condition': 'dawn_standalone',
|
||||||
},
|
},
|
||||||
'third_party/googletest': {
|
'{dawn_root}/third_party/googletest': {
|
||||||
'url': '{github_git}/google/googletest.git@98a0d007d7092b72eea0e501bb9ad17908a1a036',
|
'url': '{github_git}/google/googletest.git@98a0d007d7092b72eea0e501bb9ad17908a1a036',
|
||||||
'condition': 'dawn_standalone',
|
'condition': 'dawn_standalone',
|
||||||
},
|
},
|
||||||
@ -55,6 +55,21 @@ deps = {
|
|||||||
'condition': 'dawn_standalone',
|
'condition': 'dawn_standalone',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# GLFW for tests and samples
|
||||||
|
'{dawn_root}/third_party/glfw': {
|
||||||
|
'url': '{github_git}/glfw/glfw.git@096efdf798896cff80a0b2db08d7398b703406fe',
|
||||||
|
'condition': 'dawn_standalone',
|
||||||
|
},
|
||||||
|
|
||||||
|
# Dependencies for samples: stb and GLM
|
||||||
|
'{dawn_root}/third_party/stb': {
|
||||||
|
'url': '{github_git}/nothings/stb.git@c7110588a4d24c4bb5155c184fbb77dd90b3116e',
|
||||||
|
'condition': 'dawn_standalone',
|
||||||
|
},
|
||||||
|
'{dawn_root}/third_party/glm': {
|
||||||
|
'url': '{github_git}/g-truc/glm.git@06f084063fd6d9aa2ef6904517650700ae47b63d',
|
||||||
|
'condition': 'dawn_standalone',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
hooks = [
|
hooks = [
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
#include "utils/SystemUtils.h"
|
#include "utils/SystemUtils.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <glm/glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
#include <glm/glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
|
||||||
dawn::Device device;
|
dawn::Device device;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#define __STDC_FORMAT_MACROS
|
#define __STDC_FORMAT_MACROS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "SampleUtils.h"
|
#include "../SampleUtils.h"
|
||||||
|
|
||||||
#include "common/Assert.h"
|
#include "common/Assert.h"
|
||||||
#include "common/Math.h"
|
#include "common/Math.h"
|
||||||
@ -36,6 +36,7 @@
|
|||||||
#define TINYGLTF_LOADER_IMPLEMENTATION
|
#define TINYGLTF_LOADER_IMPLEMENTATION
|
||||||
#define STB_IMAGE_IMPLEMENTATION
|
#define STB_IMAGE_IMPLEMENTATION
|
||||||
#define PICOJSON_ASSERT ASSERT
|
#define PICOJSON_ASSERT ASSERT
|
||||||
|
#undef __STDC_FORMAT_MACROS
|
||||||
#include <tinygltfloader/tiny_gltf_loader.h>
|
#include <tinygltfloader/tiny_gltf_loader.h>
|
||||||
|
|
||||||
#include "GLFW/glfw3.h"
|
#include "GLFW/glfw3.h"
|
||||||
|
53
third_party/BUILD.gn
vendored
53
third_party/BUILD.gn
vendored
@ -368,3 +368,56 @@ static_library("glfw") {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Header-only dependencies for samples
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
if (dawn_standalone) {
|
||||||
|
# GLM
|
||||||
|
config("glm_public_config") {
|
||||||
|
include_dirs = [ "glm" ]
|
||||||
|
}
|
||||||
|
source_set("glm") {
|
||||||
|
public_configs = [ ":glm_public_config" ]
|
||||||
|
# GLM is header only but has too many files to list them.
|
||||||
|
}
|
||||||
|
|
||||||
|
# STB
|
||||||
|
config("stb_public_config") {
|
||||||
|
include_dirs = [ "stb" ]
|
||||||
|
cflags_cc = [ "-Wno-implicit-fallthrough" ]
|
||||||
|
}
|
||||||
|
source_set("stb") {
|
||||||
|
public_configs = [ ":stb_public_config" ]
|
||||||
|
sources = [
|
||||||
|
"stb/stb_image.h",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
# PicoJSON
|
||||||
|
config("picojson_public_config") {
|
||||||
|
include_dirs = [ "." ]
|
||||||
|
}
|
||||||
|
source_set("picojson") {
|
||||||
|
public_configs = [ ":picojson_public_config" ]
|
||||||
|
sources = [
|
||||||
|
"picojson/picojson.h",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Tiny glTF Loader
|
||||||
|
config("tiny_gltf_loader_public_config") {
|
||||||
|
include_dirs = [ "." ]
|
||||||
|
}
|
||||||
|
source_set("tiny_gltf_loader") {
|
||||||
|
public_configs = [ ":tiny_gltf_loader_public_config" ]
|
||||||
|
public_deps = [
|
||||||
|
":picojson",
|
||||||
|
":stb",
|
||||||
|
]
|
||||||
|
sources = [
|
||||||
|
"tinygltfloader/tiny_gltf_loader.h",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user