On Windows, ctpp2 use the iconv libraries.

If we are cross-compiling to windows, we need to also link with the
iconv library.

We do not check for the iconv library existance here. We assume that
if the ctpp2 library is present all its own dependencies are present also.
This commit is contained in:
Matthieu Gautier 2017-01-17 17:33:35 +01:00
parent 12f148974f
commit 88f6b3a0f9
1 changed files with 15 additions and 3 deletions

View File

@ -21,17 +21,29 @@ if ctpp2_prefix_install == ''
error('ctpp2/CTPP2Logger.hppnot found') error('ctpp2/CTPP2Logger.hppnot found')
endif endif
ctpp2_lib = compiler.find_library(libname) ctpp2_lib = compiler.find_library(libname)
ctpp2_dep = declare_dependency(dependencies:[ctpp2_lib]) link_args = ['-l'+libname]
if meson.is_cross_build()
if host_machine.system() == 'windows'
link_args += ['-liconv']
endif
endif
ctpp2_dep = declare_dependency(link_args:link_args)
else else
ctpp2_include_path = ctpp2_prefix_install + '/include' ctpp2_include_path = ctpp2_prefix_install + '/include'
ctpp2_include_args = ['-I'+ctpp2_include_path] ctpp2_include_args = ['-I'+ctpp2_include_path]
if not compiler.has_header('ctpp2/CTPP2Logger.hpp', args:ctpp2_include_args) if not compiler.has_header('ctpp2/CTPP2Logger.hpp', args:ctpp2_include_args)
error('ctpp2/CTPP2Logger.hppnot found') error('ctpp2/CTPP2Logger.hpp not found')
endif endif
ctpp2_include_path = include_directories(ctpp2_include_path, is_system:true) ctpp2_include_path = include_directories(ctpp2_include_path, is_system:true)
ctpp2_lib_path = ctpp2_prefix_install+'/lib' ctpp2_lib_path = ctpp2_prefix_install+'/lib'
ctpp2_lib = compiler.find_library(libname, dirs:ctpp2_lib_path) ctpp2_lib = compiler.find_library(libname, dirs:ctpp2_lib_path)
ctpp2_dep = declare_dependency(include_directories:ctpp2_include_path, dependencies:[ctpp2_lib]) link_args = ['-L'+ctpp2_lib_path, '-l'+libname]
if meson.is_cross_build()
if host_machine.system() == 'windows'
link_args += ['-liconv']
endif
endif
ctpp2_dep = declare_dependency(include_directories:ctpp2_include_path, link_args:link_args)
endif endif
pkg_requires = ['libzim', 'icu-i18n', 'pugixml'] pkg_requires = ['libzim', 'icu-i18n', 'pugixml']