From 2ca63541f237d5a8f4a65ded6cc629761a07430c Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 17 Jan 2017 10:51:07 +0100 Subject: [PATCH] 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. --- meson.build | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 4df1189..c072157 100644 --- a/meson.build +++ b/meson.build @@ -6,6 +6,7 @@ thread_dep = dependency('threads') kiwixlib_dep = dependency('kiwix') microhttpd_dep = dependency('libmicrohttpd') z_dep = dependency('zlib') + # Idealy we should not have more dependency, however : # We should declare we use ctpp2 in kiwixlib in the pkg-config file. # But there is no pkg-config file for ctpp2. Once one exists, no need to @@ -21,7 +22,13 @@ if ctpp2_prefix_install == '' error('ctpp2/CTPP2Logger.hppnot found') endif 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 ctpp2_include_path = ctpp2_prefix_install + '/include' ctpp2_include_args = ['-I'+ctpp2_include_path] @@ -31,7 +38,13 @@ else ctpp2_include_path = include_directories(ctpp2_include_path, is_system:true) ctpp2_lib_path = ctpp2_prefix_install+'/lib' 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 all_deps = [thread_dep, kiwixlib_dep, microhttpd_dep, ctpp2_dep, z_dep]