diff --git a/.github/workflows/build-toolchain.yml b/.github/workflows/build-toolchain.yml index 216d8d82c6..dbcc884076 100644 --- a/.github/workflows/build-toolchain.yml +++ b/.github/workflows/build-toolchain.yml @@ -11,10 +11,14 @@ on: required: true type: string description: "Game to build (Generals, GeneralsMD)" - preset: + configurePreset: required: true type: string - description: "CMake preset" + description: "CMake configure preset" + buildPreset: + required: true + type: string + description: "CMake build preset" tools: required: false default: true @@ -25,10 +29,9 @@ on: default: false type: boolean description: "Build extras" - jobs: build: - name: ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} + name: ${{ inputs.game }} ${{ inputs.configurePreset }} ${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} runs-on: windows-2022 timeout-minutes: 20 steps: @@ -36,7 +39,7 @@ jobs: uses: actions/checkout@v4 - name: Cache VC6 Installation - if: startsWith(inputs.preset, 'vc6') + if: startsWith(inputs.buildPreset, 'vc6') id: cache-vc6 uses: actions/cache@v4 with: @@ -47,11 +50,11 @@ jobs: id: cache-cmake-deps uses: actions/cache@v4 with: - path: build\${{ inputs.preset }}\_deps - key: cmake-deps-${{ inputs.preset }}-${{ hashFiles('CMakePresets.json','cmake/**/*.cmake','**/CMakeLists.txt') }} + path: build\${{ inputs.buildPreset }}\_deps + key: cmake-deps-${{ inputs.buildPreset }}-${{ 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' }} + if: ${{ startsWith(inputs.buildPreset, 'vc6') && steps.cache-vc6.outputs.cache-hit != 'true' }} env: AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} @@ -76,26 +79,14 @@ jobs: Remove-Item VS6_VisualStudio6.7z -Verbose - name: Set Up VC6 Environment - if: startsWith(inputs.preset, 'vc6') + if: startsWith(inputs.buildPreset, 'vc6') shell: pwsh run: | - # Define the base directories as local variables first - $VSCommonDir = "C:\VC6\VC6SP6\Common" - $MSDevDir = "C:\VC6\VC6SP6\Common\msdev98" - $MSVCDir = "C:\VC6\VC6SP6\VC98" - $VcOsDir = "WINNT" - - # Set the variables in GitHub environment - "VSCommonDir=$VSCommonDir" >> $env:GITHUB_ENV - "MSDevDir=$MSDevDir" >> $env:GITHUB_ENV - "MSVCDir=$MSVCDir" >> $env:GITHUB_ENV - "VcOsDir=$VcOsDir" >> $env:GITHUB_ENV - "PATH=$MSDevDir\BIN;$MSVCDir\BIN;$VSCommonDir\TOOLS\$VcOsDir;$VSCommonDir\TOOLS;$env:PATH" >> $env:GITHUB_ENV - "INCLUDE=$MSVCDir\ATL\INCLUDE;$MSVCDir\INCLUDE;$MSVCDir\MFC\INCLUDE;$env:INCLUDE" >> $env:GITHUB_ENV - "LIB=$MSVCDir\LIB;$MSVCDir\MFC\LIB;$env:LIB" >> $env:GITHUB_ENV + $VS6_DIR = "C:\VC6\VC6SP6" + "VS6_DIR=$VS6_DIR" >> $env:GITHUB_ENV - name: Set Up VC2022 Environment - if: startsWith(inputs.preset, 'win32') + if: ${{ !startsWith(inputs.buildPreset, 'vc6') }} uses: ilammy/msvc-dev-cmd@v1 with: arch: x86 @@ -103,12 +94,12 @@ jobs: - name: Setup vcpkg uses: lukka/run-vcpkg@v11 - - name: Configure ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset + - name: Configure ${{ inputs.game }} with CMake Using ${{ inputs.configurePreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset shell: pwsh run: | $buildFlags = @( - "-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}", - "-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}" + "-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}", + "-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}" ) $gamePrefix = "${{ inputs.game == 'Generals' && 'GENERALS' || 'ZEROHOUR' }}" @@ -118,33 +109,26 @@ jobs: $buildFlags += "-DRTS_BUILD_${gamePrefix}_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}" Write-Host "Build flags: $($buildFlags -join ' | ')" + cmake --preset ${{ inputs.configurePreset }} $($buildFlags -join ' ') - cmake --preset ${{ inputs.preset }} $buildFlags - - - name: Build ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset + - name: Build ${{ inputs.game }} with CMake Using ${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset shell: pwsh run: | - cmake --build --preset ${{ inputs.preset }} + cmake --build --preset ${{ inputs.buildPreset }} - - name: Collect ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact + - name: Collect ${{ inputs.game }} ${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact shell: pwsh run: | - $buildDir = "build\${{ inputs.preset }}" + $buildDir = "build\${{ inputs.configurePreset }}" $artifactsDir = New-Item -ItemType Directory -Force -Path "$buildDir\${{ inputs.game }}\artifacts" -Verbose - - if ("${{ inputs.preset }}" -like "win32*") { - # For win32 preset, look in config-specific subdirectories - $configToUse = if ("${{ inputs.preset }}" -match "debug") { "Debug" } else { "Release" } - $files = Get-ChildItem -Path "$buildDir\Core\$configToUse","$buildDir\${{ inputs.game }}\$configToUse" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose - } else { - $files = Get-ChildItem -Path "$buildDir\Core","$buildDir\${{ inputs.game }}" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose - } + $configToUse = if ("${{ inputs.buildPreset }}" -match "relwithdebinfo") { "RelWithDebInfo" } elseif ("${{ inputs.buildPreset }}" -match "debug") { "Debug" } else { "Release" } + $files = Get-ChildItem -Path "$buildDir\Core\$configToUse","$buildDir\${{ inputs.game }}\$configToUse" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose $files | Move-Item -Destination $artifactsDir -Verbose -Force - - name: Upload ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact + - name: Upload ${{ inputs.game }} ${{ inputs.configurePreset }} ${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact uses: actions/upload-artifact@v4 with: - name: ${{ inputs.game }}-${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} - path: build\${{ inputs.preset }}\${{ inputs.game }}\artifacts + name: ${{ inputs.game }}-${{ inputs.configurePreset }}-${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} + path: build\${{ inputs.configurePreset }}\${{ inputs.game }}\artifacts retention-days: 30 if-no-files-found: error diff --git a/.github/workflows/check-replays.yml b/.github/workflows/check-replays.yml index 7fceb7dced..795495a26e 100644 --- a/.github/workflows/check-replays.yml +++ b/.github/workflows/check-replays.yml @@ -15,14 +15,24 @@ on: required: true type: string description: "Path to folder with replays and maps" - preset: + configurePreset: required: true type: string - description: "CMake preset" + buildPreset: + required: true + type: string + tools: + required: false + type: boolean + default: false + extras: + required: false + type: boolean + default: false jobs: build: - name: ${{ inputs.preset }} + name: ${{ inputs.configurePreset }} | ${{ inputs.buildPreset }} runs-on: windows-latest timeout-minutes: 15 env: @@ -38,7 +48,7 @@ jobs: - name: Download Game Artifact uses: actions/download-artifact@v4 with: - name: ${{ inputs.game }}-${{ inputs.preset }} + name: ${{ inputs.game }}-${{ inputs.configurePreset }}-${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} path: build - name: Cache Game Data @@ -236,7 +246,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: Replay-Debug-Log-${{ inputs.preset }} + name: Replay-Debug-Log-${{ inputs.buildPreset }} path: build/DebugLogFile*.txt retention-days: 30 if-no-files-found: ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d0a8efd65..5039794ea7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,127 +56,92 @@ jobs: echo "- Shared: ${{ steps.filter.outputs.shared == 'true' && '✅' || '❌' }}" >> $GITHUB_STEP_SUMMARY build-generals: - name: Build Generals${{ matrix.preset && '' }} + name: Build Generals (${{ matrix.configurePreset }} | ${{ matrix.buildPreset }}) needs: detect-changes if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generals == 'true' || needs.detect-changes.outputs.shared == 'true' }} strategy: matrix: include: - - preset: "vc6" + - configurePreset: "default" + buildPreset: "release" tools: true extras: true - - preset: "vc6-profile" + - configurePreset: "dev" + buildPreset: "dev-release" tools: true extras: true - - preset: "vc6-debug" + - configurePreset: "vc6" + buildPreset: "vc6-release" tools: true extras: true - - preset: "win32" + - configurePreset: "vc6-dev" + buildPreset: "vc6-dev-release" tools: true extras: true - - preset: "win32-profile" - tools: true - extras: true - - preset: "win32-debug" - tools: true - extras: true - # vcpkg builds have been disabled for now due to excessive build times of 30 minutes per preset - # - preset: "win32-vcpkg" - # tools: true - # extras: true - # - preset: "win32-vcpkg-profile" - # tools: true - # extras: true - # - preset: "win32-vcpkg-debug" - # tools: true - # extras: true fail-fast: false uses: ./.github/workflows/build-toolchain.yml with: game: "Generals" - preset: ${{ matrix.preset }} + configurePreset: ${{ matrix.configurePreset }} + buildPreset: ${{ matrix.buildPreset }} tools: ${{ matrix.tools }} extras: ${{ matrix.extras }} secrets: inherit - # Note build-generalsmd is split into two jobs for vc6 and win32 because replaycheck-generalsmd - # only requires the vc6 build and compiling vc6 is much faster than win32 - build-generalsmd-vc6: - name: Build GeneralsMD${{ matrix.preset && '' }} + build-generalsmd: + name: Build GeneralsMD (${{ matrix.configurePreset }} | ${{ matrix.buildPreset }}) needs: detect-changes if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generalsmd == 'true' || needs.detect-changes.outputs.shared == 'true' }} strategy: matrix: include: - - preset: "vc6" + - configurePreset: "default" + buildPreset: "release" tools: true extras: true - - preset: "vc6-profile" + - configurePreset: "dev" + buildPreset: "dev-release" tools: true extras: true - - preset: "vc6-debug" + - configurePreset: "vc6" + buildPreset: "vc6-release" tools: true extras: true - - preset: "vc6-releaselog" + - configurePreset: "vc6-dev" + buildPreset: "vc6-dev-release" tools: true extras: true fail-fast: false uses: ./.github/workflows/build-toolchain.yml with: game: "GeneralsMD" - preset: ${{ matrix.preset }} + configurePreset: ${{ matrix.configurePreset }} + buildPreset: ${{ matrix.buildPreset }} tools: ${{ matrix.tools }} extras: ${{ matrix.extras }} - secrets: inherit - - build-generalsmd-win32: - name: Build GeneralsMD${{ matrix.preset && '' }} + secrets: inherit + + build-generalsmd-vc6-log-release: + name: Build GeneralsMD (vc6-log | vc6-log-release) needs: detect-changes if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generalsmd == 'true' || needs.detect-changes.outputs.shared == 'true' }} - strategy: - matrix: - include: - - preset: "win32" - tools: true - extras: true - - preset: "win32-profile" - tools: true - extras: true - - preset: "win32-debug" - tools: true - extras: true - # vcpkg builds have been disabled for now due to excessive build times of 30 minutes per preset - # - preset: "win32-vcpkg" - # tools: true - # extras: true - # - preset: "win32-vcpkg-profile" - # tools: true - # extras: true - # - preset: "win32-vcpkg-debug" - # tools: true - # extras: true - fail-fast: false uses: ./.github/workflows/build-toolchain.yml with: game: "GeneralsMD" - preset: ${{ matrix.preset }} - tools: ${{ matrix.tools }} - extras: ${{ matrix.extras }} + configurePreset: "vc6-log" + buildPreset: "vc6-log-release" + tools: false + extras: false secrets: inherit replaycheck-generalsmd: - name: Replay Check GeneralsMD${{ matrix.preset && '' }} - needs: build-generalsmd-vc6 + name: Replay Check + needs: build-generalsmd-vc6-log-release if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generalsmd == 'true' || needs.detect-changes.outputs.shared == 'true' }} - strategy: - matrix: - include: - - preset: "vc6+t+e" - - preset: "vc6-releaselog+t+e" # optimized build with logging and crashing enabled should be compatible, so we test that here. - fail-fast: false uses: ./.github/workflows/check-replays.yml with: game: "GeneralsMD" + configurePreset: "vc6-log" + buildPreset: "vc6-log-release" userdata: "GeneralsReplays/GeneralsZH/1.04" - preset: ${{ matrix.preset }} secrets: inherit diff --git a/CMakePresets.json b/CMakePresets.json index 6dd63816a8..e2c2ae7b0d 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,95 +1,20 @@ { - "version": 6, - "cmakeMinimumRequired": { - "major": 3, - "minor": 25, - "patch": 0 - }, + "version": 5, "configurePresets": [ - { - "name": "vc6", - "displayName": "Windows 32bit VC6 Release", - "generator": "Ninja", - "hidden": false, - "binaryDir": "${sourceDir}/build/${presetName}", - "cacheVariables": { - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", - "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$:Debug>DLL", - "CMAKE_MSVC_DEBUG_INFORMATION_FORMAT": "", - "CMAKE_BUILD_TYPE": "Release", - "RTS_FLAGS": "/W3" - }, - "vendor": { - "jetbrains.com/clion": { - "toolchain": "Visual Studio 6" - } - } - }, - { - "name": "vc6-profile", - "displayName": "Windows 32bit VC6 Profile", - "hidden": false, - "inherits": "vc6", - "cacheVariables": { - "RTS_BUILD_OPTION_PROFILE": "ON" - } - }, - { - "name": "vc6-debug", - "displayName": "Windows 32bit VC6 Debug", - "hidden": false, - "inherits": "vc6", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "RTS_BUILD_OPTION_DEBUG": "ON" - } - }, - { - "name": "vc6-releaselog", - "displayName": "Windows 32bit VC6 Release Logging", - "inherits": "vc6", - "cacheVariables": { - "RTS_DEBUG_LOGGING": "ON", - "RTS_DEBUG_CRASHING": "ON" - } - }, { "name": "default", - "displayName": "Default Config (don't use directly!)", "generator": "Ninja Multi-Config", - "hidden": true, "binaryDir": "${sourceDir}/build/${presetName}", + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", - "CMAKE_MSVC_DEBUG_INFORMATION_FORMAT": "$<$:Embedded>", - "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$:Debug>DLL" - } - }, - { - "name": "default-vcpkg", - "displayName": "Default Config for vcpkg (don't use directly!)", - "generator": "Ninja Multi-Config", - "hidden": true, - "binaryDir": "${sourceDir}/build/${presetName}", - "cacheVariables": { - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", - "CMAKE_MSVC_DEBUG_INFORMATION_FORMAT": "$<$:Embedded>", - "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$:Debug>DLL", - "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" - } - }, - { - "name": "win32", - "inherits": "default", - "hidden": false, - "displayName": "Windows 32bit Release", + "VCPKG_TARGET_TRIPLET": "x86-windows", + "RTS_FLAGS": "/W3" + }, "architecture": { "value": "Win32", "strategy": "external" }, - "cacheVariables": { - "RTS_FLAGS": "/W3" - }, "vendor": { "jetbrains.com/clion": { "toolchain": "Visual Studio" @@ -97,280 +22,87 @@ } }, { - "name": "win32-profile", - "inherits": "win32", - "displayName": "Windows 32bit Profile", - "cacheVariables": { - "RTS_BUILD_OPTION_PROFILE": "ON" + "name": "vc6", + "inherits": "default", + "environment": { + "PATH": "$env{VS6_DIR}\\VC98\\BIN;$env{VS6_DIR}\\Common\\Tools;$env{VS6_DIR}\\Common\\Tools\\WinNT;$env{VS6_DIR}\\Common\\MSDev98\\Bin;$penv{PATH}", + "INCLUDE": "$env{VS6_DIR}\\VC98\\INCLUDE;$env{VS6_DIR}\\VC98\\MFC\\INCLUDE;$env{VS6_DIR}\\VC98\\ATL\\INCLUDE;$penv{INCLUDE}", + "LIB": "$env{VS6_DIR}\\VC98\\LIB;$env{VS6_DIR}\\VC98\\MFC\\LIB;$penv{LIB}" } }, { - "name": "win32-debug", - "inherits": "win32", - "displayName": "Windows 32bit Debug", + "name": "dev", + "inherits": "default", "cacheVariables": { "RTS_BUILD_OPTION_DEBUG": "ON" } }, { - "name": "win32-vcpkg", - "inherits": "default-vcpkg", - "hidden": false, - "displayName": "Windows 32bit VCPKG Release", - "architecture": { - "value": "Win32", - "strategy": "external" - }, - "cacheVariables": { - "RTS_FLAGS": "/W3" - }, - "vendor": { - "jetbrains.com/clion": { - "toolchain": "Visual Studio" - } - } - }, - { - "name": "win32-vcpkg-profile", - "inherits": "win32-vcpkg", - "displayName": "Windows 32bit VCPKG Profile", + "name": "vc6-dev", + "inherits": "vc6", "cacheVariables": { - "RTS_BUILD_OPTION_PROFILE": "ON" + "RTS_BUILD_OPTION_DEBUG": "ON" } }, { - "name": "win32-vcpkg-debug", - "inherits": "win32-vcpkg", - "displayName": "Windows 32bit VCPKG Debug", + "name": "vc6-log", + "inherits": "vc6", "cacheVariables": { - "RTS_BUILD_OPTION_DEBUG": "ON" + "RTS_DEBUG_LOGGING": "ON", + "RTS_DEBUG_CRASHING": "ON" } - }, - { - "name": "unix", - "inherits": "default-vcpkg", - "hidden": false, - "displayName": "Unix 32bit VCPKG Release" } ], "buildPresets": [ { - "name": "vc6", - "configurePreset": "vc6", - "displayName": "Build Windows 32bit VC6 Release", - "description": "Build Windows 32bit VC6 Release" - }, - { - "name": "vc6-profile", - "configurePreset": "vc6-profile", - "displayName": "Build Windows 32bit VC6 Profile", - "description": "Build Windows 32bit VC6 Profile" - }, - { - "name": "vc6-debug", - "configurePreset": "vc6-debug", - "displayName": "Build Windows 32bit VC6 Debug", - "description": "Build Windows 32bit VC6 Debug" - }, - { - "name": "vc6-releaselog", - "configurePreset": "vc6-releaselog", - "displayName": "Build Windows 32bit VC6 Release Logging", - "description": "Build Windows 32bit VC6 Release Logging" - }, - { - "name": "win32", - "configurePreset": "win32", - "displayName": "Build Windows 32bit Release", - "description": "Build Windows 32bit Release", - "configuration": "Release" - }, - { - "name": "win32-profile", - "configurePreset": "win32-profile", - "displayName": "Build Windows 32bit Profile", - "description": "Build Windows 32bit Profile", + "name": "release", + "configurePreset": "default", "configuration": "Release" }, { - "name": "win32-debug", - "configurePreset": "win32-debug", - "displayName": "Build Windows 32bit Debug", - "description": "Build Windows 32bit Debug", + "name": "debug", + "configurePreset": "default", "configuration": "Debug" }, { - "name": "win32-vcpkg", - "configurePreset": "win32-vcpkg", - "displayName": "Build Windows 32bit VCPKG Release", - "description": "Build Windows 32bit VCPKG Release", - "configuration": "Release" - }, - { - "name": "win32-vcpkg-profile", - "configurePreset": "win32-vcpkg-profile", - "displayName": "Build Windows 32bit VCPKG Profile", - "description": "Build Windows 32bit VCPKG Profile", + "name": "dev-release", + "configurePreset": "dev", "configuration": "Release" }, { - "name": "win32-vcpkg-debug", - "configurePreset": "win32-vcpkg-debug", - "displayName": "Build Windows 32bit VCPKG Debug", - "description": "Build Windows 32bit VCPKG Debug", + "name": "dev-debug", + "configurePreset": "dev", "configuration": "Debug" }, { - "name": "unix", - "configurePreset": "unix", - "displayName": "Build Unix 32bit VCPKG Release", - "description": "Build Unix 32bit VCPKG Release", + "name": "vc6-release", + "configurePreset": "vc6", "configuration": "Release" - } - ], - "workflowPresets": [ - { - "name": "vc6", - "steps": [ - { - "type": "configure", - "name": "vc6" - }, - { - "type": "build", - "name": "vc6" - } - ] }, { "name": "vc6-debug", - "steps": [ - { - "type": "configure", - "name": "vc6-debug" - }, - { - "type": "build", - "name": "vc6-debug" - } - ] - }, - { - "name": "vc6-profile", - "steps": [ - { - "type": "configure", - "name": "vc6-profile" - }, - { - "type": "build", - "name": "vc6-profile" - } - ] - }, - { - "name": "vc6-releaselog", - "steps": [ - { - "type": "configure", - "name": "vc6-releaselog" - }, - { - "type": "build", - "name": "vc6-releaselog" - } - ] - }, - { - "name": "win32", - "steps": [ - { - "type": "configure", - "name": "win32" - }, - { - "type": "build", - "name": "win32" - } - ] - }, - { - "name": "win32-profile", - "steps": [ - { - "type": "configure", - "name": "win32-profile" - }, - { - "type": "build", - "name": "win32-profile" - } - ] - }, - { - "name": "win32-debug", - "steps": [ - { - "type": "configure", - "name": "win32-debug" - }, - { - "type": "build", - "name": "win32-debug" - } - ] - }, - { - "name": "win32-vcpkg", - "steps": [ - { - "type": "configure", - "name": "win32-vcpkg" - }, - { - "type": "build", - "name": "win32-vcpkg" - } - ] + "configurePreset": "vc6", + "configuration": "Debug", + "jobs": 1 }, { - "name": "win32-vcpkg-profile", - "steps": [ - { - "type": "configure", - "name": "win32-vcpkg-profile" - }, - { - "type": "build", - "name": "win32-vcpkg-profile" - } - ] + "name": "vc6-dev-release", + "configurePreset": "vc6-dev", + "configuration": "Release" }, { - "name": "win32-vcpkg-debug", - "steps": [ - { - "type": "configure", - "name": "win32-vcpkg-debug" - }, - { - "type": "build", - "name": "win32-vcpkg-debug" - } - ] + "name": "vc6-dev-debug", + "configurePreset": "vc6-dev", + "configuration": "Debug", + "jobs": 1 }, { - "name": "unix", - "steps": [ - { - "type": "configure", - "name": "unix" - }, - { - "type": "build", - "name": "unix" - } + "name": "vc6-log-release", + "configurePreset": "vc6-log", + "configuration": "Release", + "targets": [ + "z_generals" ] } ] -} \ No newline at end of file +} diff --git a/cmake/compilers.cmake b/cmake/compilers.cmake index bd8150860a..552024b082 100644 --- a/cmake/compilers.cmake +++ b/cmake/compilers.cmake @@ -4,6 +4,7 @@ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}") message(STATUS "CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}") message(STATUS "CMAKE_CXX_COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}") message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") + if (DEFINED MSVC_VERSION) message(STATUS "MSVC_VERSION: ${MSVC_VERSION}") endif() @@ -15,42 +16,53 @@ else() set(IS_VS6_BUILD FALSE) endif() -# Make release builds have debug information too. if(MSVC) - # Create PDB for Release as long as debug info was generated during compile. - string(APPEND CMAKE_EXE_LINKER_FLAGS_RELEASE " /DEBUG /OPT:REF /OPT:ICF") - string(APPEND CMAKE_SHARED_LINKER_FLAGS_RELEASE " /DEBUG /OPT:REF /OPT:ICF") - # /INCREMENTAL:NO prevents PDB size bloat in Debug configuration(s). add_link_options("/INCREMENTAL:NO") -else() - # We go a bit wild here and assume any other compiler we are going to use supports -g for debug info. - string(APPEND CMAKE_CXX_FLAGS_RELEASE " -g") - string(APPEND CMAKE_C_FLAGS_RELEASE " -g") -endif() + # Generate debug information for all builds + add_link_options("/debug") + + set(CMAKE_CONFIGURATION_TYPES "Release;Debug") + set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase") + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") + + set(CMAKE_CXX_FLAGS "/DWIN32 /D_WINDOWS /EHac") + set(CMAKE_C_FLAGS "/DWIN32 /D_WINDOWS") -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) # Ensures only ISO features are used + if(IS_VS6_BUILD) + set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$:>$<$:ProgramDatabase>") + + # So only one link ever runs (since vc6 can't handle multithreaded linking) + set_property(GLOBAL PROPERTY JOB_POOLS link=1) + set(CMAKE_JOB_POOL_LINK link) -if (NOT IS_VS6_BUILD) - if (MSVC) - # Multithreaded build. - add_compile_options(/MP) - # Enforce strict __cplusplus version + # Tell the linker to place the debug information in a single .PDB file + add_link_options("/pdbtype:con") + # Tell the linker to use both coff and cv debug info + add_link_options("/debugtype:both") + # Prevent heap from running out of memory + add_compile_options("/Zm800") + # Make precompiled headers debug information accessible + add_compile_options("/Yd") + # Include line numbers in debug information + add_compile_options("$<$:/Zd>") + else() + # Multithreaded build with Visual Studio Generator (ninja is multithreaded by default) + if(CMAKE_GENERATOR MATCHES "Visual Studio") + add_compile_options("/MP") + endif() + # Set __cplusplus macro to correct value add_compile_options(/Zc:__cplusplus) endif() else() - if(RTS_BUILD_OPTION_VC6_FULL_DEBUG) - set_property(GLOBAL PROPERTY JOB_POOLS compile=1 link=1) - else() - # Define two pools: 'compile' with plenty of slots, 'link' with just one - set_property(GLOBAL PROPERTY JOB_POOLS compile=0 link=1) - endif() + # We go a bit wild here and assume any other compiler we are going to use supports -g for debug info. + add_compile_options("-g") +endif() - # 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) +if(NOT IS_VS6_BUILD) + set(CMAKE_CXX_STANDARD 20) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) # Ensures only ISO features are used endif() if(RTS_BUILD_OPTION_ASAN) diff --git a/cmake/config-build.cmake b/cmake/config-build.cmake index 43fb57d7cc..075e03a59b 100644 --- a/cmake/config-build.cmake +++ b/cmake/config-build.cmake @@ -6,7 +6,6 @@ option(RTS_BUILD_GENERALS "Build Generals code." ON) option(RTS_BUILD_OPTION_PROFILE "Build code with the \"Profile\" configuration." OFF) option(RTS_BUILD_OPTION_DEBUG "Build code with the \"Debug\" configuration." OFF) option(RTS_BUILD_OPTION_ASAN "Build code with Address Sanitizer." OFF) -option(RTS_BUILD_OPTION_VC6_FULL_DEBUG "Build VC6 with full debug info." OFF) option(RTS_BUILD_OPTION_FFMPEG "Enable FFmpeg support" OFF) if(NOT RTS_BUILD_ZEROHOUR AND NOT RTS_BUILD_GENERALS) @@ -21,7 +20,6 @@ add_feature_info(GeneralsStuff RTS_BUILD_GENERALS "Build Generals code") add_feature_info(ProfileBuild RTS_BUILD_OPTION_PROFILE "Building as a \"Profile\" build") add_feature_info(DebugBuild RTS_BUILD_OPTION_DEBUG "Building as a \"Debug\" build") add_feature_info(AddressSanitizer RTS_BUILD_OPTION_ASAN "Building with address sanitizer") -add_feature_info(Vc6FullDebug RTS_BUILD_OPTION_VC6_FULL_DEBUG "Building VC6 with full debug info") add_feature_info(FFmpegSupport RTS_BUILD_OPTION_FFMPEG "Building with FFmpeg support") if(RTS_BUILD_ZEROHOUR) @@ -44,16 +42,7 @@ if(RTS_BUILD_GENERALS) add_feature_info(GeneralsDocs RTS_BUILD_GENERALS_DOCS "Build Generals Documentation") endif() -if(NOT IS_VS6_BUILD) - # Because we set CMAKE_CXX_STANDARD_REQUIRED and CMAKE_CXX_EXTENSIONS in the compilers.cmake this should be enforced. - target_compile_features(core_config INTERFACE cxx_std_20) -endif() - -if(IS_VS6_BUILD AND RTS_BUILD_OPTION_VC6_FULL_DEBUG) - target_compile_options(core_config INTERFACE ${RTS_FLAGS} /Zi) -else() - target_compile_options(core_config INTERFACE ${RTS_FLAGS}) -endif() +target_compile_options(core_config INTERFACE ${RTS_FLAGS}) # This disables a lot of warnings steering developers to use windows only functions/function names. if(MSVC) diff --git a/vcpkg.json b/vcpkg.json index 011b913c8a..21a30aad2e 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -2,7 +2,15 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "builtin-baseline": "b02e341c927f16d991edbd915d8ea43eac52096c", "dependencies": [ - "zlib", - "ffmpeg" - ] - } \ No newline at end of file + "zlib" + ], + "features": { + "video": { + "description": "Use ffmpeg instead of bink", + "dependencies": [ + "ffmpeg" + ] + } + } +} +