summaryrefslogtreecommitdiff
path: root/test cases/common
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-01-06 15:33:07 -0800
committerJussi Pakkanen <jpakkane@gmail.com>2018-04-17 23:33:31 +0300
commit92487ea33db9d882929d755308853d2ed82abd0d (patch)
tree0272fa81d53e2f08b72e70e906bdc4d0df65f23e /test cases/common
parent1952ef5ae13376084dc277de38ff3a6dafb8e595 (diff)
downloadmeson-92487ea33db9d882929d755308853d2ed82abd0d.tar.gz
Add partial_dependency method to dependencies
This adds a new method, partial_dependency to all dependencies. These sub dependencies are copies of the original dependency, but with one or more of the attributes replaced with an empty list. This allows creating a sub dependency that has only cflags or drops link_arguments, for example.
Diffstat (limited to 'test cases/common')
-rw-r--r--test cases/common/191 partial dependency/declare_dependency/headers/foo.c16
-rw-r--r--test cases/common/191 partial dependency/declare_dependency/headers/foo.h16
-rw-r--r--test cases/common/191 partial dependency/declare_dependency/main.c25
-rw-r--r--test cases/common/191 partial dependency/declare_dependency/meson.build28
-rw-r--r--test cases/common/191 partial dependency/declare_dependency/other.c20
-rw-r--r--test cases/common/191 partial dependency/meson.build17
6 files changed, 122 insertions, 0 deletions
diff --git a/test cases/common/191 partial dependency/declare_dependency/headers/foo.c b/test cases/common/191 partial dependency/declare_dependency/headers/foo.c
new file mode 100644
index 000000000..215112ca5
--- /dev/null
+++ b/test cases/common/191 partial dependency/declare_dependency/headers/foo.c
@@ -0,0 +1,16 @@
+/* Copyright © 2018 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#error "Included C sources that shouldn't be."
diff --git a/test cases/common/191 partial dependency/declare_dependency/headers/foo.h b/test cases/common/191 partial dependency/declare_dependency/headers/foo.h
new file mode 100644
index 000000000..28c81c9d3
--- /dev/null
+++ b/test cases/common/191 partial dependency/declare_dependency/headers/foo.h
@@ -0,0 +1,16 @@
+/* Copyright © 2018 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+int foo(void);
diff --git a/test cases/common/191 partial dependency/declare_dependency/main.c b/test cases/common/191 partial dependency/declare_dependency/main.c
new file mode 100644
index 000000000..e9ed0329a
--- /dev/null
+++ b/test cases/common/191 partial dependency/declare_dependency/main.c
@@ -0,0 +1,25 @@
+/* Copyright © 2018 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "foo.h"
+
+int main() {
+ int a = foo();
+ if (a == 1) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
diff --git a/test cases/common/191 partial dependency/declare_dependency/meson.build b/test cases/common/191 partial dependency/declare_dependency/meson.build
new file mode 100644
index 000000000..86e26089d
--- /dev/null
+++ b/test cases/common/191 partial dependency/declare_dependency/meson.build
@@ -0,0 +1,28 @@
+# Copyright © 2018 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+dec_dep = declare_dependency(
+ sources : files('headers/foo.c'),
+ include_directories : include_directories('headers'),
+)
+
+sub_dep = dec_dep.partial_dependency(includes : true)
+
+dec_exe = executable(
+ 'declare_dep',
+ files('main.c', 'other.c'),
+ dependencies : sub_dep,
+)
+
+test('Declare Dependency', dec_exe)
diff --git a/test cases/common/191 partial dependency/declare_dependency/other.c b/test cases/common/191 partial dependency/declare_dependency/other.c
new file mode 100644
index 000000000..b1e199e44
--- /dev/null
+++ b/test cases/common/191 partial dependency/declare_dependency/other.c
@@ -0,0 +1,20 @@
+/* Copyright © 2018 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "foo.h"
+
+int foo(void) {
+ return 1;
+}
diff --git a/test cases/common/191 partial dependency/meson.build b/test cases/common/191 partial dependency/meson.build
new file mode 100644
index 000000000..e908487f1
--- /dev/null
+++ b/test cases/common/191 partial dependency/meson.build
@@ -0,0 +1,17 @@
+# Copyright © 2018 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+project('partial dependency', ['c', 'cpp'])
+
+subdir('declare_dependency')