This commit is contained in:
Joao Matos 2017-08-30 19:13:13 +01:00
Родитель 0a18082f18
Коммит a7028e1646
4 изменённых файлов: 14 добавлений и 9 удалений

Просмотреть файл

@ -39,7 +39,7 @@ Task("Build-Binder")
Task("Generate-Project-Files") Task("Generate-Project-Files")
.Does(() => .Does(() =>
{ {
var os = IsRunningOnWindows() ? "windows" : "macosx"; var os = IsRunningOnWindows() ? "windows" : IsRunningOnMacOS() ? "macosx" : "linux";
Premake(File("./build/premake5.lua"), $"--outdir=.. --os={os}", "vs2015"); Premake(File("./build/premake5.lua"), $"--outdir=.. --os={os}", "vs2015");
}); });

Просмотреть файл

@ -91,7 +91,7 @@ Task("Generate-C")
.IsDependentOn("Build-FSharp-Generic") .IsDependentOn("Build-FSharp-Generic")
.Does(() => .Does(() =>
{ {
var platform = IsRunningOnWindows() ? "Windows" : "macOS"; var platform = IsRunningOnWindows() ? "Windows" : IsRunningOnMacOS() ? "macOS" : "Linux";
var output = commonDir + Directory("c"); var output = commonDir + Directory("c");
Exec(embeddinator, $"-gen=c -out={output} -platform={platform} -target=shared -verbose {managedDll} {fsharpManagedDll}"); Exec(embeddinator, $"-gen=c -out={output} -platform={platform} -target=shared -verbose {managedDll} {fsharpManagedDll}");
}); });
@ -101,7 +101,7 @@ Task("Build-C-Tests")
.Does(() => .Does(() =>
{ {
// Generate native project build files using Premake. // Generate native project build files using Premake.
var os = IsRunningOnWindows() ? "--os=windows" : "--os=macosx"; var os = IsRunningOnWindows() ? "--os=windows" : IsRunningOnMacOS() ? "--os=macosx" : "--os=linux";
var action = IsRunningOnWindows() ? "vs2015" : "gmake"; var action = IsRunningOnWindows() ? "vs2015" : "gmake";
Premake(commonDir + File("premake5.lua"), os, action); Premake(commonDir + File("premake5.lua"), os, action);
@ -162,7 +162,7 @@ Task("Generate-Java")
.IsDependentOn("Build-Managed") .IsDependentOn("Build-Managed")
.Does(() => .Does(() =>
{ {
var platform = IsRunningOnWindows() ? "Windows" : "macOS"; var platform = IsRunningOnWindows() ? "Windows" : IsRunningOnMacOS() ? "macOS" : "Linux";
var output = mkDir + Directory("java"); var output = mkDir + Directory("java");
Exec(embeddinator, $"-gen=Java -out={output} -platform={platform} -compile -target=shared {managedDll}"); Exec(embeddinator, $"-gen=Java -out={output} -platform={platform} -compile -target=shared {managedDll}");
}); });
@ -213,4 +213,4 @@ Task("Run-Java-Tests")
{ {
var java = Directory(javaHome) + File("bin/java"); var java = Directory(javaHome) + File("bin/java");
Exec(java, $"-cp {classPath} -Djna.dump_memory=true -Djna.nosys=true org.junit.runner.JUnitCore mono.embeddinator.Tests"); Exec(java, $"-cp {classPath} -Djna.dump_memory=true -Djna.nosys=true org.junit.runner.JUnitCore mono.embeddinator.Tests");
}); });

Просмотреть файл

@ -1,3 +1,8 @@
bool IsRunningOnMacOS()
{
return true;
}
void Exec(string path, ProcessSettings settings) void Exec(string path, ProcessSettings settings)
{ {
if (path.EndsWith(".exe") && !IsRunningOnWindows()) if (path.EndsWith(".exe") && !IsRunningOnWindows())
@ -24,6 +29,6 @@ void Exec(string path, string args = "", string workingDir = ".")
void Premake(string file, string args, string action) void Premake(string file, string args, string action)
{ {
var premakePath = Directory("./external/CppSharp/build/") + (IsRunningOnWindows() ? var premakePath = Directory("./external/CppSharp/build/") + (IsRunningOnWindows() ?
File("premake5.exe") : File("premake5-osx")); File("premake5.exe") : IsRunningOnMacOS() ? File("premake5-osx") : File("premake5-linux-64"));
Exec(premakePath, $"--file={file} {args} {action}"); Exec(premakePath, $"--file={file} {args} {action}");
} }

Просмотреть файл

@ -18,7 +18,7 @@ function managed_project(name)
language "C#" language "C#"
location ("%{wks.location}/build/projects") location ("%{wks.location}/build/projects")
if not os.istarget("macosx") then if os.istarget("windows") then
filter { "action:vs*" } filter { "action:vs*" }
location "." location "."
filter {} filter {}
@ -109,4 +109,4 @@ workspace "Embeddinator-4000"
} }
-- Override VS solution generation so we do not generate anything. -- Override VS solution generation so we do not generate anything.
premake.override(premake.vstudio.vs2005, "generateSolution", function(base, wks) end) premake.override(premake.vstudio.vs2005, "generateSolution", function(base, wks) end)