Browse Source

Improved the tests-related build system scripts.

pull/1/head
triton 13 years ago
parent
commit
6d02e8bb7d
  1. 3
      build/Helpers.lua
  2. 87
      build/Tests.lua

3
build/Helpers.lua

@ -4,13 +4,14 @@ action = _ACTION or ""
depsdir = path.getabsolute("../deps"); depsdir = path.getabsolute("../deps");
srcdir = path.getabsolute("../src"); srcdir = path.getabsolute("../src");
incdir = path.getabsolute("../inc"); incdir = path.getabsolute("../include");
bindir = path.getabsolute("../bin"); bindir = path.getabsolute("../bin");
examplesdir = path.getabsolute("../examples"); examplesdir = path.getabsolute("../examples");
testsdir = path.getabsolute("../tests"); testsdir = path.getabsolute("../tests");
builddir = path.getabsolute("./" .. action); builddir = path.getabsolute("./" .. action);
libdir = path.join(builddir, "lib"); libdir = path.join(builddir, "lib");
gendir = path.join(builddir, "gen");
common_flags = { "Unicode", "Symbols" } common_flags = { "Unicode", "Symbols" }
msvc_buildflags = { } -- "/wd4190", "/wd4996", "/wd4530" msvc_buildflags = { } -- "/wd4190", "/wd4996", "/wd4530"

87
build/Tests.lua

@ -5,15 +5,20 @@ function SetupExampleProject()
location (path.join(builddir, "deps")) location (path.join(builddir, "deps"))
end end
function SetupTestGeneratorProject(name, file) function SetupTestProject(name)
project(name) SetupTestGeneratorProject(name)
SetupTestNativeProject(name)
SetupTestProjects(name)
end
function SetupTestGeneratorProject(name)
project(name .. ".Gen")
kind "ConsoleApp" kind "ConsoleApp"
language "C#" language "C#"
location "." location "."
debugdir(path.join(examplesdir, name))
files { file } files { name .. ".cs" }
links links
{ {
@ -22,28 +27,86 @@ function SetupTestGeneratorProject(name, file)
} }
end end
function SetupTestNativeProject(name, file) function SetupTestNativeProject(name)
project(name) project(name .. ".Native")
SetupNativeProject() SetupNativeProject()
kind "SharedLib" kind "SharedLib"
language "C++" language "C++"
flags { common_flags } flags { common_flags }
files { "**.h", "**.cpp" }
end
function LinkNUnit()
libdirs
{
depsdir .. "/NUnit",
depsdir .. "/NSubstitute"
}
files { file } links
{
"NUnit.Framework",
"NSubstitute"
}
end end
function SetupTestProject(name, file, lib) function SetupTestProjects(name, file, lib)
project(name) project(name .. ".CSharp")
kind "ConsoleApp" kind "SharedLib"
language "C#"
location "."
flags { "Unsafe" }
dependson { name .. ".Gen" }
files
{
path.join(gendir, name, name .. ".cs"),
}
project(name .. ".CLI")
kind "SharedLib"
language "C++"
flags { "Managed" }
dependson { name .. ".Gen" }
files
{
path.join(gendir, name, name .. ".cpp"),
path.join(gendir, name, name .. ".h"),
}
includedirs { path.join(testsdir, name), incdir }
links { name .. ".Native" }
project(name .. ".Tests.CSharp")
kind "SharedLib"
language "C#"
location "."
files { name .. ".Tests.cs" }
links { name .. ".CSharp" }
dependson { name .. ".Native" }
LinkNUnit()
project(name .. ".Tests.CLI")
kind "SharedLib"
language "C#" language "C#"
location "." location "."
files { file } files { name .. ".Tests.cs" }
links { name .. ".CLI" }
dependson { name .. ".Native" }
links { lib } LinkNUnit()
end end
function IncludeExamples() function IncludeExamples()

Loading…
Cancel
Save