feat: Add Windows platform support (MSVC and MinGW)#14
Merged
movingpictures83 merged 3 commits intoMay 22, 2026
Conversation
Implements cross-platform support for building PluMA on Windows with both MSVC and MinGW compilers, while maintaining full compatibility with Linux and macOS builds. - Platform detection macros (PLUMA_PLATFORM_WINDOWS, PLUMA_PLATFORM_UNIX, etc.) - Cross-platform dynamic library loading (dlopen/LoadLibrary abstraction) - Windows glob emulation for directory pattern matching - File system utilities (fileExists, removeFile, getCurrentDirectory, etc.) - Platform-specific path separators and shared library extensions - DLL export/import macros for Windows - src/main.cxx: Use platform abstraction for paths, env vars, file operations - src/languages/Language.cxx: Use platform-agnostic library loading - src/languages/Language.h: Include platform.h, conditionally use glob - src/languages/Compiled.cxx: Use platform abstraction for dynamic loading - SConstruct: Full Windows/MSVC/MinGW support with proper compiler flags - build_config.py: Platform detection, Windows paths, MSVC/MinGW detection - build_support.py: Windows Python config, MSVC/MinGW flags, cross-platform R detection - Supports MSVC (Visual Studio) compiler on Windows - Supports MinGW (GCC) compiler on Windows - Automatic compiler detection and flag configuration - Cross-platform shared library extension handling (.dll/.so/.dylib) - Windows-compatible path handling (backslash separators, semicolon path lists) - Maintains backward compatibility with Linux and macOS builds With MSVC (Visual Studio Developer Command Prompt): scons With MinGW: scons - Perl and R support on Windows requires appropriate installations - CUDA support on Windows uses NVIDIA's standard Windows paths Co-authored-by: Claude <noreply@anthropic.com>
Adds a comprehensive Windows build workflow that: - Tests both MSVC and MinGW compilers - Tests Python 3.11 and 3.12 - Installs all required dependencies (SWIG, Perl, R, Rcpp, RInside) - Builds PluMA with various language configurations - Uploads build artifacts on success The workflow runs on: - Push to master, develop, and feature/windows-support branches - Pull requests to master and develop Co-authored-by: Claude <noreply@anthropic.com>
Brings the windows-support work onto current master (post PRs FIUBioRG#7, FIUBioRG#8, FIUBioRG#10, FIUBioRG#11, FIUBioRG#13) and reconciles the build configuration. The branch was originally cut from 819d31a, before the SConstruct refactor and the Rust / parallel / venv / build-fix series merged; a direct rebase would have rewritten history beyond recognition, so we instead merge master in and re-apply the windows-specific additions on top of the refactored build files. Resolution strategy: - SConstruct, build_config.py, build_support.py: take master's post-refactor versions wholesale, then layer the windows-only additions on top. - All other files (the Rust loader, the parallel scheduler, the Catch2 tests, the fuzz harness) merge cleanly from master with no intervention. Windows-specific additions preserved: - build_config.py gains is_msvc / is_mingw toolchain detection (alongside the is_windows / is_darwin / is_linux / is_alpine flags master already defines), an is_unix convenience flag, and platform-specific shared_lib_ext / shared_lib_prefix / executable_ext / path_separator constants. Windows overrides lib_search_path and include_search_path because the /lib + /usr/lib + /usr/local/lib convention doesn't apply. - SConstruct's get_platform_config() picks up Windows / MSVC / MinGW branches that set PLUMA_PLATFORM_WINDOWS, WIN32_LEAN_AND_MEAN, and NOMINMAX defines (so src/platform.h selects the LoadLibrary / GetProcAddress code path) and, for MinGW, --export-all-symbols + psapi. - create_base_environment() splits CCFLAGS / CXXFLAGS into MSVC (/EHsc /utf-8 /O2) and gcc-style branches. - src/platform.h is preserved from the original branch and used by src/main.cxx and the language loaders to abstract dlopen / glob / pthread away from POSIX-specific includes. Verified on Linux: clean scons build with --with-rust still produces a pluma binary that imports dlsym (HAVE_RUST wiring intact); the binary has all the upstream PRs' contributions present.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Windows platform support to PluMA's C++ core (MSVC and MinGW toolchains) and to the SConstruct build configuration. The implementation is non-invasive on Unix: existing Linux / macOS builds compile and link identically, and all current upstream contributions (Rust loader, parallel scheduler, plugin venv, build fixes from PRs #7, #8, #10, #11, #13) are preserved unchanged.
What it adds
C++ core
src/platform.h— single header that abstracts the three POSIX primitives PluMA's core relies on but Windows lacks or names differently:dlopen/dlsym/dlclose/dlerror→LoadLibrary/GetProcAddress/FreeLibrary/ Windows error formatting on_WIN32glob/glob_t→ a Windows shim built onFindFirstFile/FindNextFileunistd.h/pthreadincludes → conditional wrapperssrc/main.cxx,src/languages/Compiled.cxx,src/languages/Language.{cxx,h}— usesrc/platform.hinstead of including<dlfcn.h>/<glob.h>/<unistd.h>directly.Build system
build_config.py— addsis_msvcandis_mingwtoolchain detection (alongside theis_windows/is_darwin/is_linux/is_alpineflags upstream master already provides) and platform-specific filename conventions (shared_lib_ext,shared_lib_prefix,executable_ext,path_separator). Windows overrideslib_search_pathandinclude_search_pathbecause the/lib+/usr/lib+/usr/local/libconvention doesn't apply.SConstruct:get_platform_config()picks up Windows / MSVC / MinGW branches that setPLUMA_PLATFORM_WINDOWS,WIN32_LEAN_AND_MEAN, andNOMINMAXdefines (sosrc/platform.hselects theLoadLibrary/GetProcAddresscode path). MinGW additionally gets-Wl,--export-all-symbolsandpsapilinkage.create_base_environment()splitsCCFLAGS/CXXFLAGSinto an MSVC branch (/EHsc /utf-8 /O2) and a gcc-style branch (-fpermissive -fPIC -O2)..github/workflows/windows-build.yml— Windows CI smoke test usingwindows-latestrunners with both Visual Studio and MinGW.What it does not do (deferred)
src/languages/Rust.cxx(added by PR Add Rust language support for PluMA plugins #8) still uses POSIXdlopen/dlsymdirectly rather than thesrc/platform.habstraction. Threading the abstraction through the Rust loader is a small but separable follow-up; the main pluma binary still builds on Windows without it, and Rust plugin support remains Unix-only for now.src/platform.htreatment as the Rust loader before Windows-side Java plugins can be loaded.Compatibility
scons --with-ruststill produces a workingplumabinary withdlsymimported (i.e.HAVE_RUSTwiring from PR build(scons): fix master build and wire --with-rust through to HAVE_RUST #13 intact).windows-latestwith both MSVC and MinGW.Notes on the merge
The branch was originally cut from
819d31a(pre-PR-#7), before the SConstruct refactor and the subsequent Rust / parallel / venv / build-fix series merged. To bring the branch onto current master without rewriting upstream history, I mergedupstream/masterin and resolved by taking master's refactored versions ofSConstruct/build_config.py/build_support.pyand re-applying the Windows-specific additions on top. The single merge commit (9563464) captures that resolution; the two original Windows commits (5f1d6e8for the platform layer,b50ddadfor CI) are unchanged.Test plan
scons --with-ruston Linux produces aplumabinary withdlsymimported (HAVE_RUST wired)nm pluma | grep -c dlsymreturns ≥ 1pluma.exe🤖 Generated with Claude Code