Skip to content

CMake Introduce CMake as the Primary Build System for MapWinGIS6 - #40

Open
pmeems wants to merge 1 commit into
cmake-phase-0-auditfrom
cmake-phase-1-core
Open

pmeems wants to merge 1 commit into
cmake-phase-0-auditfrom
cmake-phase-1-core

Conversation

@pmeems

@pmeems pmeems commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Phase 1 of the CMake migration plan: CMake foundation and the MapWinGIS.Core DLL. The MSBuild .slnx build is unchanged and stays the supported build until the later phases land.

Changes

  • Root CMakeLists.txt (CMake 3.28+, project(MapWinGIS6 VERSION 6.0.0 LANGUAGES C CXX)), restricted to Debug;Release.
  • cmake/MwgVcpkg.cmake: runs before project(). Resolves the vcpkg root (MWG_VCPKG_ROOT, ../vcpkg, VCPKG_ROOT, as bootstrap-vcpkg.ps1 does), pins the triplets, and uses its own install tree vcpkg_installed/cmake-<Platform>. The tests feature follows MWG_BUILD_TESTS.
  • cmake/MwgPlatform.cmake: checks MSVC ≥ 19.50 (v145), that the architecture matches the triplet (a fatal error with a CLion hint), and the Windows SDK (pinned for VS, a warning under Ninja).
  • cmake/MwgFlagOverrides.cmake and cmake/MwgCompilerOptions.cmake: CMake's MSVC default flags (/DWIN32 /D_WINDOWS ...) are cleared, and mwg_apply_common_options() applies the audited MSBuild options PRIVATE per target. That includes _WINDLL, /JMC, PDBs in Release, and the Win32 defaults /Oy- /analyze- /SAFESEH.
  • cmake/MwgRuntimeDeploy.cmake: MapWinGIS.RuntimeData copies share/gdal → gdal-data and share/proj → proj, using a stamp file. It keeps MWG_DEPLOY_RUNTIME_DATA and the missing-data warning.
  • src/MapWinGIS.Core/CMakeLists.txt: explicit source lists with source_group(TREE), PUBLIC include/, PRIVATE src/, DEFINE_SYMBOL MWG_CORE_BUILD, and PRIVATE GDAL::GDAL GEOS::geos_c.
  • CMakePresets.json: Ninja x64-debug|release and x86-debug|release, plus vs2026-x64|x86 (-T v145), with matching build and test presets. Output goes to out/b/<preset>/bin, never to bin/.
  • Parity script: case-insensitive link options, an "explained" list for deliberate link differences, and a warning when a binary was not relinked.
  • Docs: CMake section in BUILDING.md, parity status in CMAKE-MIGRATION.md.

Verification

  • The parity script reports 0 lost compile/link options and 0 warnings for Core in Debug and Release, x64 and Win32.
  • dumpbin: identical dependents, 260 exports, subsystem and DLL characteristics. The embedded manifest is byte-identical.
  • The VS presets configure and build (x64 Debug/Release, x86 Debug).
  • MSBuild Debug|x64 still builds; 173 tests run (170 pass, 3 skipped as before). The two output trees don't overlap.
  • Configure rejects RelWithDebInfo and an architecture/triplet mismatch.

Explained differences

The manifest switches are handled by CMake's link wrapper. vcpkg auto-link is replaced by explicit imported targets. odbc32/odbccp32 are unused MSBuild defaults, and /TLBID:1 only matters for the OCX. The imported targets add /I.../include/geos and, in Debug, GDAL_DEBUG.

Known limitations

  • CLion profiles were not verified interactively.
  • Ninja cannot pin the Windows SDK.
  • The Core tests run under CMake from Phase 3.

Dependencies

Stacked on #39 (Phase 0, cmake-phase-0-audit).

Co-authored-by: Junie <junie@jetbrains.com>
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