Skip to content

build(cmake): Add retail compatibility option in CMake config - #2379

Merged
xezon merged 3 commits into
TheSuperHackers:mainfrom
tintinhamans:arctic/build-no-retail
Sep 13, 2026
Merged

build(cmake): Add retail compatibility option in CMake config#2379
xezon merged 3 commits into
TheSuperHackers:mainfrom
tintinhamans:arctic/build-no-retail

Conversation

@tintinhamans

@tintinhamans tintinhamans commented Mar 2, 2026

Copy link
Copy Markdown

This pull request adds the RTS_BUILD_OPTION_RETAIL_COMPATIBLE_GAME configuration
option in cmake/config-retail.cmake to make it easier to build retail or non-retail.

Will eventually be used for #2322

Tri-state, matching cmake/config-debug.cmake:

Value
DEFAULT follows GameDefines.h
ON forces RETAIL_COMPATIBLE_* guards on
OFF forces RETAIL_COMPATIBLE_* guards off

The guard list is read from GameDefines.h at configure time, so new guards don't need CMake change.

The DEFAULT/ON/OFF dispatch is shared with config-debug.cmake via new helper macros in
config-macros.cmake (define_tristate_option).

Only the VC6 SP6 compiler produces a build that is CRC-compatible with retail,
other toolchains get a note. Skipped when OFF.

Retail compatibility: MSVC 19.44.35228.0 is not CRC-compatible with retail.
Retail builds need the VC6 SP6 compiler (12.00.8804).

@greptile-apps

greptile-apps Bot commented Mar 2, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds a tri-state retail-compatibility build option and extracts shared CMake helpers for tri-state configuration.

  • Collects retail compatibility guards from GameDefines.h during configuration.
  • Supports DEFAULT, ON, and OFF retail compatibility settings.
  • Reuses the shared tri-state helper for existing debug options.
  • Warns when a requested retail-compatible build uses a compiler that cannot produce retail-compatible CRCs.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains within the eligible follow-up scope.

No blocking failure remains.

Important Files Changed

Filename Overview
cmake/config-macros.cmake Adds shared helpers for collecting compile-time guards and dispatching tri-state build options; no follow-up-eligible finding is retained.
cmake/config-retail.cmake Adds the retail compatibility option, guard collection, and compiler compatibility notice; the previously questioned PRESERVE_* behavior was confirmed intentional.
cmake/config-debug.cmake Migrates existing debug tri-state options to the shared helper.
cmake/config.cmake Includes the new shared macro and retail configuration modules.

Reviews (16): Last reviewed commit: "refactor(cmake): Improve guarded option ..." | Re-trigger Greptile

@tintinhamans
tintinhamans requested a review from bobtista March 2, 2026 15:39
@bobtista

bobtista commented Mar 2, 2026

Copy link
Copy Markdown

Looks good to me, is there a reason we're not just adding ALL of the gamedefines macros? eg USE_BUFFERED_IO, USE_OBSOLETE_GENERALS_CODE, TELL_COMPUTER_IDENTITY_IN_LAN_LOBBY.

Also, maybe it's pedantic, but RTS_BUILD_OPTION_RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION is probably a CMakeDependentOption of RTS_BUILD_OPTION_RETAIL_COMPATIBLE_PATHFINDING. Not needed though, this works as is.

Comment thread cmake/config-build.cmake Outdated
@xezon xezon added the Build Anything related to building, compiling label Mar 2, 2026
@bobtista

Copy link
Copy Markdown

Should we revive this one? Are we using RTS_BUILD_OPTION_RETAIL_COMPATIBLE_GAME? adding ALL of the gamedefines macros? If the individual switches remain, PATHFINDING_ALLOCATION should be dependent on PATHFINDING, and CI should compile at least one non-default configuration.

@tintinhamans
tintinhamans force-pushed the arctic/build-no-retail branch from b3fca3b to 00cb6c5 Compare August 28, 2026 16:11
@tintinhamans

Copy link
Copy Markdown
Author

Revived and simplified this based on the feedback.

The individual switches have been replaced with a single RTS_BUILD_OPTION_RETAIL_COMPATIBLE_GAME option. Disabling it turns off all current RETAIL_COMPATIBLE_* defines.

I realized I didn't need to define every GameDefines.h macro as a CMake option because they can already be accessed with RTS_FLAGS.

@tintinhamans tintinhamans changed the title build(cmake): Add retail compatibility options and features in CMake config build(cmake): Add retail compatibility option in CMake config Aug 28, 2026
@tintinhamans
tintinhamans requested review from Mauller and xezon August 28, 2026 16:13
@bobtista

Copy link
Copy Markdown

Should we have at least one of the RTS_BUILD_OPTION_RETAIL_COMPATIBLE_GAME set to OFF for ci?

@tintinhamans

Copy link
Copy Markdown
Author

Should we have at least one of the RTS_BUILD_OPTION_RETAIL_COMPATIBLE_GAME set to OFF for ci?

Was planning on doing that in a follow-up PR.

@xezon xezon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Makes sense.

Comment thread cmake/config-build.cmake Outdated
@xezon

xezon commented Sep 5, 2026

Copy link
Copy Markdown

Has unaddressed comments. Needs rebase

@tintinhamans
tintinhamans force-pushed the arctic/build-no-retail branch from 00cb6c5 to 424974d Compare September 7, 2026 19:58
@tintinhamans

Copy link
Copy Markdown
Author

Has unaddressed comments. Needs rebase

Rebased onto main and updated the description for the option to better reflect that turning it off enables all the non-retail gameplay and simulation fixes.

@tintinhamans
tintinhamans force-pushed the arctic/build-no-retail branch from 424974d to d833a31 Compare September 7, 2026 20:06
Comment thread cmake/config-build.cmake Outdated
@tintinhamans
tintinhamans force-pushed the arctic/build-no-retail branch from d833a31 to a77329a Compare September 7, 2026 20:10
Comment thread cmake/config-build.cmake Outdated
@tintinhamans
tintinhamans force-pushed the arctic/build-no-retail branch from a77329a to 8820b04 Compare September 8, 2026 08:39
Comment thread cmake/config-build.cmake Outdated
@greptile-apps

This comment was marked as off-topic.

Comment thread cmake/config-retail.cmake
@tintinhamans

Copy link
Copy Markdown
Author

Updated to be tri-state and made it also detect RETAIL_COMPATIBLE_* guards dynamically.

Also warns when you use this feature with non-VC6SP6 compiler since that won't produce a truly retail-compatible build.

@tintinhamans
tintinhamans requested a review from xezon September 10, 2026 21:52
Comment thread cmake/config-retail.cmake Outdated
Comment thread cmake/config-retail.cmake Outdated
Comment thread cmake/config-retail.cmake Outdated
Comment thread cmake/config-debug.cmake Outdated
Comment thread cmake/config-macros.cmake Outdated
Comment thread cmake/config-macros.cmake Outdated
Comment thread cmake/config-macros.cmake Outdated
Comment thread cmake/config-macros.cmake Outdated
Comment thread cmake/config-macros.cmake Outdated
Comment thread cmake/config-macros.cmake Outdated
Comment thread cmake/config-macros.cmake Outdated
Comment thread cmake/config-macros.cmake Outdated
@tintinhamans
tintinhamans force-pushed the arctic/build-no-retail branch 2 times, most recently from 7fb6058 to b32297e Compare September 12, 2026 13:56
@tintinhamans
tintinhamans requested a review from xezon September 12, 2026 13:57
Comment thread cmake/config-debug.cmake Outdated
Signed-off-by: tintinhamans <5984296+tintinhamans@users.noreply.github.com>

@xezon xezon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks clean now.

Comment thread cmake/config-retail.cmake
define_tristate_option(RTS_BUILD_OPTION_RETAIL_COMPATIBLE_GAME RetailCompatibleGame "Build with Retail Compatibility" "${_retail_guards}" "")
unset(_retail_guards)

if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "12.0.8804" AND NOT RTS_BUILD_OPTION_RETAIL_COMPATIBLE_GAME STREQUAL "OFF")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This version number is correct, yes? CL.EXE looks like this for me.

Image

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, CMake sees CMAKE_CXX_COMPILER_VERSION: 12.0.8804. You can confirm by looking at the configure output.

@xezon
xezon merged commit 2aca7d6 into TheSuperHackers:main Sep 13, 2026
1 check passed
@tintinhamans
tintinhamans deleted the arctic/build-no-retail branch September 13, 2026 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build Anything related to building, compiling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants