forked from revery-ui/esy-skia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xamarin_inject_compat.py
34 lines (30 loc) · 1.07 KB
/
xamarin_inject_compat.py
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
#!/usr/bin/env python
import os
import sys
root = sys.argv[1]
files = [
"third_party/externals/dng_sdk/source/dng_string.cpp",
"third_party/externals/dng_sdk/source/dng_utils.cpp",
"third_party/externals/dng_sdk/source/dng_pthread.cpp",
"third_party/externals/zlib/deflate.c",
"third_party/externals/libpng/pngpriv.h",
"third_party/externals/libjpeg-turbo/simd/jsimd_x86_64.c",
"third_party/externals/libjpeg-turbo/simd/jsimd_i386.c",
"third_party/externals/libjpeg-turbo/simd/jsimd_arm.c",
"third_party/externals/libjpeg-turbo/simd/jsimd_arm64.c",
]
for f in files:
af = os.path.join(root, f)
# some targets don't have all the dependencies
if not os.path.isfile(af):
continue
# read the file
with file(af, 'r') as original:
data = original.read()
# create the include
slashes = "../" * f.count('/')
inc = '#include "' + slashes + 'include/xamarin/WinRTCompat.h"'
# write it to the file
if not data.startswith(inc):
with file(af, 'w') as modified:
modified.write(inc + '\n' + data)