|
1 |
| -// Licensed to the .NET Foundation under one or more agreements. |
| 1 | +// Licensed to the .NET Foundation under one or more agreements. |
2 | 2 | // The .NET Foundation licenses this file to you under the MIT license.
|
3 | 3 |
|
4 | 4 | using System;
|
@@ -99,4 +99,64 @@ string AndroidHome
|
99 | 99 | }
|
100 | 100 | )
|
101 | 101 | );
|
| 102 | + |
| 103 | + AbsolutePath GLFWPath => RootDirectory / "build" / "submodules" / "GLFW"; |
| 104 | + Target GLFW => CommonTarget |
| 105 | + ( |
| 106 | + x => x.Before(Compile) |
| 107 | + .Executes |
| 108 | + ( |
| 109 | + () => |
| 110 | + { |
| 111 | + var @out = GLFWPath / "build"; |
| 112 | + var prepare = "cmake -S. -B build -D BUILD_SHARED_LIBS=ON"; |
| 113 | + var build = "cmake --build build --config Release"; |
| 114 | + EnsureCleanDirectory(@out); |
| 115 | + var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.GLFW.Native" / "runtimes"; |
| 116 | + if (OperatingSystem.IsWindows()) |
| 117 | + { |
| 118 | + InheritedShell($"{prepare} -A X64", GLFWPath) |
| 119 | + .AssertZeroExitCode(); |
| 120 | + InheritedShell(build, GLFWPath) |
| 121 | + .AssertZeroExitCode(); |
| 122 | + CopyAll(@out.GlobFiles("src/Release/glfw3.dll"), runtimes / "win-x64" / "native"); |
| 123 | + |
| 124 | + EnsureCleanDirectory(@out); |
| 125 | + |
| 126 | + InheritedShell($"{prepare} -A Win32", GLFWPath) |
| 127 | + .AssertZeroExitCode(); |
| 128 | + InheritedShell(build, GLFWPath) |
| 129 | + .AssertZeroExitCode(); |
| 130 | + |
| 131 | + CopyAll(@out.GlobFiles("src/Release/glfw3.dll"), runtimes / "win-x86" / "native"); |
| 132 | + } |
| 133 | + else if (OperatingSystem.IsLinux()) |
| 134 | + { |
| 135 | + InheritedShell($"{prepare} -DCMAKE_SYSTEM_PROCESSOR=x86_64", GLFWPath) |
| 136 | + .AssertZeroExitCode(); |
| 137 | + InheritedShell(build, GLFWPath) |
| 138 | + .AssertZeroExitCode(); |
| 139 | + CopyAll(@out.GlobFiles("src/libglfw.so"), runtimes / "linux-x64" / "native"); |
| 140 | + } |
| 141 | + else if (OperatingSystem.IsMacOS()) |
| 142 | + { |
| 143 | + InheritedShell($"{prepare} -DCMAKE_OSX_ARCHITECTURES=x86_64", GLFWPath) |
| 144 | + .AssertZeroExitCode(); |
| 145 | + InheritedShell(build, GLFWPath) |
| 146 | + .AssertZeroExitCode(); |
| 147 | + CopyAll(@out.GlobFiles("src/libglfw.3.dylib"), runtimes / "osx-x64" / "native"); |
| 148 | + |
| 149 | + EnsureCleanDirectory(@out); |
| 150 | + |
| 151 | + InheritedShell($"{prepare} -DCMAKE_OSX_ARCHITECTURES=arm64", GLFWPath) |
| 152 | + .AssertZeroExitCode(); |
| 153 | + InheritedShell(build, GLFWPath) |
| 154 | + .AssertZeroExitCode(); |
| 155 | + |
| 156 | + CopyAll(@out.GlobFiles("src/libglfw.3.dylib"), runtimes / "osx-arm64" / "native"); |
| 157 | + } |
| 158 | + } |
| 159 | + ) |
| 160 | + ); |
| 161 | + |
102 | 162 | }
|
0 commit comments