From b87f6dbc8a732ea785798cc76d66314eea38f008 Mon Sep 17 00:00:00 2001 From: Peter Spiess-Knafl Date: Mon, 18 Jun 2018 11:28:56 +0200 Subject: [PATCH 1/4] Fix for #798 Add preprocessor definitions for MSVC dllexport/dllimport statements (cherry picked from commit 2654b6bbbf089bf85d29c9a9ca1283e07cc6fe43) --- meson.build | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index f5573c0..058d55a 100644 --- a/meson.build +++ b/meson.build @@ -46,6 +46,14 @@ install_headers( jsoncpp_headers, subdir : 'json') +if get_option('default_library') == 'shared' and meson.get_compiler('cpp').get_id() == 'msvc' + dll_export_flag = '-DJSON_DLL_BUILD' + dll_import_flag = '-DJSON_DLL' +else + dll_export_flag = '' + dll_import_flag = '' +endif + jsoncpp_lib = library( 'jsoncpp', [ jsoncpp_gen_sources, @@ -56,7 +64,8 @@ jsoncpp_lib = library( 'src/lib_json/json_writer.cpp'], soversion : 20, install : true, - include_directories : jsoncpp_include_directories) + include_directories : jsoncpp_include_directories, + cpp_args: dll_export_flag) import('pkgconfig').generate( libraries : jsoncpp_lib, @@ -82,7 +91,8 @@ jsoncpp_test = executable( 'src/test_lib_json/main.cpp'], include_directories : jsoncpp_include_directories, link_with : jsoncpp_lib, - install : false) + install : false, + cpp_args: dll_import_flag) test( 'unittest_jsoncpp_test', jsoncpp_test) @@ -92,7 +102,8 @@ jsontestrunner = executable( 'src/jsontestrunner/main.cpp', include_directories : jsoncpp_include_directories, link_with : jsoncpp_lib, - install : false) + install : false, + cpp_args: dll_import_flag) test( 'unittest_jsontestrunner', python, From 59d41de5b1d5588e310f2f31552c66d4f3beef33 Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Sat, 23 Jun 2018 17:34:40 -0500 Subject: [PATCH 2/4] Try to avoid empty string - g++ has a problem with '' - clang++ does not seem to mind it. --- meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 058d55a..a338cc0 100644 --- a/meson.build +++ b/meson.build @@ -50,8 +50,8 @@ if get_option('default_library') == 'shared' and meson.get_compiler('cpp').get_i dll_export_flag = '-DJSON_DLL_BUILD' dll_import_flag = '-DJSON_DLL' else - dll_export_flag = '' - dll_import_flag = '' + dll_export_flag = [] + dll_import_flag = [] endif jsoncpp_lib = library( From 473afca1e3c9531e9d00a6c8f84ff27bfbd72b9d Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Sat, 23 Jun 2018 17:43:25 -0500 Subject: [PATCH 3/4] Tell meson/ninja versions --- travis.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/travis.sh b/travis.sh index f80424b..f7a80bb 100755 --- a/travis.sh +++ b/travis.sh @@ -17,6 +17,8 @@ set -vex env | sort +meson --version +ninja --version meson --buildtype ${BUILD_TYPE} --default-library ${LIB_TYPE} . build-${LIB_TYPE} ninja -v -C build-${LIB_TYPE} ninja -v -C build-${LIB_TYPE} test From c59db800023ac306ad44cd7c8aa5bef474faf173 Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Sat, 23 Jun 2018 16:34:57 -0500 Subject: [PATCH 4/4] Try the way I build locally --- README.md | 4 +++- travis.sh | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8332742..5c9c95f 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,10 @@ Then, LIB_TYPE=shared #LIB_TYPE=static meson --buildtype ${BUILD_TYPE} --default-library ${LIB_TYPE} . build-${LIB_TYPE} - ninja -v -C build-${LIB_TYPE} test + #ninja -v -C build-${LIB_TYPE} test # This stopped working on my Mac. + ninja -v -C build-${LIB_TYPE} cd build-${LIB_TYPE} + meson test --no-rebuild --print-errorlogs sudo ninja install ### Building and testing with other build systems diff --git a/travis.sh b/travis.sh index f7a80bb..226c64d 100755 --- a/travis.sh +++ b/travis.sh @@ -21,5 +21,8 @@ meson --version ninja --version meson --buildtype ${BUILD_TYPE} --default-library ${LIB_TYPE} . build-${LIB_TYPE} ninja -v -C build-${LIB_TYPE} -ninja -v -C build-${LIB_TYPE} test +#ninja -v -C build-${LIB_TYPE} test +cd build-${LIB_TYPE} +meson test --no-rebuild --print-errorlogs +cd - rm -r build-${LIB_TYPE}