2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-12-22 17:01:14 +01:00

3rdparty: libvorbis & libvorbisfile combined into one wscript

This commit is contained in:
SNMetamorph 2024-12-02 00:24:52 +04:00 committed by Alibek Omarov
parent 881788c0c9
commit 485d4324f8
4 changed files with 79 additions and 129 deletions

View File

@ -1,72 +0,0 @@
#! /usr/bin/env python
# encoding: utf-8
FRAGMENT_MEMORY_H='''#include <memory.h>
int main (void) {
return 0;
}'''
FRAGMENT_MEMCMP='''#include <string.h>
int main (void) {
memcmp(NULL, NULL, 0);
return 0;
}'''
FRAGMENT_ALLOCA_H='''#include <alloca.h>
int main (void) {
int foo=10;
int * array = alloca(foo);
}'''
def options(opt):
pass
def configure(conf):
if not conf.path.find_dir('../vorbis-src') or not conf.path.find_dir('../vorbis-src/lib'):
conf.fatal('Can\'t find libvorbis submodule. Run `git submodule update --init --recursive`.')
return
# Check for required headers
if conf.check_cc(fragment=FRAGMENT_MEMORY_H, msg = 'Checking for memory.h header', mandatory = False):
conf.define('USE_MEMORY_H', 1)
conf.check_cc(fragmenmt=FRAGMENT_MEMCMP, msg = 'Checking for memcmp in string.h header', mandatory = False)
conf.check_cc(fragment=FRAGMENT_ALLOCA_H, msg = 'Checking for alloca in alloca.h header', mandatory = False)
if conf.env.COMPILER_CC == 'msvc':
conf.define('_CRT_SECURE_NO_WARNINGS', 1)
conf.define('_CRT_SECURE_NO_DEPRECATE', 1)
conf.define('_CRT_NONSTDC_NO_DEPRECATE', 1)
def build(bld):
sources = [
'../vorbis-src/lib/mdct.c',
'../vorbis-src/lib/smallft.c',
'../vorbis-src/lib/block.c',
'../vorbis-src/lib/envelope.c',
'../vorbis-src/lib/window.c',
'../vorbis-src/lib/lsp.c',
'../vorbis-src/lib/lpc.c',
'../vorbis-src/lib/analysis.c',
'../vorbis-src/lib/synthesis.c',
'../vorbis-src/lib/psy.c',
'../vorbis-src/lib/info.c',
'../vorbis-src/lib/floor1.c',
'../vorbis-src/lib/floor0.c',
'../vorbis-src/lib/res0.c',
'../vorbis-src/lib/mapping0.c',
'../vorbis-src/lib/registry.c',
'../vorbis-src/lib/codebook.c',
'../vorbis-src/lib/sharedbook.c',
'../vorbis-src/lib/lookup.c',
'../vorbis-src/lib/bitrate.c'
]
bld.stlib(
source = sources,
target = 'libvorbis',
features = 'c',
includes = ['../vorbis-src/include/'],
use = ['libogg'],
export_includes = ['../vorbis-src/include/']
)

View File

@ -1,52 +0,0 @@
#! /usr/bin/env python
# encoding: utf-8
FRAGMENT_MEMORY_H='''#include <memory.h>
int main (void) {
return 0;
}'''
FRAGMENT_MEMCMP='''#include <string.h>
int main (void) {
memcmp(NULL, NULL, 0);
return 0;
}'''
FRAGMENT_ALLOCA_H='''#include <alloca.h>
int main (void) {
int foo=10;
int * array = alloca(foo);
}'''
def options(opt):
pass
def configure(conf):
if not conf.path.find_dir('../vorbis-src') or not conf.path.find_dir('../vorbis-src/lib'):
conf.fatal('Can\'t find libvorbis submodule. Run `git submodule update --init --recursive`.')
return
if conf.check_cc(fragment=FRAGMENT_MEMORY_H, msg = 'Checking for memory.h header', mandatory = False):
conf.define('USE_MEMORY_H', 1)
conf.check_cc(fragmenmt=FRAGMENT_MEMCMP, msg = 'Checking for memcmp in string.h header', mandatory = False)
conf.check_cc(fragment=FRAGMENT_ALLOCA_H, msg = 'Checking for alloca in alloca.h header', mandatory = False)
if conf.env.COMPILER_CC == 'msvc':
conf.define('_CRT_SECURE_NO_WARNINGS', 1)
conf.define('_CRT_SECURE_NO_DEPRECATE', 1)
conf.define('_CRT_NONSTDC_NO_DEPRECATE', 1)
def build(bld):
sources = [
'../vorbis-src/lib/vorbisfile.c'
]
bld.stlib(
source = sources,
target = 'libvorbisfile',
features = 'c',
includes = ['../vorbis-src/include/'],
use = ['libvorbis'],
export_includes = ['../vorbis-src/include/']
)

75
3rdparty/vorbis/wscript vendored Normal file
View File

@ -0,0 +1,75 @@
#! /usr/bin/env python
# encoding: utf-8
FRAGMENT_MEMORY_H='''#include <memory.h>
int main (void) {
return 0;
}'''
FRAGMENT_ALLOCA_H='''#include <alloca.h>
int main (void) {
int foo=10;
int * array = alloca(foo);
}'''
def options(opt):
pass
def configure(conf):
if not conf.path.find_dir('vorbis-src') or not conf.path.find_dir('vorbis-src/lib'):
conf.fatal('Can\'t find Vorbis submodule. Run `git submodule update --init --recursive`.')
return
if conf.check_cc(fragment=FRAGMENT_MEMORY_H, msg = 'Checking for memory.h header', mandatory = False):
conf.define('USE_MEMORY_H', 1)
conf.check_cc(fragment=FRAGMENT_ALLOCA_H, msg = 'Checking for alloca in alloca.h header', mandatory = False)
if conf.env.COMPILER_CC == 'msvc':
conf.define('_CRT_SECURE_NO_WARNINGS', 1)
conf.define('_CRT_SECURE_NO_DEPRECATE', 1)
conf.define('_CRT_NONSTDC_NO_DEPRECATE', 1)
def build(bld):
libvorbis_sources = [
'vorbis-src/lib/mdct.c',
'vorbis-src/lib/smallft.c',
'vorbis-src/lib/block.c',
'vorbis-src/lib/envelope.c',
'vorbis-src/lib/window.c',
'vorbis-src/lib/lsp.c',
'vorbis-src/lib/lpc.c',
'vorbis-src/lib/analysis.c',
'vorbis-src/lib/synthesis.c',
'vorbis-src/lib/psy.c',
'vorbis-src/lib/info.c',
'vorbis-src/lib/floor1.c',
'vorbis-src/lib/floor0.c',
'vorbis-src/lib/res0.c',
'vorbis-src/lib/mapping0.c',
'vorbis-src/lib/registry.c',
'vorbis-src/lib/codebook.c',
'vorbis-src/lib/sharedbook.c',
'vorbis-src/lib/lookup.c',
'vorbis-src/lib/bitrate.c'
]
libvorbisfile_sources = [
'vorbis-src/lib/vorbisfile.c'
]
bld.stlib(
source = libvorbis_sources,
target = 'libvorbis',
includes = ['vorbis-src/include/'],
use = ['libogg'],
export_includes = ['vorbis-src/include/']
)
bld.stlib(
source = libvorbisfile_sources,
target = 'libvorbisfile',
includes = ['vorbis-src/include/'],
use = ['libvorbis'],
export_includes = ['vorbis-src/include/']
)

View File

@ -84,11 +84,10 @@ SUBDIRS = [
Subproject('filesystem'),
Subproject('stub/server'),
Subproject('dllemu'),
Subproject('3rdparty/libogg'),
Subproject('3rdparty/vorbis/libvorbis'),
Subproject('3rdparty/vorbis/libvorbisfile'),
Subproject('3rdparty/opusfile'),
Subproject('3rdparty/libogg'),
Subproject('3rdparty/vorbis'),
Subproject('3rdparty/opusfile'),
# disable only by engine feature, makes no sense to even parse subprojects in dedicated mode
Subproject('3rdparty/extras', lambda x: not x.env.DEDICATED and x.env.DEST_OS != 'android'),
Subproject('3rdparty/nanogl', lambda x: not x.env.DEDICATED and x.env.NANOGL),