Skip to content

Commit 6f98469

Browse files
authored
[CMAKE] Enable multithreaded compilation for VC6 builds (#1169)
1 parent 3bda27a commit 6f98469

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ jobs:
4848
uses: actions/cache@v4
4949
with:
5050
path: build\${{ inputs.preset }}\_deps
51-
key: cmake-deps-${{ inputs.preset }}-${{ hashFiles('cmake/**/*.cmake', '**/CMakeLists.txt') }}
52-
restore-keys: |
53-
cmake-deps-${{ inputs.preset }}-
51+
key: cmake-deps-${{ inputs.preset }}-${{ hashFiles('CMakePresets.json','cmake/**/*.cmake','**/CMakeLists.txt') }}
5452

5553
- name: Download VC6 Portable from Cloudflare R2
5654
if: ${{ startsWith(inputs.preset, 'vc6') && steps.cache-vc6.outputs.cache-hit != 'true' }}

CMakePresets.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
{
1010
"name": "vc6",
1111
"displayName": "Windows 32bit VC6 Release",
12-
"generator": "NMake Makefiles",
12+
"generator": "Ninja",
1313
"hidden": false,
1414
"binaryDir": "${sourceDir}/build/${presetName}",
1515
"cacheVariables": {
1616
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
1717
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL",
18-
"CMAKE_MSVC_DEBUG_INFORMATION_FORMAT": "$<$<CONFIG:Release,Debug,RelWithDebInfo>:ProgramDatabase>",
18+
"CMAKE_MSVC_DEBUG_INFORMATION_FORMAT": "",
1919
"CMAKE_BUILD_TYPE": "Release",
2020
"RTS_FLAGS": "/W3"
2121
},

cmake/compilers.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ if (NOT IS_VS6_BUILD)
3636
# Enforce strict __cplusplus version
3737
add_compile_options(/Zc:__cplusplus)
3838
endif()
39+
else()
40+
# Define two pools: 'compile' with plenty of slots, 'link' with just one
41+
set_property(GLOBAL PROPERTY JOB_POOLS compile=0 link=1)
42+
# Tell CMake that all compile steps go into 'compile'
43+
set(CMAKE_JOB_POOL_COMPILE compile)
44+
# and all link steps go into 'link' (so only one link ever runs since vc6 can't handle multithreaded linking)
45+
set(CMAKE_JOB_POOL_LINK link)
3946
endif()
4047

4148
if(RTS_BUILD_OPTION_ASAN)

0 commit comments

Comments
 (0)