-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add base macOS and Linux instructions
- Loading branch information
Showing
2 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,36 @@ | ||
|
||
using Cake.Cli; | ||
using Cake.Common.Diagnostics; | ||
|
||
namespace BuildScripts; | ||
|
||
[TaskName("Build macOS")] | ||
[IsDependentOn(typeof(PrepTask))] | ||
public sealed class BuildMacOSTask : FrostingTask<BuildContext> | ||
{ | ||
public override bool ShouldRun(BuildContext context) => context.IsRunningOnMacOs(); | ||
|
||
public override void Run(BuildContext context) | ||
{ | ||
|
||
// Make sure it statically links the dpeendencies | ||
context.ReplaceTextInFiles("freetype/CMakeLists.txt", "# Find dependencies", "set(CMAKE_FIND_LIBRARY_SUFFIXES \".a\")"); | ||
|
||
// Build | ||
var buildDir = "freetype/build"; | ||
context.CreateDirectory(buildDir); | ||
context.StartProcess("cmake", new ProcessSettings { WorkingDirectory = buildDir, Arguments = "../ -DBUILD_SHARED_LIBS=true -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 -DFT_DISABLE_HARFBUZZ=TRUE -DCMAKE_BUILD_TYPE=Release" }); | ||
context.StartProcess("make", new ProcessSettings { WorkingDirectory = buildDir }); | ||
|
||
foreach (var filePath in Directory.GetFiles("freetype/build")) | ||
{ | ||
if (!filePath.EndsWith(".dylib") || | ||
File.GetAttributes(filePath).HasFlag(FileAttributes.ReparsePoint)) | ||
continue; | ||
|
||
context.CopyFile(filePath, $"{context.ArtifactsDir}/libfreetype.dylib"); | ||
return; | ||
} | ||
|
||
throw new Exception("No built library found :("); | ||
} | ||
} |