Skip to content
This repository has been archived by the owner on Oct 25, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
[build] Linux fixes.
  • Loading branch information
tritao committed Aug 30, 2017
1 parent 0a18082 commit a7028e1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.cake
Expand Up @@ -39,7 +39,7 @@ Task("Build-Binder")
Task("Generate-Project-Files")
.Does(() =>
{
var os = IsRunningOnWindows() ? "windows" : "macosx";
var os = IsRunningOnWindows() ? "windows" : IsRunningOnMacOS() ? "macosx" : "linux";
Premake(File("./build/premake5.lua"), $"--outdir=.. --os={os}", "vs2015");
});

Expand Down
8 changes: 4 additions & 4 deletions build/Tests.cake
Expand Up @@ -91,7 +91,7 @@ Task("Generate-C")
.IsDependentOn("Build-FSharp-Generic")
.Does(() =>
{
var platform = IsRunningOnWindows() ? "Windows" : "macOS";
var platform = IsRunningOnWindows() ? "Windows" : IsRunningOnMacOS() ? "macOS" : "Linux";
var output = commonDir + Directory("c");
Exec(embeddinator, $"-gen=c -out={output} -platform={platform} -target=shared -verbose {managedDll} {fsharpManagedDll}");
});
Expand All @@ -101,7 +101,7 @@ Task("Build-C-Tests")
.Does(() =>
{
// 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";
Premake(commonDir + File("premake5.lua"), os, action);
Expand Down Expand Up @@ -162,7 +162,7 @@ Task("Generate-Java")
.IsDependentOn("Build-Managed")
.Does(() =>
{
var platform = IsRunningOnWindows() ? "Windows" : "macOS";
var platform = IsRunningOnWindows() ? "Windows" : IsRunningOnMacOS() ? "macOS" : "Linux";
var output = mkDir + Directory("java");
Exec(embeddinator, $"-gen=Java -out={output} -platform={platform} -compile -target=shared {managedDll}");
});
Expand Down Expand Up @@ -213,4 +213,4 @@ Task("Run-Java-Tests")
{
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");
});
});
9 changes: 7 additions & 2 deletions build/Utils.cake
@@ -1,3 +1,8 @@
bool IsRunningOnMacOS()
{
return true;
}

void Exec(string path, ProcessSettings settings)
{
if (path.EndsWith(".exe") && !IsRunningOnWindows())
Expand All @@ -24,6 +29,6 @@ void Exec(string path, string args = "", string workingDir = ".")
void Premake(string file, string args, string action)
{
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}");
}
}
4 changes: 2 additions & 2 deletions build/premake5.lua
Expand Up @@ -18,7 +18,7 @@ function managed_project(name)
language "C#"
location ("%{wks.location}/build/projects")

if not os.istarget("macosx") then
if os.istarget("windows") then
filter { "action:vs*" }
location "."
filter {}
Expand Down Expand Up @@ -109,4 +109,4 @@ workspace "Embeddinator-4000"
}

-- 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)

0 comments on commit a7028e1

Please sign in to comment.