Skip to content

[CMAKE] Enable multithreaded compilation for VC6 builds #1169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/build-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ jobs:
uses: actions/cache@v4
with:
path: build\${{ inputs.preset }}\_deps
key: cmake-deps-${{ inputs.preset }}-${{ hashFiles('cmake/**/*.cmake', '**/CMakeLists.txt') }}
restore-keys: |
cmake-deps-${{ inputs.preset }}-
key: cmake-deps-${{ inputs.preset }}-${{ hashFiles('CMakePresets.json','cmake/**/*.cmake','**/CMakeLists.txt') }}

- name: Download VC6 Portable from Cloudflare R2
if: ${{ startsWith(inputs.preset, 'vc6') && steps.cache-vc6.outputs.cache-hit != 'true' }}
Expand Down
4 changes: 2 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
{
"name": "vc6",
"displayName": "Windows 32bit VC6 Release",
"generator": "NMake Makefiles",
"generator": "Ninja",
"hidden": false,
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL",
"CMAKE_MSVC_DEBUG_INFORMATION_FORMAT": "$<$<CONFIG:Release,Debug,RelWithDebInfo>:ProgramDatabase>",
"CMAKE_MSVC_DEBUG_INFORMATION_FORMAT": "",
"CMAKE_BUILD_TYPE": "Release",
"RTS_FLAGS": "/W3"
},
Expand Down
7 changes: 7 additions & 0 deletions cmake/compilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ if (NOT IS_VS6_BUILD)
# Enforce strict __cplusplus version
add_compile_options(/Zc:__cplusplus)
endif()
else()
# Define two pools: 'compile' with plenty of slots, 'link' with just one
set_property(GLOBAL PROPERTY JOB_POOLS compile=0 link=1)
# Tell CMake that all compile steps go into 'compile'
set(CMAKE_JOB_POOL_COMPILE compile)
# and all link steps go into 'link' (so only one link ever runs since vc6 can't handle multithreaded linking)
set(CMAKE_JOB_POOL_LINK link)
endif()

if(RTS_BUILD_OPTION_ASAN)
Expand Down
Loading