Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add preprocessor definitions for MSVC dllexport/dllimport statements

(cherry picked from commit 2654b6b)
  • Loading branch information
cinemast authored and cdunn2001 committed Jun 23, 2018
1 parent ee34ac1 commit b87f6db
Showing 1 changed file with 14 additions and 3 deletions.
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

0 comments on commit b87f6db

Please sign in to comment.