mirror of https://gitlab.com/ita1024/waf.git
Advanced example of library propagation in distnet
This commit is contained in:
parent
740763c236
commit
20a1ed6146
|
@ -1,4 +1,10 @@
|
|||
|
||||
int foo() {
|
||||
return 1095672;
|
||||
#ifdef _MSC_VER
|
||||
#define testEXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define testEXPORT
|
||||
#endif
|
||||
|
||||
testEXPORT int pouet() {
|
||||
return prepouet();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
#ifdef _MSC_VER
|
||||
#define testEXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define testEXPORT
|
||||
#endif
|
||||
|
||||
testEXPORT int prepouet() {
|
||||
return 0;
|
||||
}
|
|
@ -1,4 +1,8 @@
|
|||
# module exported and used for configuring the package pouet
|
||||
# Module exported and used for configuring the package pouet
|
||||
#
|
||||
# To try the changes, you may have to remove the cache and the existing package, for example:
|
||||
# $ rm -rf /home/user/waf/playground/distnet/packages/app/1.0.0 /tmp/distnetcache/app/1.0.0
|
||||
# $ waf configure_all build_all package publish
|
||||
|
||||
import os
|
||||
|
||||
|
@ -7,10 +11,28 @@ def options(opt):
|
|||
pass
|
||||
|
||||
def configure(conf):
|
||||
conf.env.append_value('DEFINES_pouet', 'pouet=1')
|
||||
conf.env.append_value('INCLUDES_pouet', os.path.dirname(os.path.abspath(__file__)))
|
||||
pass
|
||||
# one possibility is to specify the configuration variables explicitly:
|
||||
# conf.env.append_value('DEFINES_pouet', 'pouet=1')
|
||||
# conf.env.append_value('INCLUDES_pouet', os.path.dirname(os.path.abspath(__file__)))
|
||||
# conf.env.append_value('LIB_pouet', ['prepouet', 'pouet'])
|
||||
|
||||
if conf.variant == 'linux_64_release':
|
||||
# the other project will get -lm in the variant
|
||||
conf.env.LIB_m = ['m']
|
||||
conf.env.LIB_prepouet = 'prepouet'
|
||||
|
||||
def build(bld):
|
||||
# project-specific build targets go here
|
||||
pass
|
||||
# another possibility is to create a fake library
|
||||
noarch = os.path.dirname(os.path.abspath(__file__))
|
||||
base = os.path.dirname(noarch)
|
||||
p = os.path.join(base, bld.variant)
|
||||
tg = bld.read_shlib(name='pouet', paths=[p])
|
||||
tg.export_defines = 'pouet=1'
|
||||
tg.export_includes = noarch
|
||||
tg.use = 'prepouet m'.split()
|
||||
|
||||
# and again, you have the choice of making fake libraries, or to use variables
|
||||
#tg2 = bld.read_shlib(name='prepouet', paths=[p])
|
||||
#tg2.use = 'm'
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
#! /usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
"""
|
||||
waf configure_all build_all
|
||||
"""
|
||||
|
||||
VERSION='1.0.0'
|
||||
APPNAME='app'
|
||||
|
||||
|
@ -25,13 +29,17 @@ def configure(conf):
|
|||
conf.load('distnet')
|
||||
conf.load('compiler_c')
|
||||
|
||||
if conf.variant == 'linux_64_release':
|
||||
conf.env.LIB_m = ['m']
|
||||
|
||||
def build(bld):
|
||||
bld.shlib(source='main.c', target='pouet', includes='.')
|
||||
bld.shlib(source='prep.c', target='prepouet', includes='.', use='m')
|
||||
bld.shlib(source='main.c', target='pouet', includes='.', use='prepouet')
|
||||
|
||||
def package(ctx):
|
||||
for v in variants:
|
||||
tar = 'build/%s.tarfile' % v
|
||||
inputs = ['build/%s/libpouet.so' % v]
|
||||
inputs = ['build/%s/libpouet.so' % v, 'build/%s/libprepouet.so' % v]
|
||||
ctx.make_tarfile(tar, inputs)
|
||||
ctx.make_tarfile('build/noarch.tarfile', ['head.h', 'waf_pouet.py'])
|
||||
|
||||
|
|
|
@ -26,12 +26,13 @@ def configure(conf):
|
|||
conf.load('compiler_c')
|
||||
|
||||
def build(bld):
|
||||
bld.load('distnet')
|
||||
bld.program(source='main.c', target='app2', includes='.', use='pouet')
|
||||
|
||||
def package(ctx):
|
||||
for v in variants:
|
||||
tar = 'build/%s.tarfile' % v
|
||||
inputs = ['build/%s/libpouet.so' % v]
|
||||
inputs = ['build/%s/app2.so' % v]
|
||||
ctx.make_tarfile(tar, inputs)
|
||||
ctx.make_tarfile('build/noarch.tarfile', ['head.h'])
|
||||
|
||||
|
|
|
@ -394,6 +394,9 @@ class Node(object):
|
|||
if c1.parent:
|
||||
for i in range(up):
|
||||
lst.append('..')
|
||||
else:
|
||||
if os.sep == '/' and lst:
|
||||
lst.append('')
|
||||
lst.reverse()
|
||||
return os.sep.join(lst) or '.'
|
||||
|
||||
|
|
|
@ -427,3 +427,6 @@ def options(opt):
|
|||
def configure(conf):
|
||||
load_tools(conf, conf.variant)
|
||||
|
||||
def build(bld):
|
||||
load_tools(bld, bld.variant)
|
||||
|
||||
|
|
Loading…
Reference in New Issue