diff --git a/.github/workflows/build-toolchain.yml b/.github/workflows/build-toolchain.yml index 4ce439e025..647b831f27 100644 --- a/.github/workflows/build-toolchain.yml +++ b/.github/workflows/build-toolchain.yml @@ -14,7 +14,11 @@ on: preset: required: true type: string - description: "CMake preset" + description: "CMake configure preset" + configuration: + required: true + type: string + description: "Build configuration (Debug, Release, RelWithDebInfo)" tools: required: false default: true @@ -28,7 +32,7 @@ on: jobs: build: - name: Preset ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} + name: ${{ inputs.game }} ${{ inputs.preset }}-${{ inputs.configuration }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} runs-on: windows-latest timeout-minutes: 40 steps: @@ -36,7 +40,7 @@ jobs: uses: actions/checkout@v4 - name: Cache VC6 Installation - if: startsWith(inputs.preset, 'vc6') + if: endsWith(inputs.preset, 'vc6') id: cache-vc6 uses: actions/cache@v4 with: @@ -51,7 +55,7 @@ jobs: 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' }} + if: ${{ endsWith(inputs.preset, '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 }} @@ -66,7 +70,7 @@ jobs: $fileHash = (Get-FileHash -Path VS6_VisualStudio6.7z -Algorithm SHA256).Hash Write-Host "Downloaded file SHA256: $fileHash" Write-Host "Expected file SHA256: $env:EXPECTED_HASH" - if ($hash -ne $env:EXPECTED_HASH) { + if ($fileHash -ne $env:EXPECTED_HASH) { Write-Error "Hash verification failed! File may be corrupted or tampered with." exit 1 } @@ -76,16 +80,13 @@ jobs: Remove-Item VS6_VisualStudio6.7z -Verbose - name: Set Up VC6 Environment - if: startsWith(inputs.preset, 'vc6') + if: endsWith(inputs.preset, '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 @@ -95,56 +96,45 @@ jobs: "LIB=$MSVCDir\LIB;$MSVCDir\MFC\LIB;$env:LIB" >> $env:GITHUB_ENV - name: Set Up VC2022 Environment - if: startsWith(inputs.preset, 'win32') + if: ${{ !endsWith(inputs.preset, 'vc6') }} uses: ilammy/msvc-dev-cmd@v1 with: arch: x86 - - 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.preset }}, ${{ inputs.configuration }}) for ${{ inputs.game }} 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' }}" $buildFlags += "-DRTS_BUILD_CORE_TOOLS=${{ inputs.tools && 'ON' || 'OFF' }}" $buildFlags += "-DRTS_BUILD_${gamePrefix}_TOOLS=${{ inputs.tools && 'ON' || 'OFF' }}" $buildFlags += "-DRTS_BUILD_CORE_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}" $buildFlags += "-DRTS_BUILD_${gamePrefix}_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}" - Write-Host "Build flags: $($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 }} [${{ inputs.preset }} | ${{ inputs.configuration }}] shell: pwsh - run: | - cmake --build --preset ${{ inputs.preset }} - - - name: Collect ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact + run: cmake --build build/${{ inputs.preset }} --config ${{ inputs.configuration }} + + - name: Collect Artifact - ${{ inputs.game }} - ${{ inputs.preset }} - ${{ inputs.configuration }} shell: pwsh run: | - $buildDir = "build\${{ inputs.preset }}" - $artifactsDir = New-Item -ItemType Directory -Force -Path "$buildDir\${{ inputs.game }}\artifacts" -Verbose + $buildDir = "build/${{ inputs.preset }}/${{ inputs.configuration }}" + $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 - } + $files = Get-ChildItem -Path "$buildDir/Core", "$buildDir/${{ inputs.game }}" -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 Artifact - ${{ inputs.game }} - ${{ inputs.preset }} - ${{ inputs.configuration }} 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.preset }}-${{ inputs.configuration }} + path: build/${{ inputs.preset }}/${{ inputs.configuration }}/${{ inputs.game }}/artifacts retention-days: 30 if-no-files-found: error + + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed86c978b3..627a7af6f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,89 +57,38 @@ jobs: echo "- Shared: ${{ steps.filter.outputs.shared == 'true' && '✅' || '❌' }}" >> $GITHUB_STEP_SUMMARY build-generals: - name: Build Generals${{ matrix.preset && '' }} + name: Build Generals${{ matrix.preset && '' }}-${{ matrix.configuration }} 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" - tools: true - extras: true - - preset: "vc6-profile" - tools: true - extras: true - - preset: "vc6-debug" - tools: true - extras: true - - 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 + preset: [ninja, ninja-vc6] + configuration: [Debug, Release, RelWithDebInfo] fail-fast: false uses: ./.github/workflows/build-toolchain.yml with: game: "Generals" preset: ${{ matrix.preset }} - tools: ${{ matrix.tools }} - extras: ${{ matrix.extras }} + configuration: ${{ matrix.configuration }} + tools: true + extras: true secrets: inherit build-generalsmd: - name: Build GeneralsMD${{ matrix.preset && '' }} + name: Build GeneralsMD${{ matrix.preset && '' }}-${{ matrix.configuration }} 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" - tools: true - extras: true - - preset: "vc6-profile" - tools: true - extras: true - - preset: "vc6-debug" - tools: true - extras: true - - 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 + preset: [ninja, ninja-vc6] + configuration: [Debug, Release, RelWithDebInfo] fail-fast: false uses: ./.github/workflows/build-toolchain.yml with: game: "GeneralsMD" preset: ${{ matrix.preset }} - tools: ${{ matrix.tools }} - extras: ${{ matrix.extras }} + configuration: ${{ matrix.configuration }} + tools: true + extras: true secrets: inherit + diff --git a/CMakePresets.json b/CMakePresets.json index 3813bbdff3..477dc56f08 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,431 +1,55 @@ { - "version": 6, - "cmakeMinimumRequired": { - "major": 3, - "minor": 25, - "patch": 0 - }, - "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-internal", - "displayName": "Windows 32bit VC6 Internal", - "inherits": "vc6", - "cacheVariables": { - "RTS_BUILD_OPTION_INTERNAL": "ON" - } - }, - { - "name": "vc6-debug", - "displayName": "Windows 32bit VC6 Debug", - "hidden": false, - "inherits": "vc6", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "RTS_BUILD_OPTION_DEBUG": "ON" - } - }, + //"$schema": "https://cmake.org/cmake/help/latest/file/v1/cmake-presets-schema.json", // to be enabled later when version is upgraded to 8+ + "version": 5, + "configurePresets": + [ { "name": "default", - "displayName": "Default Config (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" - } - }, - { - "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", - "architecture": { - "value": "Win32", - "strategy": "external" - }, - "cacheVariables": { - "RTS_FLAGS": "/W3" + "installDir": "${sourceDir}/install/${presetName}", + //"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", // to be enabled later when vcpkg is set up such that it is used but only if find fails and vcpkg is installed + "cacheVariables": + { + "CMAKE_CONFIGURATION_TYPES": "Release;Debug;RelWithDebInfo", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" }, - "vendor": { - "jetbrains.com/clion": { + "vendor": + { + "jetbrains.com/clion": + { "toolchain": "Visual Studio" } } }, { - "name": "win32-profile", - "inherits": "win32", - "displayName": "Windows 32bit Profile", - "cacheVariables": { - "RTS_BUILD_OPTION_PROFILE": "ON" - } - }, - { - "name": "win32-internal", - "inherits": "win32", - "displayName": "Windows 32bit Internal", - "cacheVariables": { - "RTS_BUILD_OPTION_INTERNAL": "ON" - } - }, - { - "name": "win32-debug", - "inherits": "win32", - "displayName": "Windows 32bit Debug", - "cacheVariables": { - "RTS_BUILD_OPTION_DEBUG": "ON" - } - }, - { - "name": "win32-vcpkg", - "inherits": "default-vcpkg", - "hidden": false, - "displayName": "Windows 32bit VCPKG Release", - "architecture": { + "name": "ninja", + "inherits": "default", + "generator": "Ninja Multi-Config", + "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", - "cacheVariables": { - "RTS_BUILD_OPTION_PROFILE": "ON" - } - }, - { - "name": "win32-vcpkg-internal", - "inherits": "win32-vcpkg", - "displayName": "Windows 32bit VCPKG Internal", - "cacheVariables": { - "RTS_BUILD_OPTION_INTERNAL": "ON" - } - }, - { - "name": "win32-vcpkg-debug", - "inherits": "win32-vcpkg", - "displayName": "Windows 32bit VCPKG Debug", - "cacheVariables": { - "RTS_BUILD_OPTION_DEBUG": "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-internal", - "configurePreset": "vc6-internal", - "displayName": "Build Windows 32bit VC6 Internal", - "description": "Build Windows 32bit VC6 Internal" - }, - { - "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": "win32", - "configurePreset": "win32", - "displayName": "Build Windows 32bit Release", - "description": "Build Windows 32bit Release", - "configuration": "Release" - }, - { - "name": "win32-internal", - "configurePreset": "win32-internal", - "displayName": "Build Windows 32bit Internal", - "description": "Build Windows 32bit Internal", - "configuration": "Release" - }, - { - "name": "win32-profile", - "configurePreset": "win32-profile", - "displayName": "Build Windows 32bit Profile", - "description": "Build Windows 32bit Profile", - "configuration": "Release" - }, - { - "name": "win32-debug", - "configurePreset": "win32-debug", - "displayName": "Build Windows 32bit Debug", - "description": "Build Windows 32bit Debug", - "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-internal", - "configurePreset": "win32-vcpkg-internal", - "displayName": "Build Windows 32bit VCPKG Internal", - "description": "Build Windows 32bit VCPKG Internal", - "configuration": "Release" - }, - { - "name": "win32-vcpkg-profile", - "configurePreset": "win32-vcpkg-profile", - "displayName": "Build Windows 32bit VCPKG Profile", - "description": "Build Windows 32bit VCPKG Profile", - "configuration": "Release" + "name": "vs2022", + "inherits": "default", + "generator": "Visual Studio 17 2022", + "architecture": "Win32" }, { - "name": "win32-vcpkg-debug", - "configurePreset": "win32-vcpkg-debug", - "displayName": "Build Windows 32bit VCPKG Debug", - "description": "Build Windows 32bit VCPKG Debug", - "configuration": "Debug" + "name": "ninja-vc6", + "inherits": "ninja" }, { - "name": "unix", - "configurePreset": "unix", - "displayName": "Build Unix 32bit VCPKG Release", - "description": "Build Unix 32bit VCPKG Release", - "configuration": "Release" + "name": "vs2022-vc6", + "inherits": "vs2022", + "toolset": "v60" } ], - "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-internal", - "steps": [ - { - "type": "configure", - "name": "vc6-internal" - }, - { - "type": "build", - "name": "vc6-internal" - } - ] - }, - { - "name": "vc6-profile", - "steps": [ - { - "type": "configure", - "name": "vc6-profile" - }, - { - "type": "build", - "name": "vc6-profile" - } - ] - }, - { - "name": "win32", - "steps": [ - { - "type": "configure", - "name": "win32" - }, - { - "type": "build", - "name": "win32" - } - ] - }, - { - "name": "win32-internal", - "steps": [ - { - "type": "configure", - "name": "win32-internal" - }, - { - "type": "build", - "name": "win32-internal" - } - ] - }, - { - "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" - } - ] - }, - { - "name": "win32-vcpkg-internal", - "steps": [ - { - "type": "configure", - "name": "win32-vcpkg-internal" - }, - { - "type": "build", - "name": "win32-vcpkg-internal" - } - ] - }, - { - "name": "win32-vcpkg-profile", - "steps": [ - { - "type": "configure", - "name": "win32-vcpkg-profile" - }, - { - "type": "build", - "name": "win32-vcpkg-profile" - } - ] - }, - { - "name": "win32-vcpkg-debug", - "steps": [ - { - "type": "configure", - "name": "win32-vcpkg-debug" - }, - { - "type": "build", - "name": "win32-vcpkg-debug" - } - ] - }, - { - "name": "unix", - "steps": [ - { - "type": "configure", - "name": "unix" - }, - { - "type": "build", - "name": "unix" - } - ] - } + "buildPresets": + [ + ] } \ No newline at end of file diff --git a/cmake/compilers.cmake b/cmake/compilers.cmake index ff454e3155..ae2a1f7625 100644 --- a/cmake/compilers.cmake +++ b/cmake/compilers.cmake @@ -46,6 +46,8 @@ else() 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) + # Needed to make vc6 compile with ninja + set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "") endif() if(RTS_BUILD_OPTION_ASAN) diff --git a/cmake/config-build.cmake b/cmake/config-build.cmake index a001e42c59..62a5c5341c 100644 --- a/cmake/config-build.cmake +++ b/cmake/config-build.cmake @@ -18,7 +18,6 @@ add_feature_info(CoreTools RTS_BUILD_CORE_TOOLS "Build Core Mod Tools") add_feature_info(CoreExtras RTS_BUILD_CORE_EXTRAS "Build Core Extra Tools/Tests") add_feature_info(ZeroHourStuff RTS_BUILD_ZEROHOUR "Build Zero Hour code") add_feature_info(GeneralsStuff RTS_BUILD_GENERALS "Build Generals code") -add_feature_info(InternalBuild RTS_BUILD_OPTION_INTERNAL "Building as an \"Internal\" build") 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") @@ -49,26 +48,29 @@ if(NOT IS_VS6_BUILD) target_compile_features(core_config INTERFACE cxx_std_20) endif() -target_compile_options(core_config INTERFACE ${RTS_FLAGS}) +target_compile_options(core_config INTERFACE "/W3") # This disables a lot of warnings steering developers to use windows only functions/function names. if(MSVC) - target_compile_definitions(core_config INTERFACE _CRT_NONSTDC_NO_WARNINGS _CRT_SECURE_NO_WARNINGS $<$:_DEBUG_CRT>) + target_compile_definitions(core_config INTERFACE _CRT_NONSTDC_NO_WARNINGS _CRT_SECURE_NO_WARNINGS $<$:_DEBUG_CRT>) endif() if(UNIX) target_compile_definitions(core_config INTERFACE _UNIX) endif() +# If RTS_BUILD_OPTION_DEBUG and/or RTS_BUILD_OPTION_PROFILE is set then the respective compile definitions are set for all generator configs if(RTS_BUILD_OPTION_DEBUG) target_compile_definitions(core_config INTERFACE RTS_DEBUG WWDEBUG DEBUG) -else() - target_compile_definitions(core_config INTERFACE RTS_RELEASE) +endif() +if(RTS_BUILD_OPTION_PROFILE) + target_compile_definitions(core_config INTERFACE RTS_PROFILE) +endif() - if(RTS_BUILD_OPTION_INTERNAL) - target_compile_definitions(core_config INTERFACE RTS_INTERNAL) - endif() - if(RTS_BUILD_OPTION_PROFILE) - target_compile_definitions(core_config INTERFACE RTS_PROFILE) - endif() +# otherwise DEBUG defines are tied to Debug generator config and PROFILE defines to RelWithDebug info generator config +if(NOT RTS_BUILD_OPTION_DEBUG AND NOT RTS_BUILD_OPTION_PROFILE) + target_compile_definitions(core_config INTERFACE + $<$:RTS_DEBUG;WWDEBUG;DEBUG> + $<$:RTS_PROFILE> + ) endif()