You've already forked cpp-httplib
build(meson): add non_blocking_getaddrinfo option (#2174)
This new option automatically enables the new non-blocking name
resolution when the appropriate libraries are found, automatically
adding them to the list of required dependencies. It will gracefully
fall back to the old behaviour when no library is found.
This complements commit ea850cbfa7
.
This commit is contained in:
18
meson.build
18
meson.build
@ -16,11 +16,12 @@ project(
|
|||||||
meson_version: '>=0.62.0'
|
meson_version: '>=0.62.0'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cxx = meson.get_compiler('cpp')
|
||||||
|
|
||||||
# Check just in case downstream decides to edit the source
|
# Check just in case downstream decides to edit the source
|
||||||
# and add a project version
|
# and add a project version
|
||||||
version = meson.project_version()
|
version = meson.project_version()
|
||||||
if version == 'undefined'
|
if version == 'undefined'
|
||||||
cxx = meson.get_compiler('cpp')
|
|
||||||
version = cxx.get_define('CPPHTTPLIB_VERSION',
|
version = cxx.get_define('CPPHTTPLIB_VERSION',
|
||||||
prefix: '#include <httplib.h>',
|
prefix: '#include <httplib.h>',
|
||||||
include_directories: include_directories('.')).strip('"')
|
include_directories: include_directories('.')).strip('"')
|
||||||
@ -65,6 +66,21 @@ if brotli_found_all
|
|||||||
args += '-DCPPHTTPLIB_BROTLI_SUPPORT'
|
args += '-DCPPHTTPLIB_BROTLI_SUPPORT'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
async_ns_opt = get_option('cpp-httplib_non_blocking_getaddrinfo')
|
||||||
|
|
||||||
|
if host_machine.system() == 'windows'
|
||||||
|
async_ns_dep = cxx.find_library('ws2_32', required: async_ns_opt)
|
||||||
|
elif host_machine.system() == 'darwin'
|
||||||
|
async_ns_dep = dependency('appleframeworks', modules: ['CFNetwork'], required: async_ns_opt)
|
||||||
|
else
|
||||||
|
async_ns_dep = cxx.find_library('anl', required: async_ns_opt)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if async_ns_dep.found()
|
||||||
|
deps += async_ns_dep
|
||||||
|
args += '-DCPPHTTPLIB_USE_NON_BLOCKING_GETADDRINFO'
|
||||||
|
endif
|
||||||
|
|
||||||
cpp_httplib_dep = dependency('', required: false)
|
cpp_httplib_dep = dependency('', required: false)
|
||||||
|
|
||||||
if get_option('cpp-httplib_compile')
|
if get_option('cpp-httplib_compile')
|
||||||
|
@ -6,5 +6,6 @@ option('cpp-httplib_openssl', type: 'feature', value: 'auto', description: 'Enab
|
|||||||
option('cpp-httplib_zlib', type: 'feature', value: 'auto', description: 'Enable zlib support')
|
option('cpp-httplib_zlib', type: 'feature', value: 'auto', description: 'Enable zlib support')
|
||||||
option('cpp-httplib_brotli', type: 'feature', value: 'auto', description: 'Enable Brotli support')
|
option('cpp-httplib_brotli', type: 'feature', value: 'auto', description: 'Enable Brotli support')
|
||||||
option('cpp-httplib_macosx_keychain', type: 'feature', value: 'auto', description: 'Enable loading certs from the Keychain on Apple devices')
|
option('cpp-httplib_macosx_keychain', type: 'feature', value: 'auto', description: 'Enable loading certs from the Keychain on Apple devices')
|
||||||
|
option('cpp-httplib_non_blocking_getaddrinfo', type: 'feature', value: 'auto', description: 'Enable asynchronous name lookup')
|
||||||
option('cpp-httplib_compile', type: 'boolean', value: false, description: 'Split the header into a compilable header & source file (requires python3)')
|
option('cpp-httplib_compile', type: 'boolean', value: false, description: 'Split the header into a compilable header & source file (requires python3)')
|
||||||
option('cpp-httplib_test', type: 'boolean', value: false, description: 'Build tests')
|
option('cpp-httplib_test', type: 'boolean', value: false, description: 'Build tests')
|
||||||
|
Reference in New Issue
Block a user