diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/tools/build/example/generate | |
parent | Initial commit. (diff) | |
download | ceph-upstream.tar.xz ceph-upstream.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/tools/build/example/generate')
-rw-r--r-- | src/boost/tools/build/example/generate/README.txt | 11 | ||||
-rw-r--r-- | src/boost/tools/build/example/generate/a.cpp | 10 | ||||
-rw-r--r-- | src/boost/tools/build/example/generate/gen.jam | 26 | ||||
-rw-r--r-- | src/boost/tools/build/example/generate/gen.py | 16 | ||||
-rw-r--r-- | src/boost/tools/build/example/generate/jamroot.jam | 9 |
5 files changed, 72 insertions, 0 deletions
diff --git a/src/boost/tools/build/example/generate/README.txt b/src/boost/tools/build/example/generate/README.txt new file mode 100644 index 00000000..fc2b2077 --- /dev/null +++ b/src/boost/tools/build/example/generate/README.txt @@ -0,0 +1,11 @@ +# Copyright 2007 Vladimir Prus +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + +This example shows the 'generate' rule, that allows you to construct target +using any arbitrary set of transformation and commands. + +The rule is similar to 'make' and 'notfile', but unlike those, you can operate +in terms of Boost.Build 'virtual targets', which is more flexible. + +Please consult the docs for more explanations. diff --git a/src/boost/tools/build/example/generate/a.cpp b/src/boost/tools/build/example/generate/a.cpp new file mode 100644 index 00000000..36497567 --- /dev/null +++ b/src/boost/tools/build/example/generate/a.cpp @@ -0,0 +1,10 @@ + +int main() +{ +} + +/* +Copyright 2007 Vladimir Prus +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + */ diff --git a/src/boost/tools/build/example/generate/gen.jam b/src/boost/tools/build/example/generate/gen.jam new file mode 100644 index 00000000..73232aab --- /dev/null +++ b/src/boost/tools/build/example/generate/gen.jam @@ -0,0 +1,26 @@ + +import "class" : new ; +import common ; + +rule generate-example ( project name : property-set : sources * ) +{ + local result ; + for local s in $(sources) + { + #local source-name = [ $(s).name ] ; + #local source-action = [ $(s).action ] ; + #local source-properties = [ $(source-action).properties ] ; + + # Create a new action, that takes the source target and runs the + # 'common.copy' command on it. + local a = [ new non-scanning-action $(s) : common.copy : $(property-set) + ] ; + + # Create a target to represent the action result. Uses the target name + # passed here via the 'name' parameter and the same type and project as + # the source. + result += [ new file-target $(name) : [ $(s).type ] : $(project) : $(a) + ] ; + } + return $(result) ; +}
\ No newline at end of file diff --git a/src/boost/tools/build/example/generate/gen.py b/src/boost/tools/build/example/generate/gen.py new file mode 100644 index 00000000..09ee15b4 --- /dev/null +++ b/src/boost/tools/build/example/generate/gen.py @@ -0,0 +1,16 @@ + +from b2.build.virtual_target import NonScanningAction, FileTarget + +def generate_example(project, name, ps, sources): + + result = [] + for s in sources: + + a = NonScanningAction([s], "common.copy", ps) + + # Create a target to represent the action result. Uses the target name + # passed here via the 'name' parameter and the same type and project as + # the source. + result.append(FileTarget(name, s.type(), project, a)) + + return result diff --git a/src/boost/tools/build/example/generate/jamroot.jam b/src/boost/tools/build/example/generate/jamroot.jam new file mode 100644 index 00000000..c48f2207 --- /dev/null +++ b/src/boost/tools/build/example/generate/jamroot.jam @@ -0,0 +1,9 @@ +# Copyright 2007 Vladimir Prus +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + +import generate ; + +import gen ; + +generate a2 : a.cpp : <generating-rule>@gen.generate-example ; |