From 86b1cb22127052b95eb04e53ac79a1f1e7d5a5be Mon Sep 17 00:00:00 2001 From: Estebanfer Date: Mon, 16 Sep 2024 17:02:17 -0300 Subject: [PATCH] remove MSVC 19.39 downgrade, fix crashes caused by the new version --- .github/workflows/CI.yml | 6 +----- .github/workflows/Nightly.yml | 6 +----- .github/workflows/Publish.yml | 6 +----- .github/workflows/install_msvc1439.ps1 | 14 -------------- CMakeLists.txt | 4 ++++ cmake/conan.cmake | 3 ++- cmake/conan_profile | 3 +++ 7 files changed, 12 insertions(+), 30 deletions(-) delete mode 100644 .github/workflows/install_msvc1439.ps1 create mode 100644 cmake/conan_profile diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4f8405b..27bc1d5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -36,15 +36,11 @@ jobs: c:/.conan key: ${{ matrix.build_type }}-conan-cpp23-${{ hashFiles('**/conanfile.txt') }} - - name: Install MSVC build tools 14.39 - run: | - & ".github\workflows\install_msvc1439.ps1" - - name: Configure run: | mkdir build cd build - cmake .. -A x64 -T v143,version=14.39 -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CONFIGURATION_TYPES=${{matrix.build_type}} -DPLAYLUNKY_CONAN_VERBOSE=ON + cmake .. -A x64 -T v143 -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CONFIGURATION_TYPES=${{matrix.build_type}} -DPLAYLUNKY_CONAN_VERBOSE=ON - name: Build run: | diff --git a/.github/workflows/Nightly.yml b/.github/workflows/Nightly.yml index 8e5fef4..f6c7ee5 100644 --- a/.github/workflows/Nightly.yml +++ b/.github/workflows/Nightly.yml @@ -46,15 +46,11 @@ jobs: c:/.conan key: ${{ matrix.build_type }}-conan-cpp23-${{ hashFiles('**/conanfile.txt') }} - - name: Install MSVC build tools 14.39 - run: | - & ".github\workflows\install_msvc1439.ps1" - - name: Configure run: | mkdir build cd build - cmake .. -A x64 -T v143,version=14.39 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES=Release -DPLAYLUNKY_CONAN_VERBOSE=ON + cmake .. -A x64 -T v143 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES=Release -DPLAYLUNKY_CONAN_VERBOSE=ON - name: Build run: | diff --git a/.github/workflows/Publish.yml b/.github/workflows/Publish.yml index 6a49417..d329165 100644 --- a/.github/workflows/Publish.yml +++ b/.github/workflows/Publish.yml @@ -37,15 +37,11 @@ jobs: c:/.conan key: ${{ matrix.build_type }}-conan-cpp23-${{ hashFiles('**/conanfile.txt') }} - - name: Install MSVC build tools 14.39 - run: | - & ".github\workflows\install_msvc1439.ps1" - - name: Configure run: | mkdir build cd build - cmake .. -A x64 -T v143,version=14.39 + cmake .. -A x64 -T v143 - name: Build run: | diff --git a/.github/workflows/install_msvc1439.ps1 b/.github/workflows/install_msvc1439.ps1 deleted file mode 100644 index 485e66c..0000000 --- a/.github/workflows/install_msvc1439.ps1 +++ /dev/null @@ -1,14 +0,0 @@ -# Requires VSSetup https://github.com/microsoft/vssetup.powershell - -#Install VC 14.39 -$vs_installation_path = $(Get-VSSetupInstance -All | Select-VSSetupInstance -Version '[17.0,)').InstallationPath -$process = Start-Process -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList "modify --installPath `"$vs_installation_path`" --quiet --norestart --nocache --add Microsoft.VisualStudio.Component.VC.14.39.17.9.x86.x64" -PassThru -$process.WaitForExit(); - -# Workaround for a MSVC issue that may get fixed in the future https://developercommunity.visualstudio.com/t/MicrosoftVCToolsVersion1436176prop/10385615 -$props_file = Join-Path -Path $vs_installation_path -ChildPath "VC\Auxiliary\Build\14.39.17.9\Microsoft.VCToolsVersion.14.39.17.9.props" -$data = Get-Content $props_file -$broken_redist_string = '' -$fixed_redist_string = '' -$new_data = $data.Replace($broken_redist_string, $fixed_redist_string) -$new_data | Out-File -Path $props_file diff --git a/CMakeLists.txt b/CMakeLists.txt index ab0bd0d..579ecd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,10 @@ run_conan() project(Playlunky CXX C) +# Fix MSVC 19.40 crash with mutex due to spelunky using an old redist (mscvp140.dll) +# Related links: https://github.com/microsoft/STL/releases/tag/vs-2022-17.10 | https://github.com/actions/runner-images/issues/10004 +add_compile_definitions(_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR) + set(CMAKE_CXX_STANDARD 23) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF) set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/publish") diff --git a/cmake/conan.cmake b/cmake/conan.cmake index ac9c965..f52fdcd 100644 --- a/cmake/conan.cmake +++ b/cmake/conan.cmake @@ -24,7 +24,8 @@ macro(run_conan) set(VERBOSE_SETTING "-vwarning") endif() - set(CONAN_HOST_PROFILE "default;auto-cmake" CACHE STRING "Conan host profile" FORCE) + cmake_path(SET pl_conan_profile "${CMAKE_CURRENT_SOURCE_DIR}/cmake/conan_profile") + set(CONAN_HOST_PROFILE "${pl_conan_profile};auto-cmake" CACHE STRING "Conan host profile" FORCE) set(CONAN_BUILD_PROFILE "default" CACHE STRING "Conan build profile" FORCE) set(CONAN_INSTALL_ARGS "--build=missing;${VERBOSE_SETTING}" CACHE STRING "Command line arguments for conan install" FORCE) diff --git a/cmake/conan_profile b/cmake/conan_profile new file mode 100644 index 0000000..25606b3 --- /dev/null +++ b/cmake/conan_profile @@ -0,0 +1,3 @@ +[conf] +tools.info.package_id:confs=["tools.build:defines"] +tools.build:defines=["_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR"]