diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 3a1bcacdcb..4ed9309b6c 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -255,14 +255,6 @@ jobs: if: matrix.check_mkvk == 'ONLY' run: scripts/check_mkvk.ps1 - # Works around issues with 2024.06.03.1.0 runner image. See - # https://github.com/actions/runner-images/issues/10004 and - # https://github.com/actions/runner-images/issues/10055 - - name: Remove conflicting msvcp140.dll as workaround for runner image bugs. - shell: bash -l {0} - run: | - find "C:/hostedtoolcache/windows/Java_Temurin-Hotspot_jdk" -name "msvcp140.dll" -exec rm {} \; - - name: Test Windows build # Tests built for arm64 can't be run as the CI runners are all x64. if: matrix.arch == 'x64' && matrix.options.tests == 'ON' diff --git a/CMakeLists.txt b/CMakeLists.txt index 43c664cc34..fbaf028581 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -313,6 +313,12 @@ if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "") set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "${CMAKE_CXX_COMPILER_ID}") endif() +#cmake_print_variables( +# CMAKE_CXX_COMPILER_ID +# CMAKE_CXX_COMPILER_VERSION +# CMAKE_CXX_COMPILER_FRONTEND_VARIANT +#) + # Compiler accepts MSVC-style command line options set(is_msvc_fe "$") # Compiler accepts GNU-style command line options @@ -609,6 +615,21 @@ macro(common_libktx_settings target enable_write library_type) PRIVATE # Only set dllexport when building a shared library. $<$:KTX_API=__declspec\(dllexport\)> + # Code compiled with the versions shown defaults to a constexpr + # std::mutex constructor and requires a mscvp140.dll of at least + # version 14.40.33810.00 otherwise code creating a mutex + # crashes mysteriously. Since many JVM installations bundle + # their own version of the VC++ redistributables chances are + # high they will not have a modern enough version so JNI modules + # linked with libktx will crash when multiple threads are used, + # as they are in the BasisU and ASTC encoders. + # + # To avoid this set a define to prevent the compiler using + # constexpr mutex constructors. Remove this eventually after + # in-use JVM installations have at least this VC runtime. Remove + # also from ASTCENC_LIB_TARGET settings around line 1169. + $<$,19.40.33811>>:_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR> + $<$,17.0.3>>:_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR> PUBLIC # only for basisu_c_binding. BASISU_NO_ITERATOR_DEBUG_LEVEL ) @@ -805,10 +826,6 @@ PRIVATE # Turn off these warnings until Rich fixes the occurences. # It it not clear to me if generator expressions can be used here # hence the long-winded way. -#message(STATUS -# "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID} " -# "CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION}" -#) if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") # Currently no need to disable any warnings in basisu code. Rich fixed them. elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") @@ -1150,6 +1167,15 @@ endif() set(ASTCENC_CLI OFF) # Only build as library not the CLI astcencoder add_subdirectory(external/astc-encoder) set_property(TARGET ${ASTCENC_LIB_TARGET} PROPERTY POSITION_INDEPENDENT_CODE ON) +target_compile_definitions( + ${ASTCENC_LIB_TARGET} +PRIVATE + # ASTC encoder uses std::mutex. For more info. see comment about + # same setting in libktx starting about line 618. To be eventually + # removed as noted in that comment. + $<$,19.40.33811>>:_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR> + $<$,17.0.3>>:_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR> +) if(KTX_FEATURE_STATIC_LIBRARY AND APPLE) # Make a single static library to simplify linking. diff --git a/tests/loadtests/CMakeLists.txt b/tests/loadtests/CMakeLists.txt index 8a54d2cb7b..79b71f4b4b 100644 --- a/tests/loadtests/CMakeLists.txt +++ b/tests/loadtests/CMakeLists.txt @@ -1,12 +1,12 @@ # Copyright 2017-2020 The Khronos Group Inc. # SPDX-License-Identifier: Apache-2.0 -if(WIN32) - cmake_print_variables( - CMAKE_SYSTEM_VERSION - CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION - ) -endif() +#if(WIN32) +# cmake_print_variables( +# CMAKE_SYSTEM_VERSION +# CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION +# ) +#endif() if(NOT APPLE_LOCKED_OS) set( fp_pref ${CMAKE_FIND_PACKAGE_PREFER_CONFIG} )