-
Notifications
You must be signed in to change notification settings - Fork 23
/
kinc_gyp.py
45 lines (35 loc) · 980 Bytes
/
kinc_gyp.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
35
36
37
38
39
40
41
42
43
44
45
import json
import subprocess
from sys import platform
print(subprocess.check_output(['Kinc/Tools/windows_x64/kmake.exe', '--json', '--nosymlinks']))
data = json.loads('{}')
with open('build/Krom.json', 'r') as f:
data = json.load(f)
gypi = {
'sources': [
],
'include_dirs': [
],
'defines': [
]
}
gypi['sources'].append('src/krom/main.cpp')
for file in data['files']:
gypi['sources'].append(file.replace('\\', '/'))
for include in data['includes']:
gypi['include_dirs'].append(include.replace('\\', '/'))
gypi['defines'].append('KINC_NO_MAIN')
for define in data['defines']:
gypi['defines'].append(define)
with open('krom.gypi', 'w') as f:
json.dump(gypi, f, indent=4)
libs_gypi = {
'libraries': [
]
}
if platform == "win32":
libs_gypi['libraries'].append('OleAut32')
for lib in data['libraries']:
libs_gypi['libraries'].append(lib)
with open('krom_libs.gypi', 'w') as f:
json.dump(libs_gypi, f, indent=4)