2013-12-09 13:54:23 +01:00
|
|
|
# -*- python -*-
|
|
|
|
|
import os.path
|
|
|
|
|
Import("env libhammer_shared testruns targets")
|
|
|
|
|
|
|
|
|
|
dotnetenv = env.Clone()
|
|
|
|
|
|
|
|
|
|
dotnetenv.Append(CCFLAGS=["-fpic", '-DSWIG', '-Wno-all',
|
|
|
|
|
'-Wno-extra', '-Wno-error',
|
|
|
|
|
'-DHAMMER_INTERNAL__NO_STDARG_H'],
|
|
|
|
|
CPPPATH=["../.."],
|
|
|
|
|
LIBS=['hammer'],
|
|
|
|
|
LIBPATH=["../.."],
|
|
|
|
|
SWIGFLAGS=["-DHAMMER_INTERNAL__NO_STDARG_H",
|
|
|
|
|
"-Isrc/", "-csharp",
|
2013-12-16 15:52:24 +01:00
|
|
|
"-dllimport","hammer_dotnet",
|
|
|
|
|
"-namespace", "Hammer.Internal"])
|
2013-12-09 13:54:23 +01:00
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
swig = ['hammer.i']
|
|
|
|
|
thisdir = os.path.join(os.path.dirname(str(libhammer_shared[0])), "bindings","dotnet")
|
|
|
|
|
csfiles = os.path.join(thisdir, "*.cs")
|
|
|
|
|
|
|
|
|
|
# These AlwaysBuilds are annoying, but alas there doesn't seem to be a
|
|
|
|
|
# better way. I'd love to be corrected. Send PRs!
|
|
|
|
|
|
|
|
|
|
# This also generates a bunch of .cs files, which we'll just use this
|
|
|
|
|
# target to stand in for.
|
|
|
|
|
hammer_wrap = AlwaysBuild(dotnetenv.Command(['hammer_wrap.c'], swig,
|
2013-12-16 15:52:24 +01:00
|
|
|
["rm %s/*.cs || true" % (thisdir,),
|
2013-12-09 13:54:23 +01:00
|
|
|
"swig $SWIGFLAGS $SOURCE"]))
|
|
|
|
|
libhammer_dotnet = dotnetenv.SharedLibrary(['hammer_dotnet'], hammer_wrap)
|
2013-12-16 15:52:24 +01:00
|
|
|
hammer_dll = AlwaysBuild(dotnetenv.Command(['hammer.dll'], Glob('ext/*.cs'),
|
|
|
|
|
'$CSC -t:library -unsafe -out:$TARGET %s/*.cs $SOURCE' %(thisdir,)))
|
2013-12-09 13:54:23 +01:00
|
|
|
Depends(hammer_dll, hammer_wrap)
|
2013-12-16 15:52:24 +01:00
|
|
|
#hammer_dll = dotnetenv.CLILibrary('hammer.dll', hammer.cs)
|
2013-12-09 13:54:23 +01:00
|
|
|
Default(libhammer_dotnet, hammer_dll)
|
|
|
|
|
|
|
|
|
|
dotnettestenv = dotnetenv.Clone()
|
2013-12-16 15:52:24 +01:00
|
|
|
|
2013-12-09 13:54:23 +01:00
|
|
|
#dotnettestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0]))
|
|
|
|
|
#dotnettests = ['t/hammer.t']
|
2013-12-16 18:47:42 +01:00
|
|
|
dotnettestenv.Append(CILLIBS=['/usr/lib/cli/nunit.core-2.6/nunit.core.dll','/usr/lib/cli/nunit.util-2.6/nunit.util.dll','/usr/lib/cli/nunit.framework-2.6/nunit.framework.dll','/usr/lib/cli/nunit.core.interfaces-2.6/nunit.core.interfaces.dll', "src/bindings/dotnet/hammer.dll"])
|
2013-12-16 15:52:24 +01:00
|
|
|
dotnettestlib = dotnettestenv.CLILibrary('hammer_test.dll', Glob('test/*.cs'))
|
2013-12-16 18:47:42 +01:00
|
|
|
Depends(dotnettestlib, hammer_dll)
|
|
|
|
|
|
|
|
|
|
dotnettestexec = dotnettestenv.Command(None, dotnettestlib, "nunit-console $SOURCE")
|
|
|
|
|
dotnettest = Alias("testdotnet", [dotnettestexec], dotnettestexec)
|
|
|
|
|
AlwaysBuild(dotnettestexec)
|
2013-12-16 15:52:24 +01:00
|
|
|
testruns.append(dotnettestlib)
|
2013-12-09 13:54:23 +01:00
|
|
|
|
|
|
|
|
#dotnetinstallexec = dotnetenv.Command(None, libhammer_dotnet, "make install -C " + targetdir)
|
|
|
|
|
#dotnetinstall = Alias("installdotnet", [dotnetinstallexec], dotnetinstallexec)
|
|
|
|
|
#targets.append(dotnetinstall)
|