File tree Expand file tree Collapse file tree 7 files changed +41
-0
lines changed Expand file tree Collapse file tree 7 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ option(SYCL_ADD_DEV_VERSION_POSTFIX "Adds -V postfix to version string" ON)
11
11
12
12
list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake/modules" )
13
13
include (AddSYCLExecutable )
14
+ include (SYCLUtils )
14
15
15
16
set (SYCL_MAJOR_VERSION 5 )
16
17
set (SYCL_MINOR_VERSION 4 )
@@ -48,6 +49,15 @@ if(MSVC)
48
49
# Skip asynchronous C++ exceptions catching and assume "extern C" functions
49
50
# never throw C++ exceptions.
50
51
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc" )
52
+
53
+ # Add PDB debug information
54
+ list (APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR} " )
55
+ include (LLVMCheckLinkerFlag )
56
+ llvm_check_linker_flag (CXX "/DEBUG" LINKER_SUPPORTS_DEBUG )
57
+ if (LINKER_SUPPORTS_DEBUG )
58
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi" )
59
+ add_link_options ("/DEBUG" )
60
+ endif ()
51
61
endif ()
52
62
53
63
# Get clang's version
Original file line number Diff line number Diff line change
1
+ list (APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR} " )
2
+ include (LLVMCheckLinkerFlag )
3
+
4
+ # add_stripped_pdb(TARGET_NAME)
5
+ #
6
+ # Will add option for generating stripped PDB file and install the generated
7
+ # file as ${ARG_TARGET_NAME}.pdb in bin folder.
8
+ # NOTE: LLD does not currently support /PDBSTRIPPED so the PDB file is optional.
9
+ macro (add_stripped_pdb ARG_TARGET_NAME )
10
+ llvm_check_linker_flag (CXX "/PDBSTRIPPED:${ARG_TARGET_NAME} .stripped.pdb"
11
+ LINKER_SUPPORTS_PDBSTRIPPED )
12
+ if (LINKER_SUPPORTS_PDBSTRIPPED )
13
+ target_link_options (${ARG_TARGET_NAME}
14
+ PRIVATE "/PDBSTRIPPED:${ARG_TARGET_NAME} .stripped.pdb" )
15
+ install (FILES "${CMAKE_CURRENT_BINARY_DIR} /${ARG_TARGET_NAME} .stripped.pdb"
16
+ DESTINATION ${CMAKE_INSTALL_PREFIX} /bin
17
+ RENAME "${ARG_TARGET_NAME} .pdb"
18
+ COMPONENT ${ARG_TARGET_NAME}
19
+ OPTIONAL )
20
+ endif ()
21
+ endmacro ()
Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ if (MSVC)
49
49
# by defining __SYCL_BUILD_SYCL_DLL, we can use __declspec(dllexport)
50
50
# which are individually tagged for all pi* symbols in pi.h
51
51
target_compile_definitions (pi_cuda PRIVATE __SYCL_BUILD_SYCL_DLL )
52
+ # Install stripped PDB
53
+ add_stripped_pdb (pi_cuda )
52
54
else ()
53
55
# we set the visibility of all symbols 'hidden' by default.
54
56
# In pi.h file, we set exported symbols with visibility==default individually
Original file line number Diff line number Diff line change @@ -105,6 +105,8 @@ if (MSVC)
105
105
# by defining __SYCL_BUILD_SYCL_DLL, we can use __declspec(dllexport)
106
106
# which are individually tagged for all pi* symbols in pi.h
107
107
target_compile_definitions (pi_esimd_emulator PRIVATE __SYCL_BUILD_SYCL_DLL )
108
+ # Install stripped PDB
109
+ add_stripped_pdb (pi_esimd_emulator )
108
110
else ()
109
111
# we set the visibility of all symbols 'hidden' by default.
110
112
# In pi.h file, we set exported symbols with visibility==default individually
Original file line number Diff line number Diff line change @@ -114,6 +114,8 @@ if (MSVC)
114
114
# by defining __SYCL_BUILD_SYCL_DLL, we can use __declspec(dllexport)
115
115
# which are individually tagged for all pi* symbols in pi.h
116
116
target_compile_definitions (pi_level_zero PRIVATE __SYCL_BUILD_SYCL_DLL )
117
+ # Install stripped PDB
118
+ add_stripped_pdb (pi_level_zero )
117
119
else ()
118
120
# we set the visibility of all symbols 'hidden' by default.
119
121
# In pi.h file, we set exported symbols with visibility==default individually
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ if (MSVC)
32
32
# by defining __SYCL_BUILD_SYCL_DLL, we can use __declspec(dllexport)
33
33
# which are individually tagged for all pi* symbols in pi.h
34
34
target_compile_definitions (pi_opencl PRIVATE __SYCL_BUILD_SYCL_DLL )
35
+ # Install stripped PDB
36
+ add_stripped_pdb (pi_opencl )
35
37
else ()
36
38
# we set the visibility of all symbols 'hidden' by default.
37
39
# In pi.h file, we set exported symbols with visibility==default individually
Original file line number Diff line number Diff line change @@ -48,6 +48,8 @@ function(add_sycl_rt_library LIB_NAME)
48
48
if (MSVC )
49
49
target_compile_definitions (${LIB_OBJ_NAME} PRIVATE __SYCL_BUILD_SYCL_DLL )
50
50
target_link_libraries (${LIB_NAME} PRIVATE shlwapi )
51
+ # Install stripped PDB
52
+ add_stripped_pdb (${LIB_NAME} )
51
53
else ()
52
54
target_compile_options (${LIB_OBJ_NAME} PUBLIC
53
55
-fvisibility=hidden -fvisibility-inlines-hidden )
You can’t perform that action at this time.
0 commit comments