From a98f85795f5ce6ff392ec32b843cdfaa8d4d9119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Carretero?= Date: Sun, 15 Sep 2013 16:09:32 -0400 Subject: [PATCH] playground: add c-objects-stlib-shlib --- playground/c-objects-stlib-shlib/main.c | 8 +++ playground/c-objects-stlib-shlib/test_shlib.c | 5 ++ playground/c-objects-stlib-shlib/wscript | 57 +++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 playground/c-objects-stlib-shlib/main.c create mode 100644 playground/c-objects-stlib-shlib/test_shlib.c create mode 100644 playground/c-objects-stlib-shlib/wscript diff --git a/playground/c-objects-stlib-shlib/main.c b/playground/c-objects-stlib-shlib/main.c new file mode 100644 index 00000000..4f56fe06 --- /dev/null +++ b/playground/c-objects-stlib-shlib/main.c @@ -0,0 +1,8 @@ + +extern void foo(); + +int main() +{ + foo(); + return 0; +} diff --git a/playground/c-objects-stlib-shlib/test_shlib.c b/playground/c-objects-stlib-shlib/test_shlib.c new file mode 100644 index 00000000..809257dc --- /dev/null +++ b/playground/c-objects-stlib-shlib/test_shlib.c @@ -0,0 +1,5 @@ + +static const int truc=5; + +void foo() { } +void _internal() {} /* this one is not gonna be exported by *.def */ diff --git a/playground/c-objects-stlib-shlib/wscript b/playground/c-objects-stlib-shlib/wscript new file mode 100644 index 00000000..2e662cac --- /dev/null +++ b/playground/c-objects-stlib-shlib/wscript @@ -0,0 +1,57 @@ +#! /usr/bin/env python +# encoding: utf-8 +# Jérôme Carretero, 2013 (zougloub) + +""" +Demonstration for building of static+shared libraries. +""" + + +def options(opt): + opt.load('compiler_c gnu_dirs') + +def configure(conf): + conf.load('compiler_c gnu_dirs') + +def build(bld): + + bld( + features='c', + source='test_shlib.c', + use='cshlib', + target='objects-for-shlib', + ) + + bld( + features='c', + source='test_shlib.c', + target='objects-for-stlib', + ) + + bld( + features='c cshlib', + target='something-shared', + vnum='1.2.3', + use='objects-for-shlib', + ) + + bld( + features='c cstlib', + target = 'something-static', + use='objects-for-stlib', + ) + + bld( + features='c cprogram', + target='exe-shared', + source='main.c', + use='something-shared', + ) + + bld( + features='c cprogram', + target='exe-static', + source='main.c', + use='something-static', + ) +