Skip to content

Commit 2be6e99

Browse files
Replaced PLATFORM_EMSCRIPTEN CMake option and c++ macro with PLATFORM_WEB
1 parent b4e16a8 commit 2be6e99

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+157
-156
lines changed

CMakeLists.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ set(PLATFORM_LINUX FALSE CACHE INTERNAL "")
4747
set(PLATFORM_MACOS FALSE CACHE INTERNAL "")
4848
set(PLATFORM_IOS FALSE CACHE INTERNAL "")
4949
set(PLATFORM_TVOS FALSE CACHE INTERNAL "")
50-
set(PLATFORM_EMSCRIPTEN FALSE CACHE INTERNAL "")
50+
set(PLATFORM_WEB FALSE CACHE INTERNAL "")
5151
set(D3D11_SUPPORTED FALSE CACHE INTERNAL "D3D11 is not supported")
5252
set(D3D12_SUPPORTED FALSE CACHE INTERNAL "D3D12 is not supported")
5353
set(GL_SUPPORTED FALSE CACHE INTERNAL "GL is not supported")
@@ -141,8 +141,8 @@ else()
141141
set(PLATFORM_TVOS TRUE CACHE INTERNAL "Target platform: tvOS")
142142
message("Target platform: tvOS " ${ARCH})
143143
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
144-
set(PLATFORM_EMSCRIPTEN TRUE CACHE INTERNAL "Target platform: Emscripten")
145-
message("Target platform: Emscripten " ${ARCH})
144+
set(PLATFORM_WEB TRUE CACHE INTERNAL "Target platform: Web")
145+
message("Target platform: Web " ${ARCH})
146146
else()
147147
message(FATAL_ERROR "Unsupported platform")
148148
endif()
@@ -210,11 +210,11 @@ elseif(PLATFORM_IOS)
210210
target_compile_definitions(Diligent-PublicBuildSettings INTERFACE PLATFORM_IOS=1 PLATFORM_APPLE=1)
211211
elseif(PLATFORM_TVOS)
212212
target_compile_definitions(Diligent-PublicBuildSettings INTERFACE PLATFORM_TVOS=1 PLATFORM_APPLE=1)
213-
elseif(PLATFORM_EMSCRIPTEN)
214-
set(GLES_SUPPORTED TRUE CACHE INTERNAL "OpenGLES is supported on Emscripten platform")
215-
set(WEBGPU_SUPPORTED TRUE CACHE INTERNAL "WebGPU is supported on Emscripten platform")
216-
set(ARCHIVER_SUPPORTED TRUE CACHE INTERNAL "Archiver is supported on Emscripten platform")
217-
target_compile_definitions(Diligent-PublicBuildSettings INTERFACE PLATFORM_EMSCRIPTEN=1)
213+
elseif(PLATFORM_WEB)
214+
set(GLES_SUPPORTED TRUE CACHE INTERNAL "OpenGLES is supported on Web platform")
215+
set(WEBGPU_SUPPORTED TRUE CACHE INTERNAL "WebGPU is supported on Web platform")
216+
set(ARCHIVER_SUPPORTED TRUE CACHE INTERNAL "Archiver is supported on Web platform")
217+
target_compile_definitions(Diligent-PublicBuildSettings INTERFACE PLATFORM_WEB=1 PLATFORM_EMSCRIPTEN=1)
218218
else()
219219
message(FATAL_ERROR "No PLATFORM_XXX variable defined. Make sure that 'DiligentCore' folder is processed first")
220220
endif()
@@ -268,7 +268,7 @@ if(PLATFORM_APPLE)
268268
endif()
269269
endif()
270270

271-
if(PLATFORM_WIN32 OR PLATFORM_LINUX OR PLATFORM_MACOS OR PLATFORM_EMSCRIPTEN)
271+
if(PLATFORM_WIN32 OR PLATFORM_LINUX OR PLATFORM_MACOS OR PLATFORM_WEB)
272272
option(DILIGENT_BUILD_TESTS "Build Diligent Engine tests" OFF)
273273
if(DILIGENT_BUILD_TESTS)
274274
set(DILIGENT_BUILD_CORE_TESTS TRUE CACHE INTERNAL "Build Core tests")
@@ -299,7 +299,7 @@ option(DILIGENT_NO_DIRECT3D12 "Disable Direct3D12 backend" OFF)
299299
option(DILIGENT_NO_OPENGL "Disable OpenGL/GLES backend" OFF)
300300
option(DILIGENT_NO_VULKAN "Disable Vulkan backend" OFF)
301301
option(DILIGENT_NO_METAL "Disable Metal backend" OFF)
302-
if (PLATFORM_EMSCRIPTEN)
302+
if (PLATFORM_WEB)
303303
option(DILIGENT_NO_WEBGPU "Disable WebGPU backend" OFF)
304304
else()
305305
option(DILIGENT_NO_WEBGPU "Disable WebGPU backend" ON)
@@ -370,7 +370,7 @@ endif()
370370

371371
add_library(Diligent-BuildSettings INTERFACE)
372372

373-
if (PLATFORM_EMSCRIPTEN)
373+
if (PLATFORM_WEB)
374374
target_compile_options(Diligent-BuildSettings INTERFACE
375375
"-pthread"
376376
"-mbulk-memory"

Common/interface/StringTools.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -95,7 +95,7 @@ inline std::wstring WidenString(const std::string& Str)
9595

9696
inline int StrCmpNoCase(const char* Str1, const char* Str2, size_t NumChars)
9797
{
98-
#if PLATFORM_ANDROID || PLATFORM_LINUX || PLATFORM_MACOS || PLATFORM_IOS || PLATFORM_TVOS || PLATFORM_EMSCRIPTEN
98+
#if PLATFORM_ANDROID || PLATFORM_LINUX || PLATFORM_MACOS || PLATFORM_IOS || PLATFORM_TVOS || PLATFORM_WEB
9999
# define _strnicmp strncasecmp
100100
#endif
101101

@@ -104,7 +104,7 @@ inline int StrCmpNoCase(const char* Str1, const char* Str2, size_t NumChars)
104104

105105
inline int StrCmpNoCase(const char* Str1, const char* Str2)
106106
{
107-
#if PLATFORM_ANDROID || PLATFORM_LINUX || PLATFORM_MACOS || PLATFORM_IOS || PLATFORM_TVOS || PLATFORM_EMSCRIPTEN
107+
#if PLATFORM_ANDROID || PLATFORM_LINUX || PLATFORM_MACOS || PLATFORM_IOS || PLATFORM_TVOS || PLATFORM_WEB
108108
# define _stricmp strcasecmp
109109
#endif
110110

Graphics/Archiver/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ if(GL_SUPPORTED OR GLES_SUPPORTED)
148148
target_link_libraries(Diligent-Archiver-static PRIVATE GLEW::glew OpenGL::GL)
149149
elseif(PLATFORM_ANDROID)
150150
target_link_libraries(Diligent-Archiver-static PRIVATE GLESv3 EGL)
151-
elseif(PLATFORM_EMSCRIPTEN)
151+
elseif(PLATFORM_WEB)
152152
else()
153153
message(FATAL_ERROR "Unsupported platform")
154154
endif()
@@ -167,7 +167,7 @@ endif()
167167

168168
if(WEBGPU_SUPPORTED)
169169
target_link_libraries(Diligent-Archiver-static PRIVATE Diligent-GraphicsEngineWebGPU-static)
170-
if (NOT PLATFORM_EMSCRIPTEN)
170+
if (NOT PLATFORM_WEB)
171171
target_link_libraries(Diligent-Archiver-static PRIVATE dawn_native dawn_proc)
172172
endif()
173173
target_include_directories(Diligent-Archiver-static

Graphics/Archiver/interface/ArchiverFactoryLoader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@
2828

2929
#include "ArchiverFactory.h"
3030

31-
#if PLATFORM_ANDROID || PLATFORM_LINUX || PLATFORM_MACOS || PLATFORM_IOS || PLATFORM_TVOS || PLATFORM_EMSCRIPTEN || (PLATFORM_WIN32 && !defined(_MSC_VER))
31+
#if PLATFORM_ANDROID || PLATFORM_LINUX || PLATFORM_MACOS || PLATFORM_IOS || PLATFORM_TVOS || PLATFORM_WEB || (PLATFORM_WIN32 && !defined(_MSC_VER))
3232
// https://gcc.gnu.org/wiki/Visibility
3333
# define API_QUALIFIER __attribute__((visibility("default")))
3434
#elif PLATFORM_WIN32 || PLATFORM_UNIVERSAL_WINDOWS

Graphics/GraphicsEngine/interface/GraphicsTypes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3546,7 +3546,7 @@ struct EngineCreateInfo
35463546
};
35473547
typedef struct EngineCreateInfo EngineCreateInfo;
35483548

3549-
#if PLATFORM_EMSCRIPTEN
3549+
#if PLATFORM_WEB
35503550
/// WebGL power preference.
35513551
DILIGENT_TYPED_ENUM(WEBGL_POWER_PREFERENCE, Uint8)
35523552
{
@@ -3626,7 +3626,7 @@ struct EngineGLCreateInfo DILIGENT_DERIVE(EngineCreateInfo)
36263626
/// * On Linux this affects the `DRI_PRIME` environment variable that is used by Mesa drivers that support PRIME.
36273627
ADAPTER_TYPE PreferredAdapterType DEFAULT_INITIALIZER(ADAPTER_TYPE_UNKNOWN);
36283628

3629-
#if PLATFORM_EMSCRIPTEN
3629+
#if PLATFORM_WEB
36303630
/// WebGL context attributes.
36313631
WebGLContextAttribs WebGLAttribs;
36323632
#endif

Graphics/GraphicsEngineOpenGL/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ elseif(PLATFORM_IOS)
143143
list(APPEND INCLUDE include/GLStubsIOS.h)
144144
list(APPEND SOURCE src/SwapChainGLIOS.mm)
145145
list(APPEND INCLUDE include/SwapChainGLIOS.hpp)
146-
elseif(PLATFORM_EMSCRIPTEN)
146+
elseif(PLATFORM_WEB)
147147
list(APPEND SOURCE src/GLContextEmscripten.cpp)
148148
list(APPEND SOURCE src/RenderDeviceGLESImpl.cpp)
149149
list(APPEND SOURCE src/SwapChainGLImpl.cpp)
@@ -213,7 +213,7 @@ elseif(PLATFORM_MACOS)
213213
set(PRIVATE_DEPENDENCIES ${PRIVATE_DEPENDENCIES} GLEW::glew OpenGL::GL)
214214
elseif(PLATFORM_IOS)
215215
set(PRIVATE_DEPENDENCIES ${PRIVATE_DEPENDENCIES} ${OPENGLES})
216-
elseif(PLATFORM_EMSCRIPTEN)
216+
elseif(PLATFORM_WEB)
217217
else()
218218
message(FATAL_ERROR "Unknown platform")
219219
endif()
@@ -274,7 +274,7 @@ if(PLATFORM_MACOS)
274274
elseif(PLATFORM_IOS)
275275
# Silence GLES deprecation warnings
276276
target_compile_definitions(Diligent-GraphicsEngineOpenGL-static PUBLIC GLES_SILENCE_DEPRECATION)
277-
elseif(PLATFORM_EMSCRIPTEN)
277+
elseif(PLATFORM_WEB)
278278
target_link_options(Diligent-GraphicsEngineOpenGL-static PUBLIC "SHELL: -s FULL_ES3=1 -s USE_PTHREADS=1")
279279
endif()
280280

Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -95,7 +95,7 @@ class BufferGLImpl final : public BufferBase<EngineGLImplTraits>, public AsyncWr
9595
const Uint32 m_BindTarget;
9696
const GLenum m_GLUsageHint;
9797

98-
#if PLATFORM_EMSCRIPTEN
98+
#if PLATFORM_WEB
9999
struct MappedData
100100
{
101101
std::vector<Uint8> Data;

Graphics/GraphicsEngineOpenGL/include/EngineGLImplTraits.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -85,7 +85,7 @@ struct EngineGLImplTraits
8585
{
8686
#if PLATFORM_WIN32 || PLATFORM_LINUX || PLATFORM_MACOS
8787
static constexpr auto DeviceType = RENDER_DEVICE_TYPE_GL;
88-
#elif PLATFORM_ANDROID || PLATFORM_IOS || PLATFORM_EMSCRIPTEN
88+
#elif PLATFORM_ANDROID || PLATFORM_IOS || PLATFORM_WEB
8989
static constexpr auto DeviceType = RENDER_DEVICE_TYPE_GL;
9090
#else
9191
# error Unsupported platform

Graphics/GraphicsEngineOpenGL/include/GLContext.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -37,7 +37,7 @@
3737
# include "GLContextMacOS.hpp"
3838
#elif PLATFORM_IOS
3939
# include "GLContextIOS.hpp"
40-
#elif PLATFORM_EMSCRIPTEN
40+
#elif PLATFORM_WEB
4141
# include "GLContextEmscripten.hpp"
4242
#else
4343
# error Unsupported platform

Graphics/GraphicsEngineOpenGL/include/pch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -109,7 +109,7 @@
109109
# include <OpenGLES/ES3/glext.h>
110110
# include "GLStubsIOS.h"
111111

112-
#elif PLATFORM_EMSCRIPTEN
112+
#elif PLATFORM_WEB
113113

114114
# include <webgl/webgl1_ext.h>
115115
# include <webgl/webgl2.h>

0 commit comments

Comments
 (0)