Skip to content

Commit

Permalink
Replaced PLATFORM_EMSCRIPTEN CMake variable and c++ macro with PLATFO…
Browse files Browse the repository at this point in the history
…RM_WEB
  • Loading branch information
TheMostDiligent committed Feb 10, 2025
1 parent 4152379 commit 4679a41
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if(PLATFORM_WIN32 OR PLATFORM_LINUX)
cmake_minimum_required (VERSION 3.13)
option(DILIGENT_INSTALL_SAMPLES "Enable installation of samples and tutorials" ON)
elseif(PLATFORM_EMSCRIPTEN)
elseif(PLATFORM_WEB)
cmake_minimum_required (VERSION 3.13)
else()
cmake_minimum_required (VERSION 3.10)
Expand Down Expand Up @@ -81,7 +81,7 @@ function(add_sample_app APP_NAME IDE_FOLDER SOURCE INCLUDE SHADERS ASSETS)
)
endif()

if(PLATFORM_EMSCRIPTEN)
if(PLATFORM_WEB)
set(RESOURCE_PATH "${PROJECT_SOURCE_DIR}/assets/")
target_link_options(${APP_NAME} PRIVATE "SHELL: -s ALLOW_MEMORY_GROWTH=1 --preload-file ${RESOURCE_PATH}@")

Expand Down Expand Up @@ -149,7 +149,7 @@ endif()
# Create a custom target to run source code formatting validation command
add_format_validation_target(DiligentSamples "${CMAKE_CURRENT_SOURCE_DIR}" DiligentSamples)

if (PLATFORM_EMSCRIPTEN)
if (PLATFORM_WEB)
set(HTTPS_SERVER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/SampleBase/src/Emscripten/resources/https_server.py)
set(HTTPS_SERVER_OUTPUT_DIR ${CMAKE_BINARY_DIR})
file(COPY ${HTTPS_SERVER_SCRIPT} DESTINATION ${HTTPS_SERVER_OUTPUT_DIR})
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ and follow the [instructions](https://github.com/DiligentGraphics/DiligentEngine
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/macos-logo.png" width=24 valign="middle"> MacOS | [![Build Status](https://github.com/DiligentGraphics/DiligentSamples/actions/workflows/build-apple.yml/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentSamples/actions/workflows/build-apple.yml?query=branch%3Amaster) |
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/apple-logo.png" width=24 valign="middle"> iOS | [![Build Status](https://github.com/DiligentGraphics/DiligentSamples/actions/workflows/build-apple.yml/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentSamples/actions/workflows/build-apple.yml?query=branch%3Amaster) |
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/tvos-logo.png" width=24 valign="middle"> tvOS | [![Build Status](https://github.com/DiligentGraphics/DiligentSamples/actions/workflows/build-apple.yml/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentSamples/actions/workflows/build-apple.yml?query=branch%3Amaster) |
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/emscripten-logo.png" width=24 valign="middle"> Emscripten | [![Build Status](https://github.com/DiligentGraphics/DiligentSamples/actions/workflows/build-emscripten.yml/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentSamples/actions/workflows/build-emscripten.yml?query=branch%3Amaster) |
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/emscripten-logo.png" width=24 valign="middle"> Web | [![Build Status](https://github.com/DiligentGraphics/DiligentSamples/actions/workflows/build-emscripten.yml/badge.svg?branch=master)](https://github.com/DiligentGraphics/DiligentSamples/actions/workflows/build-emscripten.yml?query=branch%3Amaster) |

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](License.txt)
[![Chat on Discord](https://img.shields.io/discord/730091778081947680?logo=discord)](https://discord.gg/t7HGBK7)
Expand Down
2 changes: 1 addition & 1 deletion SampleBase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ elseif(PLATFORM_TVOS)
include/SampleApp.hpp
)

elseif(PLATFORM_EMSCRIPTEN)
elseif(PLATFORM_WEB)
set(SOURCE
src/Emscripten/InputControllerEmscripten.cpp
src/Emscripten/SampleAppEmscripten.cpp
Expand Down
2 changes: 1 addition & 1 deletion SampleBase/include/InputController.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class InputControllerBase
{
using InputController = InputControllerAndroid;
}
#elif PLATFORM_EMSCRIPTEN
#elif PLATFORM_WEB
#include "Emscripten/InputControllerEmscripten.hpp"
namespace Diligent
{
Expand Down
6 changes: 3 additions & 3 deletions SampleBase/src/SampleApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
#include "ImGuiImplDiligent.hpp"
#include "ImGuiUtils.hpp"

#if PLATFORM_EMSCRIPTEN
#if PLATFORM_WEB
# include <emscripten/html5_webgpu.h>
#endif

Expand Down Expand Up @@ -352,7 +352,7 @@ void SampleApp::InitializeDiligentEngine(const NativeWindow* pWindow)
EngineGLCreateInfo EngineCI;
EngineCI.Window = *pWindow;

# if PLATFORM_EMSCRIPTEN
# if PLATFORM_WEB
EngineCI.WebGLAttribs.Alpha = false;
EngineCI.WebGLAttribs.PowerPreference = WEBGL_POWER_PREFERENCE_HIGH_PERFORMANCE;
# endif
Expand Down Expand Up @@ -482,7 +482,7 @@ void SampleApp::InitializeDiligentEngine(const NativeWindow* pWindow)
EngineCI.NumDeferredContexts = 0;
}

# if PLATFORM_EMSCRIPTEN
# if PLATFORM_WEB
(void)FindAdapter;
WGPUDevice wgpuDevice = emscripten_webgpu_get_device();
WGPUInstance wgpuInstance = wgpuCreateInstance(nullptr);
Expand Down
4 changes: 2 additions & 2 deletions Samples/GLTFViewer/src/GLTFViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ SampleBase* CreateSample()
const std::pair<const char*, const char*> DefaultGLTFModels[] =
{
{"Damaged Helmet", "models/DamagedHelmet/DamagedHelmet.gltf"},
#if !PLATFORM_EMSCRIPTEN
#if !PLATFORM_WEB
{"Barbie Dodge Pickup", "models/BarbieDodgePickup/scene.gltf"},
#endif
{"Flight Helmet", "models/FlightHelmet/glTF/FlightHelmet.gltf"},
Expand All @@ -82,7 +82,7 @@ const std::pair<const char*, const char*> DefaultGLTFModels[] =
{"Clearcoat Ring", "models/ClearcoatRing/glTF/ClearcoatRing.gltf"},
{"Glam Velvet Sofa", "models/GlamVelvetSofa/glTF/GlamVelvetSofa.gltf"},
{"Iridescence Abalone", "models/IridescenceAbalone/glTF/IridescenceAbalone.gltf"},
#if !PLATFORM_EMSCRIPTEN
#if !PLATFORM_WEB
{"Iridescent Dish With Olives", "models/IridescentDishWithOlives/glTF/IridescentDishWithOlives.gltf"},
#endif
{"Toy Car", "models/ToyCar/glTF/ToyCar.gltf"},
Expand Down
4 changes: 2 additions & 2 deletions Tutorials/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ add_subdirectory(Tutorial21_RayTracing)
add_subdirectory(Tutorial22_HybridRendering)
add_subdirectory(Tutorial23_CommandQueues)
add_subdirectory(Tutorial24_VRS)
if(PLATFORM_WIN32 OR PLATFORM_LINUX OR PLATFORM_MACOS OR PLATFORM_EMSCRIPTEN)
if(PLATFORM_WIN32 OR PLATFORM_LINUX OR PLATFORM_MACOS OR PLATFORM_WEB)
add_subdirectory(Tutorial26_StateCache)
if(NOT PLATFORM_EMSCRIPTEN)
if(NOT PLATFORM_WEB)
add_subdirectory(Tutorial25_StatePackager)
endif()
endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void Tutorial19_RenderPasses::ModifyEngineInitInfo(const ModifyEngineInitInfoAtt
// We do not need the depth buffer from the swap chain in this sample
Attribs.SCDesc.DepthBufferFormat = TEX_FORMAT_UNKNOWN;

#if PLATFORM_EMSCRIPTEN
#if PLATFORM_WEB
if (Attribs.DeviceType == RENDER_DEVICE_TYPE_GLES)
{
EngineGLCreateInfo& EngineGlCI = static_cast<EngineGLCreateInfo&>(Attribs.EngineCI);
Expand Down
2 changes: 1 addition & 1 deletion UnityPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.10)

if (NOT PLATFORM_EMSCRIPTEN)
if (NOT PLATFORM_WEB)
add_subdirectory(UnityEmulator)
add_subdirectory(GhostCubeScene)
add_subdirectory(GhostCubePlugin)
Expand Down

0 comments on commit 4679a41

Please sign in to comment.