ref: 5b194f0eec9daa56377e3ff43ad4af7483f14842
parent: 2f02d518ef1e6fa0f3762057eefef78e68246d2b
parent: 873646d8f50043a89648a59bbbf4aa499a64790c
author: Paul Brossier <piem@piem.org>
date: Sat Sep 30 23:27:07 EDT 2017
Merge branch 'PR/simplify_emscripten'
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -7,27 +7,27 @@
# pre-installed python version, see:
# http://www.appveyor.com/docs/installed-software#python
- - PYTHON: "C:\\Python27"
+ - PYTHONDIR: "C:\\Python27"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "32"
- - PYTHON: "C:\\Python27-x64"
+ - PYTHONDIR: "C:\\Python27-x64"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "64"
- - PYTHON: "C:\\Python34"
+ - PYTHONDIR: "C:\\Python34"
PYTHON_VERSION: "3.4.x"
PYTHON_ARCH: "32"
- - PYTHON: "C:\\Python34-x64"
+ - PYTHONDIR: "C:\\Python34-x64"
PYTHON_VERSION: "3.4.x"
PYTHON_ARCH: "64"
- - PYTHON: "C:\\Python35"
+ - PYTHONDIR: "C:\\Python35"
PYTHON_VERSION: "3.5.x"
PYTHON_ARCH: "32"
- - PYTHON: "C:\\Python35-x64"
+ - PYTHONDIR: "C:\\Python35-x64"
PYTHON_VERSION: "3.5.x"
PYTHON_ARCH: "64"
# add path required to run preprocessor step
@@ -39,20 +39,19 @@
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
# Check that we have the expected version and architecture for Python
- - "%PYTHON%\\python.exe --version"
- - "%PYTHON%\\python.exe -c \"import struct; print(struct.calcsize('P') * 8)\""
+ - "%PYTHONDIR%\\python.exe --version"
+ - "%PYTHONDIR%\\python.exe -c \"import struct; print(struct.calcsize('P') * 8)\""
# We need wheel installed to build wheels
- - "%PYTHON%\\python.exe -m pip install wheel"
+ - "%PYTHONDIR%\\python.exe -m pip install wheel"
- - "SET PATH=%PATH_EXTRAS%;%PYTHON%;%PYTHON%\\Scripts;%PATH%"
+ - "SET PATH=%PATH_EXTRAS%;%PYTHONDIR%;%PYTHONDIR%\\Scripts;%PATH%"
- "pip install --disable-pip-version-check --user --upgrade pip"
- "pip install --upgrade setuptools"
before_build:
- - curl -fsS -o waf https://waf.io/waf-1.8.22
- - curl -fsS -o waf.bat https://raw.githubusercontent.com/waf-project/waf/master/utils/waf.bat
+ - "bash scripts/get_waf.sh"
build_script:
# build python module without using libaubio
@@ -62,8 +61,8 @@
- "python python\\demos\\demo_create_test_sounds.py"
- "nose2 --verbose"
# clean up
- - waf distclean
+ - "python waf distclean"
# build libaubio
- - waf configure build --verbose
+ - python waf configure build --verbose --msvc_version="msvc 14.0"
# build python module using libaubio dll
- "python setup.py build"
--- a/scripts/build_emscripten
+++ b/scripts/build_emscripten
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
function checkprog() {
type $1 >/dev/null 2>&1 || { echo >&2 "$1 required but not found, aborting."; exit 1; }
@@ -9,13 +9,10 @@
checkprog emmake
# clean
-emmake ./waf distclean
+./waf distclean
# configure
-emconfigure ./waf configure --prefix=$EMSCRIPTEN/system/local/ --with-target-platform emscripten
+emconfigure ./waf configure --with-target-platform emscripten $*
# build
-emmake ./waf --testcmd="node %s"
-
-# intall
-#emmake ./waf install
+emmake ./waf build
--- a/scripts/get_waf.sh
+++ b/scripts/get_waf.sh
@@ -1,10 +1,37 @@
-#! /bin/sh
+#! /bin/bash
set -e
set -x
-WAFURL=https://waf.io/waf-2.0.1
+WAFVERSION=2.0.1
+WAFTARBALL=waf-$WAFVERSION.tar.bz2
+WAFURL=https://waf.io/$WAFTARBALL
-( which wget > /dev/null && wget -qO waf $WAFURL ) || ( which curl > /dev/null && curl $WAFURL > waf )
+WAFBUILDDIR=`mktemp -d`
-chmod +x waf
+function cleanup () {
+ rm -rf $WAFBUILDDIR
+}
+
+trap cleanup SIGINT SIGTERM
+
+function buildwaf () {
+ pushd $WAFBUILDDIR
+
+ ( which wget > /dev/null && wget -qO $WAFTARBALL $WAFURL ) || ( which curl > /dev/null && curl $WAFURL > $WAFTARBALL )
+
+ tar xf $WAFTARBALL
+ pushd waf-$WAFVERSION
+ NOCLIMB=1 python waf-light --tools=c_emscripten,syms $*
+
+ popd
+ popd
+
+ cp -prv $WAFBUILDDIR/waf-$WAFVERSION/waf $PWD
+
+ chmod +x waf
+}
+
+buildwaf
+
+cleanup
--- a/wscript
+++ b/wscript
@@ -102,23 +102,20 @@
ctx.load('gnu_dirs')
def configure(ctx):
- from waflib import Options
- ctx.load('compiler_c')
- ctx.load('waf_unit_test')
- ctx.load('gnu_dirs')
-
target_platform = sys.platform
if ctx.options.target_platform:
target_platform = ctx.options.target_platform
+ from waflib import Options
if target_platform=='emscripten':
- # need to force spaces between flag -o and path
- # inspired from :
- # https://github.com/waf-project/waf/blob/master/waflib/extras/c_emscripten.py (#1885)
- # (OSX /emscripten 1.37.9)
- ctx.env.CC_TGT_F = ['-c', '-o', '']
- ctx.env.CCLNK_TGT_F = ['-o', '']
+ ctx.load('c_emscripten')
+ else:
+ ctx.load('compiler_c')
+
+ ctx.load('waf_unit_test')
+ ctx.load('gnu_dirs')
+
# check for common headers
ctx.check(header_name='stdlib.h')
ctx.check(header_name='stdio.h')
@@ -151,7 +148,10 @@
ctx.env.prepend_value('CFLAGS', ['-g', '-Wall', '-Wextra'])
else:
# enable debug symbols
- ctx.env.CFLAGS += ['/Z7', '/FS']
+ ctx.env.CFLAGS += ['/Z7']
+ # /FS flag available in msvc >= 12 (2013)
+ if 'MSVC_VERSION' in ctx.env and ctx.env.MSVC_VERSION >= 12:
+ ctx.env.CFLAGS += ['/FS']
ctx.env.LINKFLAGS += ['/DEBUG', '/INCREMENTAL:NO']
# configure warnings
ctx.env.CFLAGS += ['/W4', '/D_CRT_SECURE_NO_WARNINGS']
@@ -226,9 +226,6 @@
ctx.env.LINKFLAGS += [ '-isysroot' , SDKROOT]
if target_platform == 'emscripten':
- import os.path
- ctx.env.CFLAGS += [ '-I' + os.path.join(os.environ['EMSCRIPTEN'], 'system', 'include') ]
-
if ctx.options.build_type == "debug":
ctx.env.cshlib_PATTERN = '%s.js'
ctx.env.LINKFLAGS += ['-s','ASSERTIONS=2']
@@ -249,7 +246,7 @@
# tell emscripten functions we want to expose
from python.lib.gen_external import get_c_declarations, get_cpp_objects_from_c_declarations, get_all_func_names_from_lib, generate_lib_from_c_declarations
c_decls = get_c_declarations(usedouble=False) # emscripten can't use double
- objects = get_cpp_objects_from_c_declarations(c_decls)
+ objects = list(get_cpp_objects_from_c_declarations(c_decls))
# ensure that aubio structs are exported
objects += ['fvec_t', 'cvec_t', 'fmat_t']
lib = generate_lib_from_c_declarations(objects, c_decls)
@@ -446,6 +443,8 @@
# add sub directories
if bld.env['DEST_OS'] not in ['ios', 'iosimulator', 'android']:
+ if bld.env['DEST_OS']=='emscripten' and not bld.options.testcmd:
+ bld.options.testcmd = 'node %s'
bld.recurse('examples')
bld.recurse('tests')