mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
engine: move our HTTP client to http subfolder, prepare for curl integration
This commit is contained in:
@@ -33,6 +33,15 @@ int main(int argc, char **argv)
|
||||
}
|
||||
'''
|
||||
|
||||
CURL_CHECK_FRAGMENT='''
|
||||
#include <curl/curl.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
CURL *easy = curl_easy_init();
|
||||
return 0;
|
||||
}
|
||||
'''
|
||||
|
||||
def options(opt):
|
||||
grp = opt.add_option_group('Engine options')
|
||||
|
||||
@@ -60,6 +69,9 @@ def options(opt):
|
||||
grp.add_option('--enable-ffmpeg-dlopen', action = 'store_true', dest = 'FFMPEG_DLOPEN', default = False,
|
||||
help = 'load ffmpeg libraries in runtime [default: %(default)s]')
|
||||
|
||||
grp.add_option('--disable-curl', action = 'store_false', dest = 'CURL', default = False,
|
||||
help = 'enable curl-based HTTP downloader [default: %(default)s]')
|
||||
|
||||
opt.load('sdl2')
|
||||
|
||||
def find_sdl(conf):
|
||||
@@ -163,6 +175,19 @@ def configure(conf):
|
||||
conf.define('HAVE_FFMPEG', True)
|
||||
conf.define_cond('XASH_FFMPEG_DLOPEN', conf.options.FFMPEG_DLOPEN)
|
||||
|
||||
if conf.options.CURL:
|
||||
pkgconf_args = '--cflags --libs'
|
||||
features = 'c cprogram'
|
||||
|
||||
# TODO: when dlopen curl is implemented, we might not need this check
|
||||
# as we can safely bundle curl headers as curl never breaks API/ABI
|
||||
conf.check_cfg(package='libcurl', uselib_store='CURL', args=pkgconf_args)
|
||||
|
||||
conf.check(features=features, fragment=CURL_CHECK_FRAGMENT, use='CURL', msg='Checking for curl sanity')
|
||||
|
||||
conf.env.CURL=True
|
||||
conf.define('HAVE_CURL', True)
|
||||
|
||||
conf.define_cond('XASH_STATIC_LIBS', conf.env.STATIC_LINKING)
|
||||
conf.define_cond('XASH_CUSTOM_SWAP', conf.options.CUSTOM_SWAP)
|
||||
conf.define_cond('XASH_NO_ASYNC_NS_RESOLVE', not have_async_resolve)
|
||||
@@ -199,6 +224,12 @@ def build(bld):
|
||||
if bld.get_define('XASH_STATIC_LIBS'):
|
||||
source += ['platform/misc/lib_static.c']
|
||||
|
||||
if bld.get_define('HAVE_CURL'):
|
||||
source += ['common/http/net_http_curl.c']
|
||||
libs += ['CURL']
|
||||
else:
|
||||
source += ['common/http/net_http_xash.c']
|
||||
|
||||
if bld.env.DEST_OS == 'win32':
|
||||
libs += ['USER32', 'SHELL32', 'GDI32', 'ADVAPI32', 'DBGHELP', 'PSAPI', 'WS2_32']
|
||||
elif bld.env.DEST_OS == 'nswitch':
|
||||
|
||||
Reference in New Issue
Block a user