summaryrefslogtreecommitdiffstats
path: root/src/boost/tools/build/example/variant
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/boost/tools/build/example/variant
parentInitial commit. (diff)
downloadceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz
ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/tools/build/example/variant')
-rw-r--r--src/boost/tools/build/example/variant/a.cpp7
-rw-r--r--src/boost/tools/build/example/variant/jamfile.jam11
-rw-r--r--src/boost/tools/build/example/variant/jamroot.jam12
-rw-r--r--src/boost/tools/build/example/variant/libs/jamfile.jam8
-rw-r--r--src/boost/tools/build/example/variant/libs/l.cpp9
-rw-r--r--src/boost/tools/build/example/variant/readme.qbk94
6 files changed, 141 insertions, 0 deletions
diff --git a/src/boost/tools/build/example/variant/a.cpp b/src/boost/tools/build/example/variant/a.cpp
new file mode 100644
index 000000000..e6abcf9c0
--- /dev/null
+++ b/src/boost/tools/build/example/variant/a.cpp
@@ -0,0 +1,7 @@
+// Copyright Vladimir Prus 2004.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt
+// or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+void l();
+int main() { l(); return 0; }
diff --git a/src/boost/tools/build/example/variant/jamfile.jam b/src/boost/tools/build/example/variant/jamfile.jam
new file mode 100644
index 000000000..6fd72adbd
--- /dev/null
+++ b/src/boost/tools/build/example/variant/jamfile.jam
@@ -0,0 +1,11 @@
+# Copyright 2004 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#[jamfile
+#<< By default, build the project with the two variants we have defined in jamroot.jam.
+project : default-build crazy super_release ;
+
+#<< We build an `a` exe target that links a built library. The library builds with the propagated properties of the exe.
+exe a : a.cpp libs//l ;
+#] \ No newline at end of file
diff --git a/src/boost/tools/build/example/variant/jamroot.jam b/src/boost/tools/build/example/variant/jamroot.jam
new file mode 100644
index 000000000..d20669789
--- /dev/null
+++ b/src/boost/tools/build/example/variant/jamroot.jam
@@ -0,0 +1,12 @@
+# Copyright 2004 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#[jamroot
+#<< Define a build variant which is just combination of four properties.
+variant crazy : <optimization>speed <inlining>off
+ <debug-symbols>on <profiling>on ;
+
+#<< Define a built variant inherited from 'release'. It defines one new property and gets all properties from the parent `release` variant.
+variant super_release : release : <define>USE_ASM ;
+#]
diff --git a/src/boost/tools/build/example/variant/libs/jamfile.jam b/src/boost/tools/build/example/variant/libs/jamfile.jam
new file mode 100644
index 000000000..5d6d42dbd
--- /dev/null
+++ b/src/boost/tools/build/example/variant/libs/jamfile.jam
@@ -0,0 +1,8 @@
+# Copyright 2004 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#[libs_jamfile
+#<< The library `l` just needs the sources. By default it will be a shared library.
+lib l : l.cpp ;
+#] \ No newline at end of file
diff --git a/src/boost/tools/build/example/variant/libs/l.cpp b/src/boost/tools/build/example/variant/libs/l.cpp
new file mode 100644
index 000000000..be3254ca8
--- /dev/null
+++ b/src/boost/tools/build/example/variant/libs/l.cpp
@@ -0,0 +1,9 @@
+// Copyright Vladimir Prus 2002-2004.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt
+// or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+void l() {}
diff --git a/src/boost/tools/build/example/variant/readme.qbk b/src/boost/tools/build/example/variant/readme.qbk
new file mode 100644
index 000000000..663219e34
--- /dev/null
+++ b/src/boost/tools/build/example/variant/readme.qbk
@@ -0,0 +1,94 @@
+[/
+Copyright 2004 Vladimir Prus
+Copyright 2017 Rene Rivera
+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)
+/]
+
+[section Build Variants]
+
+This example shows how user can create his own build variants. Two variants are
+defined: "crazy", which is just a random combination of properties, and
+"super-release", which is inherited from "release", and differs by a single
+define.
+
+Files:
+
+* [@../../example/variant/a.cpp a.cpp]
+* [@../../example/variant/jamroot.jam jamroot.jam]
+* [@../../example/variant/jamfile.jam jamfile.jam]
+* [@../../example/variant/libs/jamfile.jam libs/jamfile.jam]
+* [@../../example/variant/libs/l.cpp libs/l.cpp]
+
+[import jamroot.jam]
+[import jamfile.jam]
+[import libs/jamfile.jam]
+
+In this project the `jamroot.jam` specifies the custom build variants and the
+targets are specified in the two `jamfile.jam` files.
+
+[jamroot]
+
+The top-level `jamfile.jam`:
+
+[jamfile]
+
+And the library `jamfile.jam` that the top-level `jamfile.jam` refers to:
+
+[libs_jamfile]
+
+Building the example yields:
+
+[teletype]
+```
+> cd /example/variant
+> b2
+...found 20 targets...
+...updating 16 targets...
+common.mkdir bin
+common.mkdir bin/clang-darwin-4.2.1
+common.mkdir bin/clang-darwin-4.2.1/crazy
+clang-darwin.compile.c++ bin/clang-darwin-4.2.1/crazy/a.o
+common.mkdir libs/bin
+common.mkdir libs/bin/clang-darwin-4.2.1
+common.mkdir libs/bin/clang-darwin-4.2.1/crazy
+clang-darwin.compile.c++ libs/bin/clang-darwin-4.2.1/crazy/l.o
+clang-darwin.link.dll libs/bin/clang-darwin-4.2.1/crazy/libl.dylib
+clang-darwin.link bin/clang-darwin-4.2.1/crazy/a
+common.mkdir bin/clang-darwin-4.2.1/super_release
+clang-darwin.compile.c++ bin/clang-darwin-4.2.1/super_release/a.o
+common.mkdir libs/bin/clang-darwin-4.2.1/super_release
+clang-darwin.compile.c++ libs/bin/clang-darwin-4.2.1/super_release/l.o
+clang-darwin.link.dll libs/bin/clang-darwin-4.2.1/super_release/libl.dylib
+clang-darwin.link bin/clang-darwin-4.2.1/super_release/a
+...updated 16 targets...
+```
+
+As specified in the top-level `jamfile.jam` both custom variants where built
+by default. Once can override that by specifying the variant one wants to
+build directly on the command line with a `variant=super_release`. Or just
+with a `super_release` as variants can be referred to by their name only.
+For example using that argument yields:
+
+```
+> cd /example/variant
+> b2 super_release
+...found 14 targets...
+...updating 10 targets...
+common.mkdir bin
+common.mkdir bin/clang-darwin-4.2.1
+common.mkdir bin/clang-darwin-4.2.1/super_release
+clang-darwin.compile.c++ bin/clang-darwin-4.2.1/super_release/a.o
+common.mkdir libs/bin
+common.mkdir libs/bin/clang-darwin-4.2.1
+common.mkdir libs/bin/clang-darwin-4.2.1/super_release
+clang-darwin.compile.c++ libs/bin/clang-darwin-4.2.1/super_release/l.o
+clang-darwin.link.dll libs/bin/clang-darwin-4.2.1/super_release/libl.dylib
+clang-darwin.link bin/clang-darwin-4.2.1/super_release/a
+...updated 10 targets...
+```
+
+[note The actual paths in the `bin` sub-directory will depend on your
+toolset.]
+
+[endsect]