Build: Create version.h using an Sconscript file
This lets me pull code out of the generic Sconstruct, so it can't be bad! I also removed the test directory since I never made unit tests. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
3d722f364d
commit
5f5f23bf9e
28
Sconstruct
28
Sconstruct
|
@ -31,38 +31,16 @@ env.ParseConfig('pkg-config --cflags --libs gstreamer-0.10')
|
|||
env.ParseConfig('pkg-config --cflags --libs gstreamer-interfaces-0.10')
|
||||
env.ParseConfig('pkg-config --cflags --libs taglib')
|
||||
|
||||
def version_h(target, source, env):
|
||||
f = open("include/version.h", "w")
|
||||
for line in open("include/version.tmpl", "r"):
|
||||
line = line.replace("__MAJOR__", str(MAJOR))
|
||||
line = line.replace("__MINOR__", str(MINOR))
|
||||
line = line.replace("__BUG__", str(BUG))
|
||||
line = line.replace("__EXTRA__", str(EXTRA))
|
||||
f.write(line)
|
||||
f.close()
|
||||
Export("env", "MAJOR", "MINOR", "BUG", "EXTRA", "DEBUG")
|
||||
|
||||
def list_dirs(directory):
|
||||
import os
|
||||
dirs = [x[0] for x in os.walk(directory)]
|
||||
return [Glob(dir + "/*.cpp") for dir in dirs]
|
||||
|
||||
# Note: a version.h file is not created in this directory,
|
||||
# so the command will always run.
|
||||
version_h=env.Command("version.h", None, version_h)
|
||||
ocarina=env.Program('ocarina.bin', list_dirs('libsaria') + list_dirs('ocarina'))
|
||||
Default([version_h, ocarina])
|
||||
|
||||
tests=os.listdir("tests/")
|
||||
test_list = []
|
||||
for test in tests:
|
||||
if test[0] == ".":
|
||||
continue;
|
||||
split = test.rsplit(".", 1);
|
||||
src = "tests/" + test
|
||||
dst = "test_" + split[0]
|
||||
test_list.append(env.Program(dst, list_dirs('libsaria') + [src]))
|
||||
|
||||
env.Alias("tests", [version_h] + [test_list]);
|
||||
SConscript(['include/Sconscript'])
|
||||
Default([ocarina])
|
||||
|
||||
# Install Ocarina
|
||||
scripts = os.listdir("scripts/")
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
Import("MAJOR", "MINOR", "BUG", "EXTRA")
|
||||
|
||||
f = open("version.h", "w")
|
||||
for line in open("version.tmpl", "r"):
|
||||
line = line.replace("__MAJOR__", str(MAJOR))
|
||||
line = line.replace("__MINOR__", str(MINOR))
|
||||
line = line.replace("__BUG__", str(BUG))
|
||||
line = line.replace("__EXTRA__", str(EXTRA))
|
||||
f.write(line)
|
||||
f.close()
|
|
@ -1,9 +0,0 @@
|
|||
#include <libsaria/libsaria.h>
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
libsaria::init(argc, argv);
|
||||
while (libsaria::idle::run_task() != 0);
|
||||
libsaria::quit();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue