From ce367ef52c4ad48bf5b3a4d46cdc369d542adaa2 Mon Sep 17 00:00:00 2001 From: Mehdi Chinoune Date: Sat, 30 Oct 2021 22:34:57 +0100 Subject: [PATCH] openxr: update to 1.0.20 --- .../001-generate-pkgconfig-files.patch | 12 +- mingw-w64-openxr/002-libname-def-file.patch | 8 +- .../003-disable-version-script.patch | 2 +- .../004-fix-cmake-install-dir.patch | 4 +- .../005-no-pdb-file-for-mingw-w64.patch | 11 + mingw-w64-openxr/006-cmake-gcc-11-fixes.patch | 452 ++++++++++++++++++ mingw-w64-openxr/PKGBUILD | 53 +- 7 files changed, 513 insertions(+), 29 deletions(-) create mode 100644 mingw-w64-openxr/005-no-pdb-file-for-mingw-w64.patch create mode 100644 mingw-w64-openxr/006-cmake-gcc-11-fixes.patch diff --git a/mingw-w64-openxr/001-generate-pkgconfig-files.patch b/mingw-w64-openxr/001-generate-pkgconfig-files.patch index 9fef458758..c9b0e36e75 100644 --- a/mingw-w64-openxr/001-generate-pkgconfig-files.patch +++ b/mingw-w64-openxr/001-generate-pkgconfig-files.patch @@ -1,6 +1,6 @@ ---- OpenXR-SDK-release-1.0.9/src/loader/CMakeLists.txt.orig 2020-06-18 12:38:49.709702500 +0300 -+++ OpenXR-SDK-release-1.0.9/src/loader/CMakeLists.txt 2020-06-18 12:39:37.175363800 +0300 -@@ -153,10 +153,6 @@ +--- a/src/loader/CMakeLists.txt ++++ b/src/loader/CMakeLists.txt +@@ -166,10 +166,6 @@ libopenxr_loader.so.${MAJOR}.${MINOR} ) @@ -11,8 +11,8 @@ elseif(WIN32) if(MSVC) # WindowsStore (UWP) apps must be compiled with dynamic CRT linkage (default) -@@ -210,6 +206,13 @@ - endif() +@@ -243,6 +239,13 @@ + ) endif() +if(NOT MSVC) @@ -23,5 +23,5 @@ +endif() + # Copy loader to conformance_cli binary folder if built as dynamic - if(DYNAMIC_LOADER AND BUILD_CONFORMANCE_TESTS) + if(DYNAMIC_LOADER AND BUILD_CONFORMANCE_CLI) add_custom_command(TARGET openxr_loader POST_BUILD diff --git a/mingw-w64-openxr/002-libname-def-file.patch b/mingw-w64-openxr/002-libname-def-file.patch index 61ca677ab0..1886fe9328 100644 --- a/mingw-w64-openxr/002-libname-def-file.patch +++ b/mingw-w64-openxr/002-libname-def-file.patch @@ -1,10 +1,10 @@ ---- OpenXR-SDK-release-1.0.9/src/loader/openxr-loader.def.orig 2020-06-22 12:42:09.205508200 +0300 -+++ OpenXR-SDK-release-1.0.9/src/loader/openxr-loader.def 2020-06-22 12:42:13.469169700 +0300 -@@ -19,7 +19,7 @@ +--- a/src/loader/openxr-loader.def ++++ a/src/loader/openxr-loader.def +@@ -7,7 +7,7 @@ ; ;;;; End Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; --LIBRARY openxr_loader.dll +-LIBRARY +LIBRARY libopenxr_loader.dll EXPORTS xrCreateInstance diff --git a/mingw-w64-openxr/003-disable-version-script.patch b/mingw-w64-openxr/003-disable-version-script.patch index 3d7b882abe..e3d05ec063 100644 --- a/mingw-w64-openxr/003-disable-version-script.patch +++ b/mingw-w64-openxr/003-disable-version-script.patch @@ -1,6 +1,6 @@ --- a/src/loader/CMakeLists.txt +++ b/src/loader/CMakeLists.txt -@@ -227,10 +230,12 @@ +@@ -263,10 +270,12 @@ -ffunction-sections -fdata-sections ) diff --git a/mingw-w64-openxr/004-fix-cmake-install-dir.patch b/mingw-w64-openxr/004-fix-cmake-install-dir.patch index c26adca44c..e9498491ef 100644 --- a/mingw-w64-openxr/004-fix-cmake-install-dir.patch +++ b/mingw-w64-openxr/004-fix-cmake-install-dir.patch @@ -1,10 +1,10 @@ --- a/src/loader/CMakeLists.txt +++ b/src/loader/CMakeLists.txt -@@ -251,7 +256,7 @@ +@@ -298,7 +303,7 @@ NAMESPACE OpenXR:: ) --if((CMAKE_SYSTEM_NAME STREQUAL "Windows") OR (CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")) +-if(WIN32 AND NOT INSTALL_TO_ARCHITECTURE_PREFIXES) +if(MSVC) set(TARGET_DESTINATION cmake) else() diff --git a/mingw-w64-openxr/005-no-pdb-file-for-mingw-w64.patch b/mingw-w64-openxr/005-no-pdb-file-for-mingw-w64.patch new file mode 100644 index 0000000000..50d10f7549 --- /dev/null +++ b/mingw-w64-openxr/005-no-pdb-file-for-mingw-w64.patch @@ -0,0 +1,11 @@ +--- a/src/loader/CMakeLists.txt ++++ b/src/loader/CMakeLists.txt +@@ -332,7 +339,7 @@ + COMPONENT CMakeConfigs + ) + +-if(WIN32 AND DYNAMIC_LOADER) ++if(MSVC AND DYNAMIC_LOADER) + install(FILES $ DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) + endif() + diff --git a/mingw-w64-openxr/006-cmake-gcc-11-fixes.patch b/mingw-w64-openxr/006-cmake-gcc-11-fixes.patch new file mode 100644 index 0000000000..cdcf58f341 --- /dev/null +++ b/mingw-w64-openxr/006-cmake-gcc-11-fixes.patch @@ -0,0 +1,452 @@ +From 66690965385fcc9f71fbb3caccfdeb123dfca688 Mon Sep 17 00:00:00 2001 +From: Ryan Pavlik +Date: Fri, 13 Aug 2021 11:21:50 -0500 +Subject: [PATCH 1/5] Split the filesystem conditionals into a separate header + to share with detection. + +--- + src/common/filesystem_utils.cpp | 35 +------------------------ + src/common/stdfs_conditions.h | 45 +++++++++++++++++++++++++++++++++ + 2 files changed, 46 insertions(+), 34 deletions(-) + create mode 100644 src/common/stdfs_conditions.h + +diff --git a/src/common/filesystem_utils.cpp b/src/common/filesystem_utils.cpp +index 3b0685de..d3d4182f 100644 +--- a/src/common/filesystem_utils.cpp ++++ b/src/common/filesystem_utils.cpp +@@ -20,40 +20,7 @@ + #define USE_FINAL_FS 0 + + #else +-// If the C++ macro is set to the version containing C++17, it must support +-// the final C++17 package +-#if __cplusplus >= 201703L +-#define USE_EXPERIMENTAL_FS 0 +-#define USE_FINAL_FS 1 +- +-#elif defined(_MSC_VER) && _MSC_VER >= 1900 +- +-#if defined(_HAS_CXX17) && _HAS_CXX17 +-// When MSC supports c++17 use package. +-#define USE_EXPERIMENTAL_FS 0 +-#define USE_FINAL_FS 1 +-#endif // !_HAS_CXX17 +- +-// Right now, GCC still only supports the experimental filesystem items starting in GCC 6 +-#elif (__GNUC__ >= 6) +-#define USE_EXPERIMENTAL_FS 1 +-#define USE_FINAL_FS 0 +- +-// If Clang, check for feature support +-#elif defined(__clang__) && (__cpp_lib_filesystem || __cpp_lib_experimental_filesystem) +-#if __cpp_lib_filesystem +-#define USE_EXPERIMENTAL_FS 0 +-#define USE_FINAL_FS 1 +-#else +-#define USE_EXPERIMENTAL_FS 1 +-#define USE_FINAL_FS 0 +-#endif +- +-// If all above fails, fall back to standard C++ and OS-specific items +-#else +-#define USE_EXPERIMENTAL_FS 0 +-#define USE_FINAL_FS 0 +-#endif ++#include "stdfs_conditions.h" + #endif + + #if USE_FINAL_FS == 1 +diff --git a/src/common/stdfs_conditions.h b/src/common/stdfs_conditions.h +new file mode 100644 +index 00000000..52e8a1df +--- /dev/null ++++ b/src/common/stdfs_conditions.h +@@ -0,0 +1,45 @@ ++// Copyright (c) 2017-2021 The Khronos Group Inc. ++// Copyright (c) 2017 Valve Corporation ++// Copyright (c) 2017 LunarG, Inc. ++// ++// SPDX-License-Identifier: Apache-2.0 OR MIT ++ ++#ifndef _STDFS_CONDITIONS_H ++#define _STDFS_CONDITIONS_H ++ ++// If the C++ macro is set to the version containing C++17, it must support ++// the final C++17 package ++#if __cplusplus >= 201703L ++#define USE_EXPERIMENTAL_FS 0 ++#define USE_FINAL_FS 1 ++ ++#elif defined(_MSC_VER) && _MSC_VER >= 1900 ++ ++#if defined(_HAS_CXX17) && _HAS_CXX17 ++// When MSC supports c++17 use package. ++#define USE_EXPERIMENTAL_FS 0 ++#define USE_FINAL_FS 1 ++#endif // !_HAS_CXX17 ++ ++// GCC supports the experimental filesystem items starting in GCC 6 ++#elif (__GNUC__ >= 6) ++#define USE_EXPERIMENTAL_FS 1 ++#define USE_FINAL_FS 0 ++ ++// If Clang, check for feature support ++#elif defined(__clang__) && (__cpp_lib_filesystem || __cpp_lib_experimental_filesystem) ++#if __cpp_lib_filesystem ++#define USE_EXPERIMENTAL_FS 0 ++#define USE_FINAL_FS 1 ++#else ++#define USE_EXPERIMENTAL_FS 1 ++#define USE_FINAL_FS 0 ++#endif ++ ++// If all above fails, fall back to standard C++ and OS-specific items ++#else ++#define USE_EXPERIMENTAL_FS 0 ++#define USE_FINAL_FS 0 ++#endif ++ ++#endif // !_STDFS_CONDITIONS_H + +From 0eec6af8fd08c4e0e5f63d3e4d4381fa41634ac3 Mon Sep 17 00:00:00 2001 +From: Ryan Pavlik +Date: Fri, 13 Aug 2021 11:30:01 -0500 +Subject: [PATCH 2/5] build: Port StdFilesystemFlags.cmake to use that same + header. + +Better than including the code in this file. +--- + src/cmake/StdFilesystemFlags.cmake | 44 ++++++++---------------------- + 1 file changed, 12 insertions(+), 32 deletions(-) + +diff --git a/src/cmake/StdFilesystemFlags.cmake b/src/cmake/StdFilesystemFlags.cmake +index b3e5c14b..0eb1e1d5 100644 +--- a/src/cmake/StdFilesystemFlags.cmake ++++ b/src/cmake/StdFilesystemFlags.cmake +@@ -2,6 +2,8 @@ + # + # SPDX-License-Identifier: BSL-1.0 + ++set(_FILESYSTEM_UTILS_DIR "${PROJECT_SOURCE_DIR}/src/common") ++ + if(MSVC AND MSVC_VERSION GREATER 1890) + set(HAVE_FILESYSTEM_WITHOUT_LIB + ON +@@ -26,37 +28,13 @@ else() + } + " + ) +- set(_stdfs_conditions +- "// If the C++ macro is set to the version containing C++17, it must support +- // the final C++17 package +- #if __cplusplus >= 201703L +- #define USE_FINAL_FS 1 +- +- #elif defined(_MSC_VER) && _MSC_VER >= 1900 +- +- #if defined(_HAS_CXX17) && _HAS_CXX17 +- // When MSC supports c++17 use package. +- #define USE_FINAL_FS 1 +- #endif // !_HAS_CXX17 +- +- // Right now, GCC still only supports the experimental filesystem items starting in GCC 6 +- #elif (__GNUC__ >= 6) +- #define USE_EXPERIMENTAL_FS 1 + +- // If Clang, check for feature support +- #elif defined(__clang__) && (__cpp_lib_filesystem || __cpp_lib_experimental_filesystem) +- #if __cpp_lib_filesystem +- #define USE_FINAL_FS 1 +- #else +- #define USE_EXPERIMENTAL_FS 1 +- #endif ++ set(_stdfs_conditions "#include ++ ") + +- #endif +- " +- ) + set(_stdfs_source + "${_stdfs_conditions} +- #ifdef USE_FINAL_FS ++ #if defined(USE_FINAL_FS) && USE_FINAL_FS + #include + using namespace std::filesystem; + #endif +@@ -65,7 +43,7 @@ else() + ) + set(_stdfs_experimental_source + "${_stdfs_conditions} +- #ifdef USE_EXPERIMENTAL_FS ++ #if defined(USE_EXPERIMENTAL_FS) && USE_EXPERIMENTAL_FS + #include + using namespace std::experimental::filesystem; + #endif +@@ -74,11 +52,11 @@ else() + ) + set(_stdfs_needlib_source + "${_stdfs_conditions} +- #ifdef USE_FINAL_FS ++ #if defined(USE_FINAL_FS) && USE_FINAL_FS + #include + using namespace std::filesystem; + #endif +- #ifdef USE_EXPERIMENTAL_FS ++ #if defined(USE_EXPERIMENTAL_FS) && USE_EXPERIMENTAL_FS + #include + using namespace std::experimental::filesystem; + #endif +@@ -88,8 +66,10 @@ else() + + # First, just look for the include. + # We're checking if it compiles, not if the include exists, +- # because the source code uses similar conditionals to decide. ++ # because the source code uses the same conditionals to decide. ++ # (Static libraries are just object files, they don't get linked) + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) ++ set(CMAKE_REQUIRED_INCLUDES "${_FILESYSTEM_UTILS_DIR}") + unset(CMAKE_REQUIRED_LIBRARIES) + unset(CMAKE_REQUIRED_FLAGS) + check_cxx_source_compiles("${_stdfs_source}" HAVE_FILESYSTEM_IN_STD) +@@ -121,7 +101,7 @@ else() + check_cxx_source_compiles("${_stdfs_needlib_source}" HAVE_FILESYSTEM_NEEDING_LIBCXXFS) + unset(CMAKE_REQUIRED_LIBRARIES) + unset(CMAKE_TRY_COMPILE_TARGET_TYPE) +- ++ unset(CMAKE_REQUIRED_INCLUDES) + endif() + + function(openxr_add_filesystem_utils TARGET_NAME) + +From 288ab9228c866fefb50254f29f6925422df1580a Mon Sep 17 00:00:00 2001 +From: Ryan Pavlik +Date: Fri, 13 Aug 2021 11:30:16 -0500 +Subject: [PATCH 3/5] build: Clean up and document StdFilesystemFlags.cmake + +--- + src/cmake/StdFilesystemFlags.cmake | 62 ++++++++++++++++++++++++++++-- + 1 file changed, 58 insertions(+), 4 deletions(-) + +diff --git a/src/cmake/StdFilesystemFlags.cmake b/src/cmake/StdFilesystemFlags.cmake +index 0eb1e1d5..35af972c 100644 +--- a/src/cmake/StdFilesystemFlags.cmake ++++ b/src/cmake/StdFilesystemFlags.cmake +@@ -20,7 +20,14 @@ if(MSVC AND MSVC_VERSION GREATER 1890) + else() + include(CheckCXXSourceCompiles) + +- # This is just example code that is known to not compile if std::filesystem isn't working right ++ ### ++ # Test Sources ++ ### ++ ++ # This is just example code that is known to not compile if std::filesystem isn't working right. ++ # It depends on having the proper includes and `using namespace` so it can use the `is_regular_file` ++ # function unqualified. ++ # It is at the end of every test file below. + set(_stdfs_test_source + "int main() { + (void)is_regular_file(\"/\"); +@@ -29,9 +36,23 @@ else() + " + ) + ++ # This is preprocessor code included in all test compiles, which pulls in the conditions ++ # originally found in filesystem_utils.cpp. ++ # ++ # It defines: ++ # USE_FINAL_FS = 1 if it thinks we have the full std::filesystem in as in C++17 ++ # USE_EXPERIMENTAL_FS = 1 if it thinks we don't have the full c++17 filesystem, but should have ++ # std::experimental::filesystem and ++ # ++ # Ideally the first condition (__cplusplus >= 201703L) would handle most cases, ++ # however you're not supposed to report that unless you're fully conformant with all ++ # of c++17, so you might have a c++17 build flag and the final filesystem library but ++ # a lower __cplusplus value if some other part of the standard is missing. + set(_stdfs_conditions "#include + ") + ++ # This should only compile if our common detection code decides on the ++ # **final** (non-experimental) filesystem library. + set(_stdfs_source + "${_stdfs_conditions} + #if defined(USE_FINAL_FS) && USE_FINAL_FS +@@ -41,6 +62,9 @@ else() + ${_stdfs_test_source} + " + ) ++ ++ # This should only compile if our common detection code decides on the ++ # **experimental** filesystem library. + set(_stdfs_experimental_source + "${_stdfs_conditions} + #if defined(USE_EXPERIMENTAL_FS) && USE_EXPERIMENTAL_FS +@@ -50,6 +74,11 @@ else() + ${_stdfs_test_source} + " + ) ++ ++ # This should compile if the common detection code decided that either ++ # the experimental or final filesystem library is available. ++ # We use this when trying to detect what library to link, if any: ++ # earlier checks are the ones that care about how we include the headers. + set(_stdfs_needlib_source + "${_stdfs_conditions} + #if defined(USE_FINAL_FS) && USE_FINAL_FS +@@ -64,6 +93,10 @@ else() + " + ) + ++ ### ++ # Identifying header/namespace and standards flags ++ ### ++ + # First, just look for the include. + # We're checking if it compiles, not if the include exists, + # because the source code uses the same conditionals to decide. +@@ -75,15 +108,20 @@ else() + check_cxx_source_compiles("${_stdfs_source}" HAVE_FILESYSTEM_IN_STD) + check_cxx_source_compiles("${_stdfs_experimental_source}" HAVE_FILESYSTEM_IN_STDEXPERIMENTAL) + ++ # See if the "final" version builds if we try to specify C++17 explicitly ++ # TODO I think this should actually be compiler flags, not cmake flags... + set(CMAKE_REQUIRED_FLAGS "-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=TRUE") + check_cxx_source_compiles("${_stdfs_source}" HAVE_FILESYSTEM_IN_STD_17) + unset(CMAKE_REQUIRED_FLAGS) + ++ # If we found the final version of filesystem when specifying c++17 explicitly, ++ # but found it no other way, then we record that we must use C++17 flags. + if(HAVE_FILESYSTEM_IN_STD_17 AND NOT HAVE_FILESYSTEM_IN_STD) + set(HAVE_FILESYSTEM_NEEDS_17 + ON + CACHE INTERNAL "" + ) ++ # TODO I think this should actually be compiler flags, not cmake flags... + set(CMAKE_REQUIRED_FLAGS "-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=TRUE") + else() + set(HAVE_FILESYSTEM_NEEDS_17 +@@ -92,21 +130,37 @@ else() + ) + endif() + +- # Now, see if we need libstdc++fs ++ ### ++ # Identifying library to link ++ ### ++ ++ # Now, see if we need to link against libstdc++fs, and what it's called ++ # If we needed c++17 standard flags to find it, they've already been set above. + set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE) ++ ++ # Try with no lib specified + check_cxx_source_compiles("${_stdfs_needlib_source}" HAVE_FILESYSTEM_WITHOUT_LIB) ++ ++ # Try with stdc++fs + set(CMAKE_REQUIRED_LIBRARIES stdc++fs) + check_cxx_source_compiles("${_stdfs_needlib_source}" HAVE_FILESYSTEM_NEEDING_LIBSTDCXXFS) ++ ++ # Try with c++fs (from clang's libc++) + set(CMAKE_REQUIRED_LIBRARIES c++fs) + check_cxx_source_compiles("${_stdfs_needlib_source}" HAVE_FILESYSTEM_NEEDING_LIBCXXFS) ++ ++ # Clean up these variables before the next user. + unset(CMAKE_REQUIRED_LIBRARIES) + unset(CMAKE_TRY_COMPILE_TARGET_TYPE) + unset(CMAKE_REQUIRED_INCLUDES) + endif() + ++# Use the observations of the code above to add the filesystem_utils.cpp ++# file to a target, along with any required compiler settings and libraries. ++# Also handles our BUILD_WITH_STD_FILESYSTEM option. + function(openxr_add_filesystem_utils TARGET_NAME) +- target_sources(${TARGET_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/src/common/filesystem_utils.cpp) +- target_include_directories(${TARGET_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/src/common) ++ target_sources(${TARGET_NAME} PRIVATE ${_FILESYSTEM_UTILS_DIR}/filesystem_utils.cpp) ++ target_include_directories(${TARGET_NAME} PRIVATE ${_FILESYSTEM_UTILS_DIR}) + if(NOT BUILD_WITH_STD_FILESYSTEM) + target_compile_definitions(${TARGET_NAME} PRIVATE DISABLE_STD_FILESYSTEM) + else() + +From bbef2219ecfae31bc67962d945146cf4f8f9d4fc Mon Sep 17 00:00:00 2001 +From: Ryan Pavlik +Date: Mon, 25 Oct 2021 12:26:02 -0500 +Subject: [PATCH 4/5] build: Update to handle GCC 11 explicitly. + +--- + src/cmake/StdFilesystemFlags.cmake | 26 +++++++++++++++----------- + 1 file changed, 15 insertions(+), 11 deletions(-) + +diff --git a/src/cmake/StdFilesystemFlags.cmake b/src/cmake/StdFilesystemFlags.cmake +index 35af972c..e80d3919 100644 +--- a/src/cmake/StdFilesystemFlags.cmake ++++ b/src/cmake/StdFilesystemFlags.cmake +@@ -104,24 +104,28 @@ else() + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + set(CMAKE_REQUIRED_INCLUDES "${_FILESYSTEM_UTILS_DIR}") + unset(CMAKE_REQUIRED_LIBRARIES) +- unset(CMAKE_REQUIRED_FLAGS) +- check_cxx_source_compiles("${_stdfs_source}" HAVE_FILESYSTEM_IN_STD) +- check_cxx_source_compiles("${_stdfs_experimental_source}" HAVE_FILESYSTEM_IN_STDEXPERIMENTAL) ++ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0) ++ # GCC 11+ defaults to C++17 mode and acts badly in these tests if we tell it to use a different version. ++ set(HAVE_FILESYSTEM_IN_STD_17 ON) ++ set(HAVE_FILESYSTEM_IN_STD OFF) ++ else() ++ set(CMAKE_REQUIRED_FLAGS "-DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=TRUE") ++ check_cxx_source_compiles("${_stdfs_source}" HAVE_FILESYSTEM_IN_STD) ++ check_cxx_source_compiles("${_stdfs_experimental_source}" HAVE_FILESYSTEM_IN_STDEXPERIMENTAL) + +- # See if the "final" version builds if we try to specify C++17 explicitly +- # TODO I think this should actually be compiler flags, not cmake flags... +- set(CMAKE_REQUIRED_FLAGS "-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=TRUE") +- check_cxx_source_compiles("${_stdfs_source}" HAVE_FILESYSTEM_IN_STD_17) +- unset(CMAKE_REQUIRED_FLAGS) ++ # See if the "final" version builds if we try to specify C++17 explicitly ++ set(CMAKE_REQUIRED_FLAGS "-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=TRUE") ++ check_cxx_source_compiles("${_stdfs_source}" HAVE_FILESYSTEM_IN_STD_17) ++ unset(CMAKE_REQUIRED_FLAGS) ++ endif() + +- # If we found the final version of filesystem when specifying c++17 explicitly, ++ # If we found the final version of filesystem when specifying C++17 explicitly, + # but found it no other way, then we record that we must use C++17 flags. + if(HAVE_FILESYSTEM_IN_STD_17 AND NOT HAVE_FILESYSTEM_IN_STD) + set(HAVE_FILESYSTEM_NEEDS_17 + ON + CACHE INTERNAL "" + ) +- # TODO I think this should actually be compiler flags, not cmake flags... + set(CMAKE_REQUIRED_FLAGS "-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=TRUE") + else() + set(HAVE_FILESYSTEM_NEEDS_17 +@@ -135,7 +139,7 @@ else() + ### + + # Now, see if we need to link against libstdc++fs, and what it's called +- # If we needed c++17 standard flags to find it, they've already been set above. ++ # If we needed C++17 standard flags to find it, they've already been set above. + set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE) + + # Try with no lib specified + +From 6b8f48bb6413b447f2b420f89121e1244a43f0d5 Mon Sep 17 00:00:00 2001 +From: Ryan Pavlik +Date: Thu, 28 Oct 2021 17:27:44 -0500 +Subject: [PATCH 5/5] Changelog fragment + +--- + changes/sdk/pr.276.gh.OpenXR-SDK-Source.md | 5 +++++ + 1 file changed, 5 insertions(+) + create mode 100644 changes/sdk/pr.276.gh.OpenXR-SDK-Source.md + +diff --git a/changes/sdk/pr.276.gh.OpenXR-SDK-Source.md b/changes/sdk/pr.276.gh.OpenXR-SDK-Source.md +new file mode 100644 +index 00000000..63086223 +--- /dev/null ++++ b/changes/sdk/pr.276.gh.OpenXR-SDK-Source.md +@@ -0,0 +1,5 @@ ++--- ++- issue.260.gh.OpenXR-SDK-Source ++- issue.1571.gl ++--- ++- Fix detection of std::filesystem options on GCC 11 and newer. diff --git a/mingw-w64-openxr/PKGBUILD b/mingw-w64-openxr/PKGBUILD index 45de6d640c..128903e00b 100644 --- a/mingw-w64-openxr/PKGBUILD +++ b/mingw-w64-openxr/PKGBUILD @@ -3,7 +3,7 @@ _realname=openxr-sdk pkgbase=mingw-w64-${_realname} pkgname=${MINGW_PACKAGE_PREFIX}-${_realname} -pkgver=1.0.12 +pkgver=1.0.20 pkgrel=1 pkgdesc='OpenXR is a royalty-free, open standard that provides high-performance access to Augmented Reality (AR) and Virtual Reality (VR) (mingw-w64)' arch=('any') @@ -21,20 +21,41 @@ source=(${_realname}-${pkgver}.tar.gz::https://github.com/KhronosGroup/OpenXR-SD 002-libname-def-file.patch 003-disable-version-script.patch 004-fix-cmake-install-dir.patch + 005-no-pdb-file-for-mingw-w64.patch + 006-cmake-gcc-11-fixes.patch libopenxr_loader_32.def) -sha256sums=('66ec1d325b820fff4dac62183c271c05de16835b97b1ad2416a01105f94407da' - '8af59e72237185982c3234ceebf98f61b57bc4ac39f51ec619c04b2120bceb51' - 'f564371aed6dc7bfc2aaad3745791fa00ccb8f7a346da2aca82e3ee780fd7a9c' - 'd2974e5e3e69be52cf83e57aa19ab32114f0b9fd3a1d9dedf78235c5ce3bfeda' - 'b8037431a695b747179bee352d5ac0c662d26cc29f3fa160503b1d66925ce092' +sha256sums=('b32703d30b4f40f5cb1a16e7242e3587ad5b3b47893c90dce884b162c5ca0e02' + 'b3deca2f23e535b40bd25d76adf907075373d9616b9bb6dc009209ab895569fb' + 'da99914487a7c27137a13ff6ae39344cb9276a8cee41eeffc34b688deceff1a9' + '66f71a382a27c82d17ea5425e61b18503cecc2a52b9b8c6561344d7a562c070e' + 'a03fc2adf3a3f083c92bb44e76511d22c6ad0ac5ab212ebce68e6dcbb01c72e7' + '6acfe285e771e750fc2ac6dbcbf4142c3b7d86f660dd80e228ca4a2a90ff0e4a' + 'b0e025f6f7bd81a0c254d1b0d6836a08c78b60051d1e262e4575d4e3de5c8034' 'c268c94efe7ec8cfb83eccc506a8035869dd42eebfb5037537ecf642b08f25cc') +validpgpkeys=(F029455EAB70F520FF4A03BD7F534CD56F00321E) + +# Helper macros to help make tasks easier # +apply_patch_with_msg() { + for _patch in "$@" + do + msg2 "Applying $_patch" + patch -Np1 -i "${srcdir}/$_patch" + done +} prepare() { cd ${srcdir}/OpenXR-SDK-release-${pkgver} - patch -p1 -i ${srcdir}/001-generate-pkgconfig-files.patch - patch -p1 -i ${srcdir}/002-libname-def-file.patch - patch -p1 -i ${srcdir}/003-disable-version-script.patch - patch -p1 -i ${srcdir}/004-fix-cmake-install-dir.patch + + apply_patch_with_msg \ + 001-generate-pkgconfig-files.patch \ + 002-libname-def-file.patch \ + 003-disable-version-script.patch \ + 004-fix-cmake-install-dir.patch \ + 005-no-pdb-file-for-mingw-w64.patch + + # https://github.com/KhronosGroup/OpenXR-SDK-Source/pull/276 + apply_patch_with_msg \ + 006-cmake-gcc-11-fixes.patch # For stdcall fixup, generated from upstream released DLLs if [ "${CARCH}" = "i686" ]; then @@ -43,8 +64,8 @@ prepare() { } build() { - [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}" - mkdir -p "${srcdir}/build-${MINGW_CHOST}" && cd "${srcdir}/build-${MINGW_CHOST}" + [[ -d "${srcdir}/build-${MSYSTEM}" ]] && rm -rf "${srcdir}/build-${MSYSTEM}" + mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}" declare -a _extra_config if check_option "debug" "n"; then @@ -55,7 +76,7 @@ build() { export VULKAN_SDK=${MINGW_PREFIX} MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ - ${MINGW_PREFIX}/bin/cmake.exe \ + ${MINGW_PREFIX}/bin/cmake \ -G"Ninja" \ -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ "${_extra_config[@]}" \ @@ -63,12 +84,12 @@ build() { -DBUILD_WITH_SYSTEM_JSONCPP=ON \ ../OpenXR-SDK-release-${pkgver} - ${MINGW_PREFIX}/bin/cmake.exe --build ./ + cmake --build . } package() { - cd ${srcdir}/build-${MINGW_CHOST} - DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake.exe --build ./ --target install + cd ${srcdir}/build-${MSYSTEM} + DESTDIR="${pkgdir}" cmake --install . install -Dm644 "${srcdir}"/OpenXR-SDK-release-${pkgver}/LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE" }