aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2014-05-31 19:24:09 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2014-05-31 19:24:09 +0300
commit4fe17f484f91f0ba4be086db420087c4723bcb9c (patch)
treef962721adc2ff91cc8efed5c7f19a3c851c3c302 /tools
parent5be785ab96ac5c9fdbc5b1406985d1321295f641 (diff)
downloadmeson-4fe17f484f91f0ba4be086db420087c4723bcb9c.zip
meson-4fe17f484f91f0ba4be086db420087c4723bcb9c.tar.gz
meson-4fe17f484f91f0ba4be086db420087c4723bcb9c.tar.bz2
Recurse to subdirectories.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/cmake2meson.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/cmake2meson.py b/tools/cmake2meson.py
index b2f7b00..b2784bf 100755
--- a/tools/cmake2meson.py
+++ b/tools/cmake2meson.py
@@ -34,7 +34,7 @@ class Lexer:
self.token_specification = [
# Need to be sorted longest to shortest.
('ignore', re.compile(r'[ \t]')),
- ('id', re.compile('[-+_0-9a-z/A-Z.]+')),
+ ('id', re.compile('[-+_0-9a-z/A-Z.@]+')),
('eol', re.compile(r'\n')),
('comment', re.compile(r'\#.*')),
('lparen', re.compile(r'\(')),
@@ -124,11 +124,15 @@ def convert(cmake_root):
cmakecode = open(cfile).read()
p = Parser(cmakecode)
for t in p.parse():
- print(t.name, t.args)
-
+ if t.name == 'add_subdirectory':
+ print('\nRecursing to subdir', t.args[0], '\n')
+ convert(os.path.join(cmake_root, t.args[0]))
+ else:
+ print(t.name, t.args)
if __name__ == '__main__':
if len(sys.argv) != 2:
print(sys.argv[0], '<CMake project root>')
+ sys.exit(1)
convert(sys.argv[1])