summaryrefslogtreecommitdiffstats
path: root/src/boost/tools/build/example/pkg-config
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/tools/build/example/pkg-config
parentInitial commit. (diff)
downloadceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz
ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/tools/build/example/pkg-config')
-rw-r--r--src/boost/tools/build/example/pkg-config/debug-packages/debugged.pc4
-rw-r--r--src/boost/tools/build/example/pkg-config/jamroot.jam104
-rw-r--r--src/boost/tools/build/example/pkg-config/packages/debugged.pc4
-rw-r--r--src/boost/tools/build/example/pkg-config/packages/foobar.pc4
-rw-r--r--src/boost/tools/build/example/pkg-config/packages/mangled-mt.pc4
-rw-r--r--src/boost/tools/build/example/pkg-config/packages/mangled.pc4
-rw-r--r--src/boost/tools/build/example/pkg-config/packages/versioned.pc3
-rw-r--r--src/boost/tools/build/example/pkg-config/packages/with-var.pc4
-rw-r--r--src/boost/tools/build/example/pkg-config/test1.cpp11
-rw-r--r--src/boost/tools/build/example/pkg-config/test2.cpp12
-rw-r--r--src/boost/tools/build/example/pkg-config/test3.cpp12
-rw-r--r--src/boost/tools/build/example/pkg-config/test4.cpp11
-rw-r--r--src/boost/tools/build/example/pkg-config/test5.cpp12
13 files changed, 189 insertions, 0 deletions
diff --git a/src/boost/tools/build/example/pkg-config/debug-packages/debugged.pc b/src/boost/tools/build/example/pkg-config/debug-packages/debugged.pc
new file mode 100644
index 000000000..8b2d744ef
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/debug-packages/debugged.pc
@@ -0,0 +1,4 @@
+Name: debugged
+Version: 0.1
+Description: A package with separate debug version (debug version)
+Cflags: -DVARIANT=\"DEBUG\"
diff --git a/src/boost/tools/build/example/pkg-config/jamroot.jam b/src/boost/tools/build/example/pkg-config/jamroot.jam
new file mode 100644
index 000000000..190948174
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/jamroot.jam
@@ -0,0 +1,104 @@
+#|
+Copyright 2019 Dmitry Arkhipov
+Distributed under the Boost Software License, Version 1.0. (See
+accompanying file LICENSE_1_0.txt or copy at
+http://www.boost.org/LICENSE_1_0.txt)
+|#
+
+
+using pkg-config : : : <libdir>packages ;
+using pkg-config : debug : : <libdir>packages <path>debug-packages ;
+
+import common ;
+import pkg-config ;
+import property-set ;
+import testing ;
+import version ;
+
+
+project : requirements <variant>debug:<pkg-config>debug ;
+
+
+pkg-config.import debugged ;
+pkg-config.import foobar : requirements <version>>=0.3 ;
+pkg-config.import mangled : requirements <conditional>@mangle-name ;
+
+versioned =
+ [ pkg-config.import versioned
+ : usage-requirements <conditional>@versioned-api
+ ] ;
+
+with-var =
+ [ pkg-config.import with-var
+ : usage-requirements <conditional>@var-to-define
+ ] ;
+
+
+# test if a package is found at all
+run test1.cpp foobar ;
+
+# test if conditional requirement is applied
+run test2.cpp mangled
+ : target-name test2-1
+ : requirements <threading>single
+ : args SINGLE
+ ;
+
+run test2.cpp mangled
+ : target-name test2-2
+ : requirements <threading>multi
+ : args MULTI
+ ;
+
+# test if pkg-config configuration is properly inferred from property set
+run test3.cpp debugged
+ : target-name test3-1
+ : requirements <variant>release
+ : args RELEASE
+ ;
+
+run test3.cpp debugged
+ : target-name test3-2
+ : requirements <variant>debug
+ : args DEBUG
+ ;
+
+# test use of version method of pkg-config targets
+run test4.cpp versioned ;
+
+# test use of variable method of pkg-config targets
+run test5.cpp with-var ;
+
+
+rule mangle-name ( props * ) {
+ import feature ;
+ local name =
+ [ common.format-name
+ <base> <threading>
+ : mangled
+ : ""
+ : [ property-set.create $(props) ]
+ ] ;
+ return <name>$(name) ;
+}
+
+
+rule versioned-api ( props * ) {
+ local ps = [ property-set.create $(props) ] ;
+ local version = [ $(versioned).version $(ps) ] ;
+ if [ version.version-less $(version) : 2 ]
+ {
+ return <define>VERSIONED_API=1 ;
+ }
+ else
+ {
+ return <define>VERSIONED_API=2 ;
+ }
+}
+
+
+rule var-to-define ( props * ) {
+ local ps = [ property-set.create $(props) ] ;
+ local qwerty = [ $(with-var).variable qwerty : $(ps) ] ;
+ return <define>QWERTY=\\\"$(qwerty)\\\" ;
+}
diff --git a/src/boost/tools/build/example/pkg-config/packages/debugged.pc b/src/boost/tools/build/example/pkg-config/packages/debugged.pc
new file mode 100644
index 000000000..b22e10d8b
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/packages/debugged.pc
@@ -0,0 +1,4 @@
+Name: debugged
+Version: 0.1
+Description: A package with separate debug version (release version)
+Cflags: -DVARIANT=\"RELEASE\"
diff --git a/src/boost/tools/build/example/pkg-config/packages/foobar.pc b/src/boost/tools/build/example/pkg-config/packages/foobar.pc
new file mode 100644
index 000000000..f62cfc820
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/packages/foobar.pc
@@ -0,0 +1,4 @@
+Name: foobar
+Version: 0.3
+Description: The bar for your foo
+Cflags: -DQWERTY=\"uiop\"
diff --git a/src/boost/tools/build/example/pkg-config/packages/mangled-mt.pc b/src/boost/tools/build/example/pkg-config/packages/mangled-mt.pc
new file mode 100644
index 000000000..107b4d3d3
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/packages/mangled-mt.pc
@@ -0,0 +1,4 @@
+Name: mangled
+Version: 0.1
+Description: A package with mangled name (multi-threaded version)
+Cflags: -DTHREADING=\"MULTI\"
diff --git a/src/boost/tools/build/example/pkg-config/packages/mangled.pc b/src/boost/tools/build/example/pkg-config/packages/mangled.pc
new file mode 100644
index 000000000..76976ecc1
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/packages/mangled.pc
@@ -0,0 +1,4 @@
+Name: mangled
+Version: 0.1
+Description: A package with mangled name (single-threaded version)
+Cflags: -DTHREADING=\"SINGLE\"
diff --git a/src/boost/tools/build/example/pkg-config/packages/versioned.pc b/src/boost/tools/build/example/pkg-config/packages/versioned.pc
new file mode 100644
index 000000000..701f35146
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/packages/versioned.pc
@@ -0,0 +1,3 @@
+Name: versioned
+Version: 4.2
+Description: A package with versioned API
diff --git a/src/boost/tools/build/example/pkg-config/packages/with-var.pc b/src/boost/tools/build/example/pkg-config/packages/with-var.pc
new file mode 100644
index 000000000..4b3e2e558
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/packages/with-var.pc
@@ -0,0 +1,4 @@
+qwerty=UIOP
+Name: with-var
+Version: 0.1
+Description: A package that defines a custom variable
diff --git a/src/boost/tools/build/example/pkg-config/test1.cpp b/src/boost/tools/build/example/pkg-config/test1.cpp
new file mode 100644
index 000000000..36f37bfb3
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/test1.cpp
@@ -0,0 +1,11 @@
+// Copyright 2019 Dmitry Arkhipov
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <string>
+
+int main() {
+ return QWERTY == std::string("uiop") ? EXIT_SUCCESS : EXIT_FAILURE ;
+}
diff --git a/src/boost/tools/build/example/pkg-config/test2.cpp b/src/boost/tools/build/example/pkg-config/test2.cpp
new file mode 100644
index 000000000..f911d4577
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/test2.cpp
@@ -0,0 +1,12 @@
+// Copyright 2019 Dmitry Arkhipov
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <string>
+#include <iostream>
+
+int main(int, char const** argv) {
+ return THREADING == std::string(argv[1]) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/src/boost/tools/build/example/pkg-config/test3.cpp b/src/boost/tools/build/example/pkg-config/test3.cpp
new file mode 100644
index 000000000..5df7ff0ef
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/test3.cpp
@@ -0,0 +1,12 @@
+// Copyright 2019 Dmitry Arkhipov
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <string>
+#include <iostream>
+
+int main(int, char const** argv) {
+ return VARIANT == std::string(argv[1]) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/src/boost/tools/build/example/pkg-config/test4.cpp b/src/boost/tools/build/example/pkg-config/test4.cpp
new file mode 100644
index 000000000..ca9bcc738
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/test4.cpp
@@ -0,0 +1,11 @@
+// Copyright 2019 Dmitry Arkhipov
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#if VERSIONED_API < 2
+# error "API is too old"
+#endif
+
+int main() {}
diff --git a/src/boost/tools/build/example/pkg-config/test5.cpp b/src/boost/tools/build/example/pkg-config/test5.cpp
new file mode 100644
index 000000000..8d843637b
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/test5.cpp
@@ -0,0 +1,12 @@
+// Copyright 2019 Dmitry Arkhipov
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <string>
+#include <iostream>
+
+int main(int, char const** argv) {
+ return QWERTY == std::string("UIOP") ? EXIT_SUCCESS : EXIT_FAILURE;
+}