parent
7bb28ef3c8
commit
a9ec9ba104
10 changed files with 76 additions and 5 deletions
@ -0,0 +1,4 @@ |
|||||||
|
project('access private', 'c') |
||||||
|
|
||||||
|
subdir('stlib') |
||||||
|
subdir('user') |
@ -0,0 +1,30 @@ |
|||||||
|
#!/usr/bin/env python3 |
||||||
|
|
||||||
|
import sys, os |
||||||
|
|
||||||
|
assert(len(sys.argv) == 3) |
||||||
|
|
||||||
|
h_templ = '''#pragma once |
||||||
|
unsigned int %s(); |
||||||
|
''' |
||||||
|
|
||||||
|
c_templ = '''#include"%s.h" |
||||||
|
|
||||||
|
unsigned int %s() { |
||||||
|
return 0; |
||||||
|
} |
||||||
|
''' |
||||||
|
|
||||||
|
ifile = sys.argv[1] |
||||||
|
outdir = sys.argv[2] |
||||||
|
|
||||||
|
base = os.path.splitext(os.path.split(ifile)[-1])[0] |
||||||
|
|
||||||
|
cfile = os.path.join(outdir, base + '.c') |
||||||
|
hfile = os.path.join(outdir, base + '.h') |
||||||
|
|
||||||
|
c_code = c_templ % (base, base) |
||||||
|
h_code = h_templ % base |
||||||
|
|
||||||
|
open(cfile, 'w').write(c_code) |
||||||
|
open(hfile, 'w').write(h_code) |
@ -0,0 +1,12 @@ |
|||||||
|
genbin = find_program('compiler.py') |
||||||
|
|
||||||
|
gen = generator(genbin, |
||||||
|
output : ['@BASENAME@.h', '@BASENAME@.c'], |
||||||
|
arguments : ['@INPUT@', '@BUILD_DIR@'] |
||||||
|
) |
||||||
|
|
||||||
|
defs = ['foo1.def', 'foo2.def'] |
||||||
|
generated = gen.process(defs) |
||||||
|
|
||||||
|
stlib = static_library('st', generated) |
||||||
|
st_priv_inc = stlib.private_dir_include() |
@ -0,0 +1,6 @@ |
|||||||
|
#include"foo1.h" |
||||||
|
#include"foo2.h" |
||||||
|
|
||||||
|
int main(int argc, char **argv) { |
||||||
|
return foo1() + foo2(); |
||||||
|
} |
@ -0,0 +1,5 @@ |
|||||||
|
exe = executable('libuser', 'libuser.c', |
||||||
|
link_with : stlib, |
||||||
|
include_directories : st_priv_inc) |
||||||
|
|
||||||
|
test('libuser', exe) |
Loading…
Reference in new issue