mirror of https://github.com/mono/CppSharp.git
c-sharpdotnetmonobindingsbridgecclangcpluspluscppsharpglueinteropparserparsingpinvokeswigsyntax-treevisitorsxamarinxamarin-bindings
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
159 lines
3.2 KiB
159 lines
3.2 KiB
-- Tests/examples helpers |
|
|
|
function SetupExampleProject() |
|
kind "ConsoleApp" |
|
language "C#" |
|
debugdir "." |
|
|
|
files { "**.cs", "./*.lua" } |
|
links { "CppSharp.AST", "CppSharp.Generator" } |
|
|
|
SetupManagedProject() |
|
SetupParser() |
|
end |
|
|
|
function SetupTestProject(name, file, lib) |
|
SetupTestGeneratorProject(name) |
|
SetupTestNativeProject(name) |
|
SetupTestProjectsCSharp(name, file, lib) |
|
SetupTestProjectsCLI(name, file, lib) |
|
end |
|
|
|
function SetupTestCSharp(name) |
|
SetupTestGeneratorProject(name) |
|
SetupTestNativeProject(name) |
|
SetupTestProjectsCSharp(name) |
|
end |
|
|
|
function SetupTestCLI(name) |
|
SetupTestGeneratorProject(name) |
|
SetupTestNativeProject(name) |
|
SetupTestProjectsCLI(name) |
|
end |
|
|
|
function SetupManagedTestProject() |
|
kind "SharedLib" |
|
language "C#" |
|
flags { "Unsafe" } |
|
SetupManagedProject() |
|
end |
|
|
|
function SetupTestGeneratorProject(name) |
|
project(name .. ".Gen") |
|
SetupManagedTestProject() |
|
kind "ConsoleApp" |
|
|
|
files { name .. ".cs" } |
|
|
|
dependson { name .. ".Native" } |
|
|
|
links |
|
{ |
|
"CppSharp.AST", |
|
"CppSharp.Generator", |
|
"CppSharp.Generator.Tests" |
|
} |
|
|
|
SetupParser() |
|
end |
|
|
|
function SetupTestGeneratorBuildEvent(name) |
|
if string.starts(action, "vs") then |
|
local exePath = SafePath("$(TargetDir)" .. name .. ".Gen.exe") |
|
prebuildcommands { exePath } |
|
else |
|
local exePath = SafePath("%{cfg.buildtarget.directory}/" .. name .. ".Gen.exe") |
|
prebuildcommands { "mono " .. exePath } |
|
end |
|
end |
|
|
|
function SetupTestNativeProject(name) |
|
project(name .. ".Native") |
|
|
|
SetupNativeProject() |
|
|
|
kind "SharedLib" |
|
language "C++" |
|
|
|
flags { common_flags } |
|
files { "**.h", "**.cpp" } |
|
end |
|
|
|
function LinkNUnit() |
|
libdirs |
|
{ |
|
depsdir .. "/NUnit", |
|
depsdir .. "/NSubstitute" |
|
} |
|
|
|
links |
|
{ |
|
"NUnit.Framework", |
|
"NSubstitute" |
|
} |
|
end |
|
|
|
function SetupTestProjectsCSharp(name, file, lib) |
|
project(name .. ".CSharp") |
|
SetupManagedTestProject() |
|
|
|
dependson { name .. ".Gen", name .. ".Native" } |
|
SetupTestGeneratorBuildEvent(name) |
|
|
|
files |
|
{ |
|
path.join(gendir, name, name .. ".cs"), |
|
} |
|
|
|
links { "CppSharp.Runtime" } |
|
|
|
project(name .. ".Tests.CSharp") |
|
SetupManagedTestProject() |
|
|
|
files { name .. ".Tests.cs" } |
|
links { name .. ".CSharp", "CppSharp.Generator.Tests" } |
|
dependson { name .. ".Native" } |
|
|
|
LinkNUnit() |
|
links { "CppSharp.Runtime" } |
|
end |
|
|
|
function SetupTestProjectsCLI(name, file, lib) |
|
project(name .. ".CLI") |
|
SetupNativeProject() |
|
|
|
kind "SharedLib" |
|
language "C++" |
|
flags { "Managed" } |
|
|
|
dependson { name .. ".Gen", name .. ".Native" } |
|
SetupTestGeneratorBuildEvent(name) |
|
|
|
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.CLI") |
|
SetupManagedTestProject() |
|
|
|
files { name .. ".Tests.cs" } |
|
links { name .. ".CLI", "CppSharp.Generator.Tests" } |
|
dependson { name .. ".Native" } |
|
|
|
LinkNUnit() |
|
end |
|
|
|
function IncludeExamples() |
|
print("Searching for examples...") |
|
IncludeDir(examplesdir) |
|
end |
|
|
|
function IncludeTests() |
|
print("Searching for tests...") |
|
IncludeDir(testsdir) |
|
end |