File tree Expand file tree Collapse file tree 3 files changed +31
-9
lines changed Expand file tree Collapse file tree 3 files changed +31
-9
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,16 @@ function(add_sycl_unittest test_dirname)
9
9
# Enable exception handling for these unit tests
10
10
set (LLVM_REQUIRES_EH 1 )
11
11
12
+ if (MSVC AND CMAKE_BUILD_TYPE MATCHES "Debug" )
13
+ set (sycl_lib "sycld" )
14
+ else ()
15
+ set (sycl_lib "sycl" )
16
+ endif ()
17
+
12
18
add_unittest (SYCLUnitTests ${test_dirname} ${ARGN} )
13
19
target_link_libraries (${test_dirname}
14
20
PRIVATE
15
- sycl
21
+ ${sycl_lib}
16
22
LLVMTestingSupport
17
23
OpenCL-Headers
18
24
)
Original file line number Diff line number Diff line change 1
- set (CMAKE_CXX_EXTENSIONS OFF )
2
-
3
- set (sycl_lib_dir $< SHELL_PATH:$< TARGET_FILE_DIR:sycl> > )
1
+ set (sycl_lib_dir $< TARGET_FILE_DIR:sycl> )
4
2
add_definitions (-DSYCL_LIB_DIR= "${sycl_lib_dir} " )
5
3
add_sycl_unittest (MiscTests
6
4
OsUtils.cpp
Original file line number Diff line number Diff line change 9
9
#include < CL/sycl/detail/os_util.hpp>
10
10
#include < gtest/gtest.h>
11
11
12
- #ifdef __unix__
12
+ #ifdef _WIN32
13
+ // / Compare for string equality, but ignore difference between forward slash (/)
14
+ // / and backward slash (\).
15
+ // /
16
+ // / This difference can be tricky to avoid, because CMake operates with forward
17
+ // / slashes even on Windows, and it can be problematic to convert them when
18
+ // / CMake generator expressions are involved. It's easier to handle slashes
19
+ // / here in the test itself.
20
+ bool isSameDir (const char * LHS, const char * RHS) {
21
+ char L = 0 , R = 0 ;
22
+ do {
23
+ L = *LHS++;
24
+ R = *RHS++;
25
+ if (L != R) {
26
+ if (!((L == ' \\ ' || L == ' /' ) && (R == ' \\ ' || R == ' /' ))) {
27
+ return false ;
28
+ }
29
+ }
30
+ } while (L != ' \0 ' && R != ' \0 ' );
31
+ bool SameLen = (L == ' \0 ' && R == ' \0 ' );
32
+ return SameLen;
33
+ }
34
+ #else
13
35
#include < sys/stat.h>
14
36
#include < stdlib.h>
15
37
// / Check with respect to symbolic links
@@ -27,10 +49,6 @@ bool isSameDir(const char* LHS, const char* RHS) {
27
49
ino_t InodeRHS = StatBuf.st_ino ;
28
50
return InodeRHS == InodeLHS;
29
51
}
30
- #else
31
- bool isSameDir (const char * LHS, const char * RHS) {
32
- return 0 == strcmp (LHS, RHS);
33
- }
34
52
#endif
35
53
36
54
class OsUtilsTest : public ::testing::Test {
You can’t perform that action at this time.
0 commit comments