From 7b6e527f440cd7e6f8be2b07cee320ee6ca18786 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 29 Apr 2024 06:41:38 +0200 Subject: Adding upstream version 1.0.1. Signed-off-by: Daniel Baumann --- test cases/unit/17 prebuilt shared/alexandria.c | 6 ++++ test cases/unit/17 prebuilt shared/alexandria.h | 20 ++++++++++++ .../unit/17 prebuilt shared/another_visitor.c | 10 ++++++ test cases/unit/17 prebuilt shared/meson.build | 38 ++++++++++++++++++++++ .../unit/17 prebuilt shared/meson_options.txt | 1 + test cases/unit/17 prebuilt shared/patron.c | 9 +++++ test cases/unit/17 prebuilt shared/rejected.c | 8 +++++ test cases/unit/17 prebuilt shared/rejected.h | 6 ++++ test cases/unit/17 prebuilt shared/rejected_main.c | 6 ++++ 9 files changed, 104 insertions(+) create mode 100644 test cases/unit/17 prebuilt shared/alexandria.c create mode 100644 test cases/unit/17 prebuilt shared/alexandria.h create mode 100644 test cases/unit/17 prebuilt shared/another_visitor.c create mode 100644 test cases/unit/17 prebuilt shared/meson.build create mode 100644 test cases/unit/17 prebuilt shared/meson_options.txt create mode 100644 test cases/unit/17 prebuilt shared/patron.c create mode 100644 test cases/unit/17 prebuilt shared/rejected.c create mode 100644 test cases/unit/17 prebuilt shared/rejected.h create mode 100644 test cases/unit/17 prebuilt shared/rejected_main.c (limited to 'test cases/unit/17 prebuilt shared') diff --git a/test cases/unit/17 prebuilt shared/alexandria.c b/test cases/unit/17 prebuilt shared/alexandria.c new file mode 100644 index 0000000..2d6b848 --- /dev/null +++ b/test cases/unit/17 prebuilt shared/alexandria.c @@ -0,0 +1,6 @@ +#include"alexandria.h" +#include + +void alexandria_visit() { + printf("You are surrounded by wisdom and knowledge. You feel enlightened.\n"); +} diff --git a/test cases/unit/17 prebuilt shared/alexandria.h b/test cases/unit/17 prebuilt shared/alexandria.h new file mode 100644 index 0000000..6e507c5 --- /dev/null +++ b/test cases/unit/17 prebuilt shared/alexandria.h @@ -0,0 +1,20 @@ +#pragma once + +/* Both funcs here for simplicity. */ + +#if defined _WIN32 || defined __CYGWIN__ +#if defined BUILDING_DLL + #define DLL_PUBLIC __declspec(dllexport) +#else + #define DLL_PUBLIC __declspec(dllimport) +#endif +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +void DLL_PUBLIC alexandria_visit(); diff --git a/test cases/unit/17 prebuilt shared/another_visitor.c b/test cases/unit/17 prebuilt shared/another_visitor.c new file mode 100644 index 0000000..18e5f15 --- /dev/null +++ b/test cases/unit/17 prebuilt shared/another_visitor.c @@ -0,0 +1,10 @@ +#include +#include + +int main(int argc, char **argv) { + printf("Ahh, another visitor. Stay a while.\n"); + printf("You enter the library.\n\n"); + alexandria_visit(); + printf("\nYou decided not to stay forever.\n"); + return 0; +} diff --git a/test cases/unit/17 prebuilt shared/meson.build b/test cases/unit/17 prebuilt shared/meson.build new file mode 100644 index 0000000..7badcb7 --- /dev/null +++ b/test cases/unit/17 prebuilt shared/meson.build @@ -0,0 +1,38 @@ +project('prebuilt shared library', 'c') + +search_dir = get_option('search_dir') +if search_dir == 'auto' + search_dir = meson.current_source_dir() +endif + +cc = meson.get_compiler('c') +shlib = cc.find_library('alexandria', dirs : search_dir) + +exe = executable('patron', 'patron.c', dependencies : shlib) +test('visitation', exe) + +d = declare_dependency(dependencies : shlib) + +exe2 = executable('another_visitor', 'another_visitor.c', + dependencies : d) +test('another', exe2) + +stlib = static_library( + 'rejected', + 'rejected.c', + dependencies : shlib, +) + +rejected = executable( + 'rejected', + 'rejected_main.c', + link_with : stlib, +) +test('rejected', rejected) + +rejected_whole = executable( + 'rejected_whole', + 'rejected_main.c', + link_whole : stlib, +) +test('rejected (whole archive)', rejected_whole) diff --git a/test cases/unit/17 prebuilt shared/meson_options.txt b/test cases/unit/17 prebuilt shared/meson_options.txt new file mode 100644 index 0000000..7876a6f --- /dev/null +++ b/test cases/unit/17 prebuilt shared/meson_options.txt @@ -0,0 +1 @@ +option('search_dir', type : 'string', value : 'auto') diff --git a/test cases/unit/17 prebuilt shared/patron.c b/test cases/unit/17 prebuilt shared/patron.c new file mode 100644 index 0000000..461d7b4 --- /dev/null +++ b/test cases/unit/17 prebuilt shared/patron.c @@ -0,0 +1,9 @@ +#include +#include + +int main(int argc, char **argv) { + printf("You are standing outside the Great Library of Alexandria.\n"); + printf("You decide to go inside.\n\n"); + alexandria_visit(); + return 0; +} diff --git a/test cases/unit/17 prebuilt shared/rejected.c b/test cases/unit/17 prebuilt shared/rejected.c new file mode 100644 index 0000000..9d7ac94 --- /dev/null +++ b/test cases/unit/17 prebuilt shared/rejected.c @@ -0,0 +1,8 @@ +#include "rejected.h" + +void say(void) { + printf("You are standing outside the Great Library of Alexandria.\n"); + printf("You decide to go inside.\n\n"); + alexandria_visit(); + printf("The librarian tells you it's time to leave\n"); +} diff --git a/test cases/unit/17 prebuilt shared/rejected.h b/test cases/unit/17 prebuilt shared/rejected.h new file mode 100644 index 0000000..b9ccf31 --- /dev/null +++ b/test cases/unit/17 prebuilt shared/rejected.h @@ -0,0 +1,6 @@ +#include +#include + +#pragma once + +void say(void); diff --git a/test cases/unit/17 prebuilt shared/rejected_main.c b/test cases/unit/17 prebuilt shared/rejected_main.c new file mode 100644 index 0000000..4d35061 --- /dev/null +++ b/test cases/unit/17 prebuilt shared/rejected_main.c @@ -0,0 +1,6 @@ +#include "rejected.h" + +int main(void) { + say(); + return 0; +} -- cgit v1.2.3