Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(native): silence vendored warnings in the compiler's own words

esengine8dd4f23ae055
diff --git a/build-tools/utils/steamChannel.js b/build-tools/utils/steamChannel.js
index be050e306..b1fda422d 100644
--- a/build-tools/utils/steamChannel.js
+++ b/build-tools/utils/steamChannel.js
@@ -30,20 +30,24 @@ const CLOUD_ROOTS = {
linux: { root: 'LinuxHome', prefix: '.local/share/Estella' },
};
-/** What Steam launches, per OS, relative to the depot root. */
+/** What Steam launches, per OS, relative to the DEPOT root (which is not the
+ * export root — see depotMapping). */
function launchTarget(os, appName) {
if (os === 'macos') return `${appName}.app`;
return os === 'windows' ? `${appName}.exe` : appName;
}
-/** What the depot takes from the export directory. Everything else that is there
- * — the loose cooked content the app already carries — is excluded by not being
- * mapped, rather than by a rule someone has to maintain. */
+/**
+ * What the depot takes from the export directory.
+ *
+ * Always ANCHORED at the directory the assembler produced, never at the export
+ * root — the root also holds the loose cooked content the app already contains,
+ * so a `*` there would ship every asset twice and say nothing.
+ */
function depotMapping(os, appName) {
- const target = launchTarget(os, appName);
return os === 'macos'
- ? { LocalPath: `${target}/*`, DepotPath: `${target}/`, recursive: '1' }
- : { LocalPath: '*', DepotPath: '.', recursive: '1' };
+ ? { LocalPath: `${appName}.app/*`, DepotPath: `${appName}.app/`, recursive: '1' }
+ : { LocalPath: `${appName}/*`, DepotPath: '.', recursive: '1' };
}
/**
diff --git a/desktop/tests/steam-channel.test.ts b/desktop/tests/steam-channel.test.ts
index 1377fb2d8..a22e50cf4 100644
--- a/desktop/tests/steam-channel.test.ts
+++ b/desktop/tests/steam-channel.test.ts
@@ -37,6 +37,16 @@ describe('the Steam channel', () => {
expect(build).toContain('"SetLive"\t\t""');
});
+ it('anchors a Windows depot at the app directory too, not at the export root', async () => {
+ await emitSteamBuild({
+ outDir: out, appId: 480, appName: 'Spinner',
+ depots: [{ os: 'windows', depotId: 481 }],
+ });
+ const depot = readFileSync(path.join(out, 'steam', 'depot_481_windows.vdf'), 'utf8');
+ expect(depot).toContain('"LocalPath"\t\t"Spinner/*"');
+ expect(depot).not.toContain('"LocalPath"\t\t"*"');
+ });
+
it('maps only the app, so the loose content beside it is not uploaded', async () => {
// The export dir holds the cooked content AND the app that contains it;
// a depot that took both would ship every asset twice.
diff --git a/native/CMakeLists.txt b/native/CMakeLists.txt
index 4449cf172..3755f1341 100644
--- a/native/CMakeLists.txt
+++ b/native/CMakeLists.txt
@@ -41,6 +41,17 @@ if(ESTELLA_DESKTOP)
find_package(SDL3 CONFIG REQUIRED PATHS "${ESTELLA_SDL_DIR}" NO_DEFAULT_PATH)
endif()
+# Vendored third-party code is not ours to lint — and the flag that says so is not
+# the same word in every compiler, which is how a build that only ever ran on
+# clang passed `-w` to cl.exe and stopped at the first file.
+function(es_silence_warnings target)
+ if(MSVC)
+ target_compile_options(${target} PRIVATE /w)
+ else()
+ target_compile_options(${target} PRIVATE -w)
+ endif()
+endfunction()
+
set(REPO "${CMAKE_CURRENT_SOURCE_DIR}/..")
set(SRC "${REPO}/src")
set(TP "${REPO}/third_party")
@@ -90,7 +101,7 @@ target_compile_definitions(glm INTERFACE GLM_FORCE_RADIANS GLM_FORCE_DEPTH_ZERO_
file(GLOB_RECURSE YOGA_SOURCES "${TP}/yoga/*.cpp")
add_library(yogacore STATIC ${YOGA_SOURCES})
target_include_directories(yogacore PUBLIC "${TP}")
-target_compile_options(yogacore PRIVATE -Wno-unused-parameter)
+es_silence_warnings(yogacore)
# Box2D + the physics module's own TUs, compiled INTO the host. On the web physics
# ships as a separate wasm side module (dynamic linking, its own emscripten runtime);
@@ -135,7 +146,7 @@ endif()
add_library(spine_runtime STATIC ${SPINE_SOURCES})
target_include_directories(spine_runtime PUBLIC "${SPINE_INCLUDE}")
-target_compile_options(spine_runtime PRIVATE -w) # vendored, not ours to lint
+es_silence_warnings(spine_runtime)
string(REPLACE "." "" SPINE_TAG ${ESTELLA_SPINE_VERSION})
add_library(estella_spine STATIC
@@ -151,7 +162,7 @@ target_compile_definitions(estella_spine PRIVATE ES_SPINE_VERSION=${SPINE_TAG})
file(GLOB_RECURSE DRAGONBONES_SOURCES "${TP}/dragonbones/src/dragonBones/*.cpp")
add_library(dragonbones_runtime STATIC ${DRAGONBONES_SOURCES})
target_include_directories(dragonbones_runtime PUBLIC "${TP}/dragonbones/src" "${TP}/rapidjson")
-target_compile_options(dragonbones_runtime PRIVATE -w) # vendored, not ours to lint
+es_silence_warnings(dragonbones_runtime)
add_library(estella_dragonbones STATIC
"${SRC}/esengine/bindings/modules/dragonbones/DragonBonesModuleEntry.cpp"
@@ -255,7 +266,8 @@ if(ESTELLA_QUICKJS_DIR)
# zstd supercompression). Third-party, so silence their warnings.
set(BASIS_TRANSCODER "${TP}/basis_universal/transcoder/basisu_transcoder.cpp")
set(BASIS_ZSTD "${TP}/basis_universal/zstd/zstddeclib.c")
- set_source_files_properties("${BASIS_TRANSCODER}" "${BASIS_ZSTD}" PROPERTIES COMPILE_OPTIONS "-w")
+ set_source_files_properties("${BASIS_TRANSCODER}" "${BASIS_ZSTD}"
+ PROPERTIES COMPILE_OPTIONS "$<IF:$<BOOL:${MSVC}>,/w,-w>")
# The host, by concern: the runtime + the es_* bindings + the frame are shared,
# and each platform adds its own glue TU (the event loop, the window, the