From: Paul Brossier Date: Thu, 29 Nov 2018 14:04:58 +0000 (+0100) Subject: [tests] [win] more windows workaround to pass strings via -D X-Git-Tag: 0.4.9~139^2~19 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=586383d59c850b76eda3bfcc73b0734126bc6f4d;p=aubio.git [tests] [win] more windows workaround to pass strings via -D --- diff --git a/tests/utils_tests.h b/tests/utils_tests.h index f59701a7..e272c2ad 100644 --- a/tests/utils_tests.h +++ b/tests/utils_tests.h @@ -20,6 +20,13 @@ #define PATH_MAX 1024 #endif +// This macro is used to pass a string to msvc compiler: since msvc's -D flag +// strips the quotes, we define the string without quotes and re-add them with +// this macro. + +#define REDEFINESTRING(x) #x +#define DEFINEDSTRING(x) REDEFINESTRING(x) + #ifndef AUBIO_TESTS_SOURCE #error "AUBIO_TESTS_SOURCE is not defined" #endif @@ -134,7 +141,7 @@ int run_on_default_source( int main(int, char**) ) int err = 0; char** argv = (char**)calloc(argc, sizeof(char*)); argv[0] = __FILE__; - argv[1] = AUBIO_TESTS_SOURCE; + argv[1] = DEFINEDSTRING(AUBIO_TESTS_SOURCE); // check if the file can be read if ( check_source(argv[1]) ) return 1; err = main(argc, argv); diff --git a/tests/wscript_build b/tests/wscript_build index 52342ded..68611785 100644 --- a/tests/wscript_build +++ b/tests/wscript_build @@ -24,5 +24,5 @@ for source_file in programs_sources: use = uselib, install_path = None, defines = ['AUBIO_UNSTABLE_API=1', - 'AUBIO_TESTS_SOURCE=\"{}\"'.format(test_sound_abspath)] + 'AUBIO_TESTS_SOURCE={}'.format(test_sound_abspath)] )