summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-10-31 12:56:48 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2018-10-31 13:42:24 +0100
commit8a4df21de88bc8cac9a48ba5c6e38c97c0af0c16 (patch)
tree09e3e3d7f02b37eea78ba4de8c5dc36241ff7171
parentddb06ddc1b2b7520bedc98b75d3000fb4de4a1e2 (diff)
here comes a helper script
run python3 ./setup.py in the root directory, this will create a meson.build and a directory called subdirectry. You can now simply use the meson.build script as "main" project, all other projects will be build in this.
-rw-r--r--meson.build.in10
-rwxr-xr-xsetup.py59
2 files changed, 69 insertions, 0 deletions
diff --git a/meson.build.in b/meson.build.in
new file mode 100644
index 00000000..48aedf3d
--- /dev/null
+++ b/meson.build.in
@@ -0,0 +1,10 @@
1project('efl-examples',
2 'c',
3 version: '1.0'
4)
5
6subprojects = $subprojects
7
8foreach subp : subprojects
9 subproject(subp)
10endforeach
diff --git a/setup.py b/setup.py
new file mode 100755
index 00000000..11b1df0b
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,59 @@
1#!/usr/bin/python3
2import os
3from string import Template
4
5supported_languages = ["c", "csharp", "cxx"]
6directories = ["apps", "reference", "tutorial"] # "examples", "legacy-examples"
7goals = []
8subprojects = []
9
10class SubProjectGoal:
11 def __init__(self, language, path):
12 self.language = language
13 self.path = path
14
15 def verify(self):
16 assert os.path.isdir(self.path)
17 assert os.path.isfile(os.path.join(self.path, 'meson.build'))
18
19 def flush(self):
20 os.symlink(os.path.join('..', self.path), os.path.realpath(os.path.join('subprojects', self.link_file_name())))
21
22 def link_file_name(self):
23 return self.language+'-'+os.path.basename(self.path)
24
25for directory in directories:
26 for lang in supported_languages:
27 explore_dir = os.path.join(directory, lang)
28 if os.path.isdir(explore_dir):
29 meson_build_file = os.path.join(explore_dir, "meson.build")
30 if os.path.isfile(meson_build_file):
31 goals.append(SubProjectGoal(lang, explore_dir))
32 else:
33 for content in os.listdir(explore_dir):
34 sub = os.path.join(explore_dir, content)
35 if os.path.isdir(sub):
36 goals.append(SubProjectGoal(lang, sub))
37
38if not os.path.isdir('./subprojects'):
39 os.mkdir('./subprojects')
40else:
41 for content in os.listdir('./subprojects'):
42 os.unlink(os.path.join('subprojects', content))
43
44for subproject in goals:
45 subproject.verify()
46 subproject.flush()
47 subprojects.append(subproject.link_file_name())
48
49content = { 'subprojects' : '[\''+'\',\''.join(subprojects)+'\']'}
50
51meson_in = open('meson.build.in')
52meson_temp = Template(meson_in.read())
53content = meson_temp.substitute(content)
54
55if os.path.isfile('meson.build'):
56 os.unlink('meson.build')
57
58meson_out = open('meson.build', 'a')
59meson_out.write(content)