Skip to content

Fix for #798 #800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 14 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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)
Expand All @@ -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,
Expand Down
7 changes: 6 additions & 1 deletion travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ 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
#ninja -v -C build-${LIB_TYPE} test
cd build-${LIB_TYPE}
meson test --no-rebuild --print-errorlogs
cd -
rm -r build-${LIB_TYPE}