aboutsummaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-10-15 04:41:58 +0000
committerDavid Robillard <d@drobilla.net>2011-10-15 04:41:58 +0000
commit7bdf853545a3d1bcaf7ae028a0409007862c3382 (patch)
tree4d3a55ef5cf4bafe7a686e66b46d41f5f1b6d6d3 /wscript
parentbb38a51d0f50b79e1b362203c7f12c9f76e7ee31 (diff)
downloadresp-7bdf853545a3d1bcaf7ae028a0409007862c3382.tar.gz
resp-7bdf853545a3d1bcaf7ae028a0409007862c3382.tar.bz2
resp-7bdf853545a3d1bcaf7ae028a0409007862c3382.zip
Waf build system
git-svn-id: http://svn.drobilla.net/resp/trunk@432 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'wscript')
-rw-r--r--wscript114
1 files changed, 114 insertions, 0 deletions
diff --git a/wscript b/wscript
new file mode 100644
index 0000000..f7054a2
--- /dev/null
+++ b/wscript
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+import filecmp
+import glob
+import os
+import shutil
+import subprocess
+import sys
+
+from waflib.extras import autowaf as autowaf
+import waflib.Logs as Logs, waflib.Options as Options
+
+# Version of this package (even if built as a child)
+RESP_VERSION = '0.0.0'
+RESP_MAJOR_VERSION = '0'
+
+# Library version (UNIX style major, minor, micro)
+# major increment <=> incompatible changes
+# minor increment <=> compatible changes (additions)
+# micro increment <=> no interface changes
+# Resp uses the same version number for both library and package
+RESP_LIB_VERSION = RESP_VERSION
+
+# Variables for 'waf dist'
+APPNAME = 'resp'
+VERSION = RESP_VERSION
+
+# Mandatory variables
+top = '.'
+out = 'build'
+
+def options(opt):
+ opt.load('compiler_c')
+ opt.load('compiler_cxx')
+ autowaf.set_options(opt)
+
+def configure(conf):
+ conf.load('compiler_c')
+ conf.load('compiler_cxx')
+ autowaf.configure(conf)
+ autowaf.display_header('Resp Configuration')
+
+ conf.env.append_unique('CFLAGS', '-std=c99')
+
+ conf.check_cfg(
+ path = 'llvm-config-2.9',
+ args = '--cppflags --ldflags --libs core jit native codegen ipo',
+ package = '',
+ uselib_store = 'LLVM',
+ mandatory = False)
+
+ if not conf.is_defined('HAVE_LLVM'):
+ conf.check_cfg(
+ path = 'llvm-config-2.8',
+ args = '--cppflags --ldflags --libs core jit native codegen ipo',
+ package = '',
+ uselib_store = 'LLVM',
+ mandatory = True)
+
+def build(bld):
+ source = '''
+ src/compile.cpp
+ src/constrain.cpp
+ src/cps.cpp
+ src/expand.cpp
+ src/flatten.cpp
+ src/gc.cpp
+ src/lift.cpp
+ src/parse.cpp
+ src/pprint.cpp
+ src/repl.cpp
+ src/resp.cpp
+ src/simplify.cpp
+ src/tlsf.c
+ src/unify.cpp
+ src/llvm.cpp
+ '''
+
+ obj = bld(features = 'cxx cxxprogram',
+ source = source,
+ target = 'resp',
+ uselib = 'LLVM',
+ linkflags = ['-rdynamic'])
+
+def test(ctx):
+ def run_test(prog, correct_out):
+ out = subprocess.check_output(['./build/resp', prog]).strip()
+ if out == correct_out:
+ Logs.info("PASS: %s" % prog)
+ else:
+ Logs.error("FAIL: %s" % prog)
+ Logs.error("Expected: %s" % correct_out)
+ Logs.error("Got: %s" % out)
+
+ # Basic lexical sanity
+ run_test('./test/def.resp', '4 : Int')
+ run_test('./test/deffn.resp', '3 : Int')
+ run_test('./test/inlinefn.resp', '2 : Int')
+ run_test('./test/nest.resp', '8 : Int')
+
+ # Basic data types
+ run_test('./test/string.resp', '"Hello, world!" : String')
+ run_test('./test/tup.resp', '5 : Int')
+
+ # Recursive arithmetic functions
+ run_test('./test/fac.resp', '720 : Int')
+ run_test('./test/ack.resp', '8189 : Int')
+
+ # Closures
+ run_test('./test/closure.resp', '6 : Int')
+ run_test('./test/let-over-fn.resp', '2 : Int')
+ run_test('./test/let.resp', '5 : Int')
+
+ # Algebraic data types
+ run_test('./test/match.resp', '12.0000 : Float')