From 06dba46afc27ad76f17ba8a6f1a67abc5acc7a7a Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 10 Dec 2013 08:39:47 -0500 Subject: [PATCH] wscript: small tweaks to with mingw32 Signed-off-by: Paul Brossier --- src/wscript_build | 2 ++ tests/utils_tests.h | 17 +++++++++++++++++ wscript | 10 +++++++--- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/wscript_build b/src/wscript_build index e7552164..2bf8261b 100644 --- a/src/wscript_build +++ b/src/wscript_build @@ -21,6 +21,8 @@ ctx(features = 'c', # build libaubio.so (cshlib) and/or libaubio.a (cstlib) if ctx.env['DEST_OS'] in ['ios', 'iosimulator']: build_features = ['cstlib'] +elif ctx.env['DEST_OS'] in ['win32', 'win64']: + build_features = ['cshlib'] else: #linux, darwin, android, mingw, ... build_features = ['cshlib', 'cstlib'] diff --git a/tests/utils_tests.h b/tests/utils_tests.h index 17fc3699..8ab5fe70 100644 --- a/tests/utils_tests.h +++ b/tests/utils_tests.h @@ -3,12 +3,29 @@ #include #include #include +#include "config.h" #define PRINT_ERR(format, args...) fprintf(stderr, "AUBIO-TESTS ERROR: " format , ##args) #define PRINT_MSG(format, args...) fprintf(stdout, format , ##args) #define PRINT_DBG(format, args...) fprintf(stderr, format , ##args) #define PRINT_WRN(format, args...) fprintf(stderr, "AUBIO-TESTS WARNING: " format, ##args) +#ifdef HAVE_WIN_HACKS +// http://en.wikipedia.org/wiki/Linear_congruential_generator +// no srandom/random on win32 + +uint_t srandom_seed = 1029; + +void srandom(uint_t new_seed) { + srandom_seed = new_seed; +} + +uint_t random(void) { + srandom_seed = 1664525 * srandom_seed + 1013904223; + return srandom_seed; +} +#endif + void utils_init_random () { time_t now = time(0); struct tm *tm_struct = localtime(&now); diff --git a/wscript b/wscript index 94f0d04f..58d942aa 100644 --- a/wscript +++ b/wscript @@ -84,15 +84,19 @@ def configure(ctx): ctx.load('compiler_c') ctx.load('waf_unit_test') ctx.load('gnu_dirs') - ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra', '-fPIC'] + + ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra'] target_platform = Options.platform if ctx.options.target_platform: target_platform = ctx.options.target_platform ctx.env['DEST_OS'] = target_platform - if target_platform == 'win32': - ctx.env['shlib_PATTERN'] = 'lib%s.dll' + if target_platform not in ['win32', 'win64']: + ctx.env.CFLAGS += ['-fPIC'] + else: + ctx.define('HAVE_WIN_HACKS', 1) + ctx.env['cshlib_PATTERN'] = 'lib%s.dll' if target_platform == 'darwin': ctx.env.CFLAGS += ['-arch', 'i386', '-arch', 'x86_64'] -- 2.11.0