Skip to content

Build for Windows Store (UWP) without app-side workarounds - #1065

Open
Coastrnaut wants to merge 2 commits into
projectM-visualizer:masterfrom
Coastrnaut:fix/windows-store-build
Open

Coastrnaut wants to merge 2 commits into
projectM-visualizer:masterfrom
Coastrnaut:fix/windows-store-build

Conversation

@Coastrnaut

@Coastrnaut Coastrnaut commented Nov 8, 2026 •

Copy link
Copy Markdown

Related to #1058

Configuring libprojectM with CMAKE_SYSTEM_NAME=WindowsStore currently fails to compile, so a UWP app has to patch the build (frontend-uwp#7 does this from its own CMakeLists.txt). This makes libprojectM build for UWP as is, and adds a CI job so it stays that way.

Changes

  • CRT deprecation errors: UWP projects enable SDL checks, which turn the CRT deprecation warnings into errors, in the vendored code (strdup, stricmp, fopen) and in GLProbe.cpp (sscanf). _CRT_SECURE_NO_WARNINGS and _CRT_NONSTDC_NO_WARNINGS are now defined for WindowsStore builds.
  • Windows defines: NOMINMAX, WIN32_LEAN_AND_MEAN and STBI_NO_DDS were only defined for PLATFORM_ID Windows; they're now also defined for WindowsStore.
  • GLES: UWP apps can't use desktop OpenGL, and glad's WGL loader doesn't compile there, so ENABLE_GLES is forced on, like for Android.
  • DLL loading: DynamicLibrary_win32.cpp uses LoadLibraryEx, GetModuleHandle and GetSystemDirectory, which UWP apps can't call. The new DynamicLibrary_uwp.cpp loads the EGL/GLES provider (e.g. ANGLE) from the app package with LoadPackagedLibrary, using the existing kAllEglModuleNames list. DynamicLibrary_win32.cpp is skipped for UWP via a PLATFORM_WINDOWS_STORE_APP macro based on WINAPI_FAMILY_PARTITION.
  • getenv: UWP apps have no process environment, so EnvFlagEnabled() treats all GL resolver flags as unset there.
  • CI: a build-uwp job in build_windows.yml builds Debug and Release for x64 and Win32 on windows-2022 with the v142 toolset (the setup frontend-uwp's CI uses).

Desktop builds compile the same code as before.

Testing

  • UWP x64 and Win32 Release builds succeed locally (VS 2026, v145 toolset) without any workarounds; master fails with 28 errors. The DLLs only import API sets and _APP CRT libraries available to UWP apps (including LoadPackagedLibrary), no opengl32, LoadLibraryEx or GetModuleHandle. I don't have the v142 toolset locally, so the new CI job is its first v142 build.
  • Desktop: unit tests pass, the default GL resolver still works, and all 14,536 presets from cream-of-the-crop, en-d, milkdrop-original and projectm-classic give the same shader compile/link results and preset load failures as master.

Note for frontend-uwp#7: it compiles its own DynamicLibrary_uwp.cpp in place of DynamicLibrary_win32.cpp. With this change that would give duplicate symbols, so once its submodule moves past this, it should drop that workaround (the others become unnecessary but don't break anything).

Retested on current master (2026-11-12)

Configuring libprojectM with CMAKE_SYSTEM_NAME=WindowsStore failed to
compile, so apps had to patch the build:

- UWP projects enable SDL checks, which turn the CRT deprecation warnings
  (strdup, stricmp, fopen, sscanf) into errors. Define
  _CRT_SECURE_NO_WARNINGS and _CRT_NONSTDC_NO_WARNINGS for these builds.
- NOMINMAX, WIN32_LEAN_AND_MEAN and STBI_NO_DDS were only defined when the
  platform is Windows, not WindowsStore.
- Desktop OpenGL isn't available to UWP apps, and glad's WGL loader doesn't
  compile there, so force ENABLE_GLES on, like for Android.
- DynamicLibrary_win32.cpp uses LoadLibraryEx, GetModuleHandle and
  GetSystemDirectory, which UWP apps can't call. Add DynamicLibrary_uwp.cpp,
  which loads the EGL/GLES provider (e.g. ANGLE) from the app package with
  LoadPackagedLibrary.
- UWP apps have no process environment, so treat all GL resolver
  environment flags as unset instead of calling getenv.

Desktop builds compile the same code as before.

Related to projectM-visualizer#1058
Adds a job that configures with CMAKE_SYSTEM_NAME=WindowsStore and builds
Debug and Release for x64 and Win32, so changes that break UWP builds are
caught here instead of in the Windows Store app.

Related to projectM-visualizer#1058

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant