Skip to content

Enable Windows Emscripten build #362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mcbarton
Copy link
Collaborator

Description

Please include a summary of changes, motivation and context for this PR.

This PR enable xeus-cpp to be cross compiled to Emscripten on a Windows platform (following Emscripten build instructions in CppInterOp). The 2 changes are as follows

  1. Add .bat suffix to embuilder if on Windows (otherwise it uses the one made for Unix systems and errors)
  2. Change \ to / in ESCAPED_XEUS_CPP_RESOURCE_DIR and ESCAPED_SYSROOT_PATH (\ gets removed from the preloaded path otherwise)

To see these changing allow an Emscripten build of xeus-cpp to work and pass all Emscripten tests, see this PR in CppInterOp compiler-research/CppInterOp#647

Fixes # (issue)

Type of change

Please tick all options which are relevant.

  • Bug fix
  • New feature
  • Added/removed dependencies
  • Required documentation updates

@codecov-commenter
Copy link

codecov-commenter commented Jun 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.78%. Comparing base (3d2e16f) to head (5391dcd).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #362   +/-   ##
=======================================
  Coverage   81.78%   81.78%           
=======================================
  Files          20       20           
  Lines         950      950           
  Branches       87       87           
=======================================
  Hits          777      777           
  Misses        173      173           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

CMakeLists.txt Outdated
@@ -432,8 +432,11 @@ endif()

if(EMSCRIPTEN)
# Ensure required SDL2 ports (e.g. SDL2) are built before header preloading
if (CMAKE_C_COMPILER MATCHES ".bat")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a better way to detect the if the compiler is running on windows: emscripten-core/emscripten#3191

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the way we have been detecting we are doing an Emscripten build of Windows within CppInterOp. Its possible we might just be able to use EMCC_SUFFIX from the Emscripten.cmake file, which we use as part of the build. Its probably more reliable too, since it will update with whatever Emscripten decides the suffix should be. I will modify the cmake to use this, and then rerun the workflow in CppInterOp to check it works.

@vgvassilev
Copy link
Contributor

Do we want to work in the windows ci here, too?

@mcbarton
Copy link
Collaborator Author

mcbarton commented Jul 14, 2025

Do we want to work in the windows ci here, too?

@vgvassilev xeus-cpp uses Emscripten forges emsdk, which is only available for very particular platforms. When we asked previously for them to make emsdk available on Windows before the request was rejected. I could add a Windows Emscripten build here too, but we would need to get the upstream emsdk to achieve this. What would you like me to do?

@mcbarton mcbarton force-pushed the Enable-Windows-Emscripten-build branch from d31dfa4 to 5391dcd Compare July 14, 2025 19:28
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.

3 participants