summaryrefslogtreecommitdiff
path: root/sci-libs/hipSPARSE/files/hipSPARSE-6.4.1-fix-filesystem.patch
blob: 64dd4e6c72ca82c267fc8a3e2ef42bdb9371faa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
Fix USE=benchmark compilation with libstdc++-15

Bug: https://bugs.gentoo.org/960459
Upstream PR: https://github.com/ROCm/hipSPARSE/pull/568
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,11 +66,20 @@ endif( )
 # hipSPARSE project
 project(hipsparse LANGUAGES CXX ${fortran_language})
 
-# Build flags
-set(CMAKE_CXX_STANDARD 14)
+# Set CXX flags
+if (NOT DEFINED CMAKE_CXX_STANDARD)
+  set(CMAKE_CXX_STANDARD 17)
+endif()
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_CXX_EXTENSIONS OFF)
 
+# Set CXX standard
+if (CMAKE_CXX_STANDARD EQUAL 14)
+  message( DEPRECATION "Builds using the C++14 standard will no longer be supported in the next major release" )
+elseif(NOT CMAKE_CXX_STANDARD EQUAL 17)
+  message(FATAL_ERROR "Only C++14 and C++17 are supported")
+endif()
+
 # Build options
 option(BUILD_SHARED_LIBS "Build hipSPARSE as a shared library" ON)
 option(BUILD_CLIENTS_TESTS "Build tests (requires googletest)" OFF)
--- a/clients/CMakeLists.txt
+++ b/clients/CMakeLists.txt
@@ -55,11 +55,20 @@ if(NOT TARGET hipsparse)
   option(BUILD_CLIENTS_BENCHMARKS "Build benchmarks" ON)
 endif()
 
-# Build flags
-set(CMAKE_CXX_STANDARD 14)
+# Set CXX flags
+if (NOT DEFINED CMAKE_CXX_STANDARD)
+  set(CMAKE_CXX_STANDARD 17)
+endif()
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_CXX_EXTENSIONS OFF)
 
+# Set CXX standard
+if (CMAKE_CXX_STANDARD EQUAL 14)
+  message( DEPRECATION "Builds using the C++14 standard will no longer be supported in the next major release" )
+elseif(NOT CMAKE_CXX_STANDARD EQUAL 17)
+  message(FATAL_ERROR "Only C++14 and C++17 are supported")
+endif()
+
 # If OpenMP is available, we can use it to speed up some tests
 find_package(OpenMP QUIET)
 find_package(Threads QUIET)
--- a/clients/common/utility.cpp
+++ b/clients/common/utility.cpp
@@ -36,40 +36,10 @@
 
 #ifdef __cpp_lib_filesystem
 #include <filesystem>
+namespace fs = std::filesystem;
 #else
 #include <experimental/filesystem>
-
-namespace std
-{
-    namespace filesystem = experimental::filesystem;
-}
-#endif
-#if 0
-#ifdef WIN32
-#include <windows.h>
-#endif
-
-#include "utility.hpp"
-
-#include <hip/hip_runtime_api.h>
-#include <hipsparse.h>
-#include <stdio.h>
-// #include <sys/time.h>
-#include <chrono>
-//#define _USE_MATH_DEFINES
-#include <cmath>
-#include <cstdlib>
-
-#ifdef __cpp_lib_filesystem
-#include <filesystem>
-#else
-#include <experimental/filesystem>
-
-namespace std
-{
-    namespace filesystem = experimental::filesystem;
-}
-#endif
+namespace fs = std::experimental::filesystem;
 #endif
 
 /* ============================================================================================ */
@@ -91,7 +61,7 @@ std::string hipsparse_exepath()
         result.resize(result.size() * 2);
     }
 
-    std::filesystem::path exepath(result.begin(), result.end());
+    fs::path exepath(result.begin(), result.end());
     exepath = exepath.remove_filename();
     exepath += exepath.empty() ? "" : "/";
     return exepath.string();