From af1a266670d040d2f4083ff309d732d648afba2a Mon Sep 17 00:00:00 2001 From: Angelos Mouzakitis Date: Tue, 10 Oct 2023 14:33:42 +0000 Subject: Add submodule dependency files Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec --- meson/test cases/common/20 global arg/meson.build | 16 +++++++++ meson/test cases/common/20 global arg/prog.c | 43 +++++++++++++++++++++++ meson/test cases/common/20 global arg/prog.cc | 15 ++++++++ 3 files changed, 74 insertions(+) create mode 100644 meson/test cases/common/20 global arg/meson.build create mode 100644 meson/test cases/common/20 global arg/prog.c create mode 100644 meson/test cases/common/20 global arg/prog.cc (limited to 'meson/test cases/common/20 global arg') diff --git a/meson/test cases/common/20 global arg/meson.build b/meson/test cases/common/20 global arg/meson.build new file mode 100644 index 000000000..2a1c73669 --- /dev/null +++ b/meson/test cases/common/20 global arg/meson.build @@ -0,0 +1,16 @@ +project('global arg test', 'cpp', 'c') + +add_global_arguments('-DMYTHING', language : 'c') +add_global_arguments('-DMYCPPTHING', language : 'cpp') +add_global_arguments('-DGLOBAL_HOST', language : 'c') + +build_c_args = ['-DARG_BUILD'] +c_args = ['-DARG_HOST'] + +add_global_arguments('-DMYCANDCPPTHING', language: ['c', 'cpp']) + +exe2 = executable('prog2', 'prog.c', c_args : c_args) +exe3 = executable('prog3', 'prog.cc') + +test('prog2', exe2) +test('prog3', exe3) diff --git a/meson/test cases/common/20 global arg/prog.c b/meson/test cases/common/20 global arg/prog.c new file mode 100644 index 000000000..2a71236b6 --- /dev/null +++ b/meson/test cases/common/20 global arg/prog.c @@ -0,0 +1,43 @@ +#ifndef MYTHING + #error "Global argument not set" +#endif + +#ifdef MYCPPTHING + #error "Wrong global argument set" +#endif + +#ifndef MYCANDCPPTHING + #error "Global argument not set" +#endif + +#if !defined(GLOBAL_HOST) && !defined(GLOBAL_BUILD) + #error "Neither global_host nor glogal_build is set." +#endif + +#if defined(GLOBAL_HOST) && defined(GLOBAL_BUILD) + #error "Both global build and global host set." +#endif + +#ifdef GLOBAL_BUILD + #ifndef ARG_BUILD + #error "Global is build but arg_build is not set." + #endif + + #ifdef ARG_HOST + #error "Global is build but arg host is set." + #endif +#endif + +#ifdef GLOBAL_HOST + #ifndef ARG_HOST + #error "Global is host but arg_host is not set." + #endif + + #ifdef ARG_BUILD + #error "Global is host but arg_build is set." + #endif +#endif + +int main(void) { + return 0; +} diff --git a/meson/test cases/common/20 global arg/prog.cc b/meson/test cases/common/20 global arg/prog.cc new file mode 100644 index 000000000..5c3220992 --- /dev/null +++ b/meson/test cases/common/20 global arg/prog.cc @@ -0,0 +1,15 @@ +#ifdef MYTHING +#error "Wrong global argument set" +#endif + +#ifndef MYCPPTHING +#error "Global argument not set" +#endif + +#ifndef MYCANDCPPTHING +#error "Global argument not set" +#endif + +int main(void) { + return 0; +} -- cgit 1.2.3-korg