# -*- 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", "-dllimport","hammer_dotnet"]) 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, ["rm %s/*.cs" % (thisdir,), "swig $SWIGFLAGS $SOURCE"])) libhammer_dotnet = dotnetenv.SharedLibrary(['hammer_dotnet'], hammer_wrap) hammer_dll = AlwaysBuild(dotnetenv.Command(['hammer.dll'], hammer_wrap, '$CSC -t:library -out:$TARGET %s/*.cs' %(thisdir,))) Depends(hammer_dll, hammer_wrap) #hammer_dll = dotnetenv.CLILibrary('hammer.dll', dotnetenv.Glob('*.cs')) Depends(hammer_dll, hammer_wrap) Default(libhammer_dotnet, hammer_dll) dotnettestenv = dotnetenv.Clone() #dotnettestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0])) #dotnettests = ['t/hammer.t'] #dotnettestexec = dotnettestenv.Command(None, dotnettests + libhammer_dotnet + libhammer_shared, "make test -C " + targetdir) #dotnettest = Alias("testdotnet", [dotnettestexec], dotnettestexec) #AlwaysBuild(dotnettestexec) #testruns.append(dotnettest) #dotnetinstallexec = dotnetenv.Command(None, libhammer_dotnet, "make install -C " + targetdir) #dotnetinstall = Alias("installdotnet", [dotnetinstallexec], dotnetinstallexec) #targets.append(dotnetinstall)