Skip to content

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

Open
pmeems wants to merge 1 commit into
cmake-phase-1-corefrom
cmake-phase-2-activex
Open

pmeems wants to merge 1 commit into
cmake-phase-1-corefrom
cmake-phase-2-activex

Conversation

@pmeems

@pmeems pmeems commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Phase 2 of the CMake migration plan: the ActiveX control (MapWinGIS.ocx, static ATL, apartment threaded). The MSBuild .slnx build is unchanged.

Changes

  • cmake/MwgMidl.cmake: mwg_add_midl_target() runs midl.exe through one explicit custom command for every generator (Ninja has no .idl support), with the MSBuild options /W1 /char signed /env x64|win32 /target NT60. Output goes to <build>/src/MapWinGIS.ActiveX/midl, and an INTERFACE target exposes that directory (D3). It stops configure with a clear message when midl.exe is missing, or when cl.exe is not on PATH under Ninja.
  • src/MapWinGIS.ActiveX/CMakeLists.txt: SHARED target, OUTPUT_NAME MapWinGIS, SUFFIX .ocx. The .def, .rc and .rgs are sources. The .rc gets an OBJECT_DEPENDS on the generated .tlb, plus a target dependency on the MIDL target. _ATL_APARTMENT_THREADED is set on C/C++ only, RC gets /l0x0409, and the Windows libs from the audit are linked explicitly. DEFINE_SYMBOL "" keeps CMake's MapWinGIS_ActiveX_EXPORTS out. The six shared ActiveX sources are exported as MWG_ACTIVEX_SHARED_SOURCES for the tests (D4, Phase 3).
  • cmake/MwgCompilerOptions.cmake: /TC for C sources (CMake only emits /TP for C++).
  • Parity script: deliberate compile differences are explained as well, and the generated _i.c is matched by file name. .rc entries in compile_commands.json are skipped.
  • Docs: BUILDING.md (ATL/MIDL prerequisites, per-user registration) and the OCX parity status in CMAKE-MIGRATION.md.

Verification

  • Parity script, Debug/Release × x64/Win32 (Ninja): 0 lost options, 0 warnings for Core and the OCX. dumpbin shows identical dependents, the 5 COM exports (DllCanUnloadNow, DllGetClassObject, DllRegisterServer, DllUnregisterServer, DllInstall), and the same subsystem and DLL characteristics.
  • The generated type library is byte-identical to the MSBuild one. MapWinGIS.ActiveX_i.h is identical below its header comment.
  • 3 consecutive clean -j32 Ninja builds passed (no MIDL/RC race). The VS generator builds x64 Debug/Release and x86 Debug with 0 warnings.
  • COM: regsvr32 /n /i:user → New-Object -ComObject MapWinGIS6.Control → unregister works for the x64 and the Win32 OCX (32-bit PowerShell).
  • git status is clean after the builds; nothing is generated in the source tree.

Explained differences

The MIDL include directory moved per D3. There is no vcpkg include dir, because the OCX doesn't use GDAL directly. The .res name differs. The Core import library comes from target_link_libraries instead of the project reference.

Known limitations

  • The full Verify-ActiveXActivation.ps1 run moves to Phase 3, because it needs the test executable.
  • The VS generator x86 Release build and a VS-generator parity run were not done.
  • The .slnx build was not rebuilt in this worktree; no MSBuild file changed.

Dependencies

Stacked on #40 (Phase 1, cmake-phase-1-core), which is stacked on #39.

Co-authored-by: Junie <junie@jetbrains.com>
@pmeems
pmeems added this pull request to stack #42 October 31, 2026 11:45
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