Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit 33358ba

Browse files
authored
Add script to generate winrt headers using cppwinrt.exe (#442)
* Add script to generate winrt headers using cppwinrt.exe * Fix script
1 parent e45c86c commit 33358ba

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env python
2+
# Copyright 2014 The Chromium Authors. All rights reserved.
3+
# Use of this source code is governed by a BSD-style license that can be
4+
# found in the LICENSE file.
5+
6+
import os
7+
import shutil
8+
import subprocess
9+
import sys
10+
11+
def clean(output_dir):
12+
if os.path.exists(output_dir):
13+
shutil.rmtree(output_dir, ignore_errors=True)
14+
return
15+
16+
17+
def generate_headers(output_dir):
18+
"""Run cppwinrt.exe on the installed Windows SDK version and generate
19+
cppwinrt headers in the output directory.
20+
"""
21+
22+
cppwinrt_exe = os.path.join(
23+
__file__,
24+
'..\\..\\..\\third_party\\cppwinrt\\bin\\cppwinrt.exe')
25+
26+
args = [cppwinrt_exe, '-in', 'sdk',
27+
'-out', '%s' % output_dir]
28+
29+
subprocess.check_output(args)
30+
31+
return 0
32+
33+
34+
def main(argv):
35+
generated_dir = os.path.join(
36+
__file__,
37+
'..\\..\\..\\third_party\\cppwinrt\\generated')
38+
clean(generated_dir)
39+
return generate_headers(generated_dir)
40+
41+
if __name__ == "__main__":
42+
sys.exit(main(sys.argv[1:]))

0 commit comments

Comments
 (0)