Skip to content

Add a portable multi-platform Visual Studio solution - #240

Merged
danoli3 merged 7 commits into
masterfrom
feat/portable-vs-platforms
Oct 30, 2026
Merged

danoli3 merged 7 commits into
masterfrom
feat/portable-vs-platforms

Conversation

@danoli3

@danoli3 danoli3 commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Visual Studio users currently need separate CMake solutions for each architecture, and those generated build trees contain location-specific paths. Add vs2022-all and vs2026-all presets that generate visualstudio/FreeImage.sln with Win32, x64, ARM64, ARM64EC and All Platforms selections.

The solution uses Visual Studio Makefile projects to run the authoritative CMake build with the selected architecture. Static/DLL and codec feature settings are copied to each build. Source/include references use relative paths and MSBuild directory macros; moving the whole tree creates fresh internal architecture caches automatically. Build, rebuild and clean use separate architecture/configuration output directories.

This is an optional CMake-backed IDE front end. It requires CMake on PATH and the matching Visual Studio C++ toolsets. It supports bundled dependencies/native MSVC; external SDK toolchains and system libraries still need their own architecture configurations. The README documents the commands and scope.

Validation:

  • Local tests cover both VS generator versions, static/DLL settings, solution configuration mappings and source references after relocation into paths with spaces and ampersands.
  • Normal host configuration and workflow/YAML checks pass.
  • New Windows jobs build static/DLL fixtures through MSBuild, move a previously built tree, build all four platforms, run native probes, and check rebuild/clean behavior.
  • A full VS 2026 job builds FreeImage and its default bundled codecs through All Platforms, inspects all four library machine types, and runs x64/Win32 TestAPI suites.

Addresses #235 and #238.

@danoli3

danoli3 commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner Author

The generation commands are now documented in the README. Run these on Windows with CMake 4.2+ and Visual Studio 2026, with the matching C++ architecture toolsets installed.

One solution with all platforms in the dropdown

cmake --preset vs2026-all
cmake --build build-vs2026-all --config Release --target FreeImageAllPlatforms

Open build-vs2026-all/visualstudio/FreeImage.sln. Its platform dropdown contains Win32, x64, ARM64, ARM64EC, and All Platforms. Select an individual platform to build that architecture, or All Platforms to build all four. This solution calls CMake behind the IDE; CMake must remain on PATH.

32-bit x86 only

cmake --preset vs2026 -A Win32 -B build-vs2026-win32
cmake --build build-vs2026-win32 --config Release

Open build-vs2026-win32/FreeImage.sln.

ARM64 only

cmake --preset vs2026 -A ARM64 -B build-vs2026-arm64
cmake --build build-vs2026-arm64 --config Release

Open build-vs2026-arm64/FreeImage.sln.

ARM64EC only

cmake --preset vs2026 -A ARM64EC -B build-vs2026-arm64ec
cmake --build build-vs2026-arm64ec --config Release

64-bit x86 only

cmake --preset vs2026 -A x64 -B build-vs2026-x64
cmake --build build-vs2026-x64 --config Release

Each single-architecture directory contains its own FreeImage.sln and fixed-architecture CMake cache. Use --config Debug for Debug builds. For VS 2022, substitute vs2022 / vs2022-all and corresponding output directory names.

Validation: VS 2022 and VS 2026 platform/relocation tests passed, and the full VS 2026 CMake all-platform target built FreeImage for all four architectures, verified library machine types, and passed x64/Win32 TestAPI suites.

VS 2019 scope: the combined frontend in this PR currently supports VS 2022 and VS 2026. VS 2019 is not enabled or validated for this mode. A v142 variant could support Win32, x64 and ARM64; ARM64EC requires VS 2022 17.3 or later.

@danoli3
danoli3 merged commit a5e10e8 into master Oct 30, 2026
91 checks passed
@SanderBouwhuis

SanderBouwhuis commented Nov 1, 2026 •

Copy link
Copy Markdown

@danoli3
I do not see the 32-bit platform.

According to this document https://github.com/danoli3/FreeImage/blob/master/doc/visual-studio.md I should be able to get all the projects in a single solution by performing the steps below.

  1. I downloaded the current code
  2. I extracted the FreeImage-master.zip file to Q:\FreeImage
  3. I open a cmd window in Q:\FreeImage
  4. I executed this command : cmake --preset vs2026-all
  5. I openened Q:\FreeImage\build-vs2026-all\FreeImage.slnx
  6. But, the 32-bit platform is missing
2026-11-01 08-06-58 FreeImage_-_Microsoft_Visual_Studio_(Administrator

@SanderBouwhuis

Copy link
Copy Markdown

@danoli3
Bump. Did you maybe not see my comment from a few days ago?

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.

2 participants