cemu-vcpkg/ports/aubio/crt_lib_linkage.patch
2017-06-28 13:37:52 -07:00

69 lines
3.0 KiB
Diff

diff --git a/src/wscript_build b/src/wscript_build
index 0a7d72a..bf84227 100644
--- a/src/wscript_build
+++ b/src/wscript_build
@@ -24,7 +24,12 @@ ctx(features = 'c',
if ctx.env['DEST_OS'] in ['ios', 'iosimulator']:
build_features = ['cstlib', 'cshlib']
elif ctx.env['DEST_OS'] in ['win32', 'win64']:
- build_features = ['cstlib', 'cshlib']
+ if ctx.options.library_linkage == "static":
+ build_features = ['cstlib']
+ elif ctx.options.library_linkage == "dynamic":
+ build_features = ['cshlib']
+ else:
+ build_features = ['cstlib', 'cshlib']
elif ctx.env['DEST_OS'] in ['emscripten']:
build_features = ['cstlib']
elif '--static' in ctx.env['LDFLAGS'] or '--static' in ctx.env['LINKFLAGS']:
diff --git a/wscript b/wscript
index 6363f1e..e0d57a4 100644
--- a/wscript
+++ b/wscript
@@ -44,6 +44,16 @@ def options(ctx):
dest = 'build_type',
help = 'whether to compile with (--build-type=release) or without (--build-type=debug) '\
' compiler opimizations [default: release]')
+ ctx.add_option('--crt-linkage', action = 'store',
+ default = "dynamic",
+ choices = ('static', 'dynamic'),
+ dest = 'crt_linkage',
+ help = 'whether to compile with static CRT linkage (--crt-linkage=static) or the default dynamic (--crt-linkage=dynamic)')
+ ctx.add_option('--library-linkage', action = 'store',
+ default = "both",
+ choices = ('dynamic', 'static', 'both'),
+ dest = 'library_linkage',
+ help = 'whether to compile a dynamic (shared) (--library-linkage=dynamic) or static library (--library-linkage=static) ("both" is broken for msvc)')
add_option_enable_disable(ctx, 'fftw3f', default = False,
help_str = 'compile with fftw3f instead of ooura (recommended)',
help_disable_str = 'do not compile with fftw3f')
@@ -139,16 +149,25 @@ def configure(ctx):
else:
# enable debug symbols
ctx.env.CFLAGS += ['/Z7', '/FS']
- ctx.env.LINKFLAGS += ['/DEBUG', '/INCREMENTAL:NO']
+ if ctx.options.library_linkage == "dynamic":
+ ctx.env.LINKFLAGS += ['/DEBUG', '/INCREMENTAL:NO', '/DEF:..\\aubio-5.def']
+ else:
+ ctx.env.LINKFLAGS += ['/DEBUG', '/INCREMENTAL:NO']
# configure warnings
ctx.env.CFLAGS += ['/W4', '/D_CRT_SECURE_NO_WARNINGS']
# set optimization level and runtime libs
if (ctx.options.build_type == "release"):
ctx.env.CFLAGS += ['/Ox']
- ctx.env.CFLAGS += ['/MD']
+ if (ctx.options.crt_linkage == "static"):
+ ctx.env.CFLAGS += ['/MT']
+ else:
+ ctx.env.CFLAGS += ['/MD']
else:
assert(ctx.options.build_type == "debug")
- ctx.env.CFLAGS += ['/MDd']
+ if (ctx.options.crt_linkage == "static"):
+ ctx.env.CFLAGS += ['/MTd']
+ else:
+ ctx.env.CFLAGS += ['/MDd']
ctx.check_cc(lib='m', uselib_store='M', mandatory=False)