-
Notifications
You must be signed in to change notification settings - Fork 20
/
pdb-patch.pl
40 lines (32 loc) · 868 Bytes
/
pdb-patch.pl
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
use strict;
my $fileName = $ARGV [0] || die ("Usage: pdb-patch.pl <AddLLVM.cmake>\n");
open (my $file, "<", $fileName) || die ("Can't open $fileName for reading: $!\n");
my $patch = '
# <<< BEGIN PDB PATCH
get_target_property(type ${name} TYPE)
if(${type} STREQUAL "STATIC_LIBRARY")
set(pdb_dir ${CMAKE_CURRENT_BINARY_DIR}/pdb)
set_target_properties(
${name}
PROPERTIES
COMPILE_PDB_NAME_DEBUG ${name}
COMPILE_PDB_OUTPUT_DIRECTORY_DEBUG ${pdb_dir}
)
install(
FILES ${pdb_dir}/${name}.pdb
CONFIGURATIONS Debug
DESTINATION lib${LLVM_LIBDIR_SUFFIX}
OPTIONAL
)
endif()
# >>> END PDB PATCH
';
my @body;
while (my $s = <$file>) {
if ($s =~ m/endmacro\s*\(add_llvm_library/) {
push (@body, $patch);
}
push (@body, $s)
}
open (my $file, ">", $fileName) || die ("Can't open $fileName for writing: $!\n");
print $file (@body);