diff --git a/utils/mdldec/wscript b/utils/mdldec/wscript new file mode 100644 index 00000000..7b5d7e18 --- /dev/null +++ b/utils/mdldec/wscript @@ -0,0 +1,33 @@ +#! /usr/bin/env python +# encoding: utf-8 +# a1batross, mittorn, 2018 + +def options(opt): + # TODO: any options for mdldec? + grp = opt.get_option_group('Utilities options') + + grp.add_option('--disable-utils-mdldec', action = 'store_true', dest = 'DISABLE_UTILS_MDLDEC', default = False, + help = 'disable studio model decompiler utility [default: %default]') + +def configure(conf): + conf.env.DISABLE_UTILS_MDLDEC = conf.options.DISABLE_UTILS_MDLDEC + +def build(bld): + if bld.env.DISABLE_UTILS_MDLDEC: + return + + source = bld.path.ant_glob('*.c') + includes = '. ../../common ../../engine ../../engine/common ../../engine/common/imagelib ../../public' + libs = [ 'public', 'M' ] + + bld( + source = source, + target = 'mdldec', + features = 'c cprogram', + includes = includes, + use = libs, + install_path = bld.env.BINDIR, + subsystem = bld.env.MSVC_SUBSYSTEM + ) + + bld.install_files(bld.env.SHAREDIR, 'res/activities.txt') diff --git a/wscript b/wscript index 6334ac70..1f4ecb04 100644 --- a/wscript +++ b/wscript @@ -20,11 +20,12 @@ class Subproject: ignore = False # if true will be ignored, set by user request mandatory = False - def __init__(self, name, dedicated=True, singlebin=False, mandatory = False): + def __init__(self, name, dedicated=True, singlebin=False, mandatory = False, utility = False): self.name = name self.dedicated = dedicated self.singlebin = singlebin self.mandatory = mandatory + self.utility = utility def is_enabled(self, ctx): if not self.mandatory: @@ -43,6 +44,9 @@ class Subproject: if ctx.env.DEDICATED and self.dedicated: return False + if self.utility and not ctx.env.ENABLE_UTILS: + return False + return True SUBDIRS = [ @@ -56,6 +60,7 @@ SUBDIRS = [ Subproject('stub/client'), Subproject('dllemu'), Subproject('engine', dedicated=False), + Subproject('utils/mdldec', utility=True) ] def subdirs(): @@ -85,6 +90,11 @@ def options(opt): grp.add_option('--ignore-projects', action = 'store', dest = 'IGNORE_PROJECTS', default = None, help = 'disable selected projects from build [default: %default]') + grp = opt.add_option_group('Utilities options') + + grp.add_option('--enable-utils', action = 'store_true', dest = 'ENABLE_UTILS', default = False, + help = 'enable building various development utilities [default: %default]') + opt.load('compiler_optimizations subproject') for i in SUBDIRS: @@ -220,6 +230,7 @@ def configure(conf): # include portable stdint by Paul Hsich conf.define('STDINT_H', 'pstdint.h') + conf.env.ENABLE_UTILS = conf.options.ENABLE_UTILS conf.env.DEDICATED = conf.options.DEDICATED conf.env.SINGLE_BINARY = conf.options.SINGLE_BINARY or conf.env.DEDICATED if conf.env.DEST_OS == 'dos': @@ -271,8 +282,9 @@ def configure(conf): # indicate if we are packaging for Linux/BSD if not conf.options.WIN_INSTALL and conf.env.DEST_OS not in ['win32', 'darwin', 'android']: conf.env.LIBDIR = conf.env.BINDIR = '${PREFIX}/lib/xash3d' + conf.env.SHAREDIR = '${PREFIX}/share/xash3d' else: - conf.env.LIBDIR = conf.env.BINDIR = conf.env.PREFIX + conf.env.SHAREDIR = conf.env.LIBDIR = conf.env.BINDIR = conf.env.PREFIX 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)