mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-11 15:47:55 +00:00
wscript: move system opus detection to main wscript, so we can avoid including subproject
This commit is contained in:
parent
1fda8753bd
commit
238162bb79
17
3rdparty/opus/wscript
vendored
17
3rdparty/opus/wscript
vendored
@ -3,24 +3,10 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
OPUS_CHECK='''#include <opus.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
OpusEncoder *oe = opus_encoder_create(48000, 2, OPUS_APPLICATION_VOIP, NULL);
|
|
||||||
OpusDecoder *od = opus_decoder_create(48000, 2, NULL);
|
|
||||||
return !oe || !od;
|
|
||||||
}
|
|
||||||
'''
|
|
||||||
|
|
||||||
def options(opt):
|
def options(opt):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
if conf.check_pkg('opus', 'OPUS', OPUS_CHECK, fatal = False):
|
|
||||||
conf.env.HAVE_OPUS = True
|
|
||||||
return
|
|
||||||
|
|
||||||
if not conf.path.find_dir('opus') or not conf.path.find_dir('opus/src'):
|
if not conf.path.find_dir('opus') or not conf.path.find_dir('opus/src'):
|
||||||
conf.fatal('Can\'t find opus submodule. Run `git submodule update --init --recursive`.')
|
conf.fatal('Can\'t find opus submodule. Run `git submodule update --init --recursive`.')
|
||||||
return
|
return
|
||||||
@ -29,9 +15,6 @@ def configure(conf):
|
|||||||
# TODO: maybe call autotools/cmake/meson instead?
|
# TODO: maybe call autotools/cmake/meson instead?
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
if bld.env.HAVE_OPUS:
|
|
||||||
return
|
|
||||||
|
|
||||||
sources = bld.path.ant_glob([
|
sources = bld.path.ant_glob([
|
||||||
'opus/src/*.c',
|
'opus/src/*.c',
|
||||||
'opus/celt/*.c',
|
'opus/celt/*.c',
|
||||||
|
9
wscript
9
wscript
@ -72,6 +72,9 @@ def options(opt):
|
|||||||
grp.add_option('-P', '--enable-packaging', action = 'store_true', dest = 'PACKAGING', default = False,
|
grp.add_option('-P', '--enable-packaging', action = 'store_true', dest = 'PACKAGING', default = False,
|
||||||
help = 'respect prefix option, useful for packaging for various operating systems [default: %default]')
|
help = 'respect prefix option, useful for packaging for various operating systems [default: %default]')
|
||||||
|
|
||||||
|
grp.add_option('--enabled-bundled-deps', action = 'store_true', dest = 'BUILD_BUNDLED_DEPS', default = False,
|
||||||
|
help = 'prefer to build bundled dependencies (like opus) instead of relying on system provided')
|
||||||
|
|
||||||
grp.add_option('--enable-bsp2', action = 'store_true', dest = 'SUPPORT_BSP2_FORMAT', default = False,
|
grp.add_option('--enable-bsp2', action = 'store_true', dest = 'SUPPORT_BSP2_FORMAT', default = False,
|
||||||
help = 'build engine and renderers with BSP2 map support(recommended for Quake, breaks compatibility!) [default: %default]')
|
help = 'build engine and renderers with BSP2 map support(recommended for Quake, breaks compatibility!) [default: %default]')
|
||||||
|
|
||||||
@ -323,6 +326,12 @@ int main(int argc, char **argv) { strcasestr(argv[1], argv[2]); return 0; }'''
|
|||||||
|
|
||||||
conf.env.SHAREDIR = conf.env.LIBDIR = conf.env.BINDIR = conf.env.PREFIX
|
conf.env.SHAREDIR = conf.env.LIBDIR = conf.env.BINDIR = conf.env.PREFIX
|
||||||
|
|
||||||
|
if not conf.options.BUILD_BUNDLED_DEPS:
|
||||||
|
# check if we can use system opus
|
||||||
|
if conf.check_pkg('opus', 'opus', '''#include <opus.h>
|
||||||
|
int main(void){ return (opus_encoder_create(48000, 2, OPUS_APPLICATION_VOIP, 0) != 0) && (opus_decoder_create(48000, 2, 0) != 0);}''', fatal = False):
|
||||||
|
conf.env.HAVE_SYSTEM_OPUS = True
|
||||||
|
|
||||||
conf.define('XASH_BUILD_COMMIT', conf.env.GIT_VERSION if conf.env.GIT_VERSION else 'notset')
|
conf.define('XASH_BUILD_COMMIT', conf.env.GIT_VERSION if conf.env.GIT_VERSION else 'notset')
|
||||||
conf.define('XASH_LOW_MEMORY', conf.options.LOW_MEMORY)
|
conf.define('XASH_LOW_MEMORY', conf.options.LOW_MEMORY)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user