-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgulpfile.js
63 lines (51 loc) · 2.01 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const gulp = require('gulp')
const shell = require('gulp-shell')
const libf2cFiles = require('./src/libf2c-files')
const blasFiles = require('./src/blas-files')
const lapackFiles = require('./src/lapack-files')
const exportFunctions = require('./src/export-functions')
const lapackInstallFiles = [
'dlamch',
'slamch'
]
var joinNames = function (names) {
return names
.map(function (name) {
return '"' + name + '"'
})
.join(',')
}
gulp.task('mkbuild', shell.task(['mkdir -p build']))
gulp.task('compile-libf2c', ['mkbuild'], shell.task(
libf2cFiles.map(function (name) {
return 'emcc clapack/F2CLIBS/libf2c/' + name + '.c -O2 -Iclapack/INCLUDE -o build/' + name + '.bc'
})
))
gulp.task('compile-blas', ['mkbuild'], shell.task(
blasFiles
.map(function (name) {
return 'emcc clapack/BLAS/SRC/' + name + '.c -O2 -Iclapack/INCLUDE -o build/' + name + '.bc'
})
))
gulp.task('compile-lapack-install', ['mkbuild'], shell.task(
lapackInstallFiles
.map(function (name) {
return 'emcc clapack/INSTALL/' + name + '.c -O2 -Iclapack/INCLUDE -o build/' + name + '.bc'
})
))
gulp.task('compile-lapack', ['mkbuild'], shell.task(
lapackFiles
.map(function (name) {
return 'emcc clapack/SRC/' + name + '.c -O2 -Iclapack/INCLUDE -o build/' + name + '.bc'
})
))
gulp.task('link-asmjs', ['compile-libf2c', 'compile-blas', 'compile-lapack', 'compile-lapack-install'], shell.task([
"emcc build/*.bc -o asmjs.js -O2 --memory-init-file 0 -s EXPORTED_FUNCTIONS='[" + joinNames(exportFunctions) + "]' --post-js src/export.js"
]))
gulp.task('link-wasm', ['compile-libf2c', 'compile-blas', 'compile-lapack', 'compile-lapack-install'], shell.task([
"emcc build/*.bc -o emlapack.js -O2 --memory-init-file 0 -s WASM=1 -s EXPORTED_FUNCTIONS='[" + joinNames(exportFunctions) + "]' --post-js src/export.js",
'mv emlapack.js wasm.js'
]))
gulp.task('build', ['link-asmjs', 'link-wasm'])
gulp.task('test', shell.task('mocha --recursive --colors --reporter dot'))
gulp.task('default', ['build'])