From 54db4394f3f3fbe705774fd73fe74bb1f41e84e2 Mon Sep 17 00:00:00 2001 From: mikko Date: Thu, 27 Jan 2022 16:17:31 +0200 Subject: [PATCH 01/14] Start working with native builds --- .github/workflows/GLFW.yml | 45 +++++++++++++++++++++++++++++++++++++ .gitmodules | 3 +++ build/nuke/Build.Native.cs | 37 ++++++++++++++++++++++++++++++ build/nuke/Build.Support.cs | 35 +++++++++++++++++++++++++++++ build/submodules/GLFW | 1 + 5 files changed, 121 insertions(+) create mode 100644 .github/workflows/GLFW.yml create mode 160000 build/submodules/GLFW diff --git a/.github/workflows/GLFW.yml b/.github/workflows/GLFW.yml new file mode 100644 index 0000000000..dfbde87400 --- /dev/null +++ b/.github/workflows/GLFW.yml @@ -0,0 +1,45 @@ +name: glfw + on: + push: + paths: + - build/submodules/GLFW + - build/nuke/Build.Native.cs + branches-ignore: + - "ci/*" + - "develop/*" + - "main" + jobs: + Build: + strategy: + fail-fast: false + matrix: + env: + - os: ubuntu-latest + name: Linux + nuke_invoke: ./build.sh + extras: | + sudo apt-get install -y xorg-dev + - os: windows-latest + name: Windows + nuke_invoke: ./build.cmd + extras: "" + - os: macos-latest + name: Darwin + nuke_invoke: ./build.sh + extras: "" + name: ${{ matrix.env.name }} Build + runs-on: ${{ matrix.env.os }} + steps: + - uses: actions/checkout@v2 + - name: Extra prerequisites + run: | + echo running extras + ${{ matrix.env.extras }} + - name: Setup .NET 6.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.100 + - name: Build GLFW + run: ${{ matrix.env.nuke_invoke }} glfw + env: + diff --git a/.gitmodules b/.gitmodules index a916c433be..8cc8960770 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "build/submodules/Vulkan-Headers"] path = build/submodules/Vulkan-Headers url = https://github.com/KhronosGroup/Vulkan-Headers +[submodule "build/submodules/GLFW"] + path = build/submodules/GLFW + url = https://github.com/glfw/glfw.git diff --git a/build/nuke/Build.Native.cs b/build/nuke/Build.Native.cs index 64682d5f3a..6c6780f604 100644 --- a/build/nuke/Build.Native.cs +++ b/build/nuke/Build.Native.cs @@ -99,4 +99,41 @@ string AndroidHome } ) ); + + AbsolutePath GLFWPath => RootDirectory / "build" / "submodules" / "GLFW"; + Target GLFW => CommonTarget + ( + x => x.Before(Compile) + .Executes + ( + () => + { + var @out = GLFWPath / "build"; + EnsureCleanDirectory(@out); + var abi = OperatingSystem.IsWindows() ? " -DCMAKE_GENERATOR_PLATFORM=Win32" : string.Empty; + InheritedShell + ( + $"cmake -S . -B build/ -D BUILD_SHARED_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release{abi}", + GLFWPath + ).AssertZeroExitCode(); + InheritedShell("cmake --build build --config Release", GLFWPath) + .AssertZeroExitCode(); + var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.GLFW.Native" / "runtimes"; + if (OperatingSystem.IsWindows()) + { + CopyAll(@out.GlobFiles("Release/glfw3.dll"), runtimes / "win-x64" / "native"); + CopyAll(@out.GlobFiles("Release/glfw3.dll"), runtimes / "win-x86" / "native"); + } + else + { + CopyAll + ( + @out.GlobFiles("libglfw.so.3", "libglfw.3.dylib"), + runtimes / (OperatingSystem.IsMacOS() ? "osx-x64" : "linux-x64") / "native" + ); + } + } + ) + ); + } diff --git a/build/nuke/Build.Support.cs b/build/nuke/Build.Support.cs index b4b58af330..83fc43b515 100644 --- a/build/nuke/Build.Support.cs +++ b/build/nuke/Build.Support.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; @@ -14,6 +15,10 @@ using Nuke.Common.CI.GitHubActions; using Nuke.Common.IO; using Nuke.Common.ProjectModel; +using Nuke.Common.Tooling; +using Nuke.Common.Utilities; +using static Nuke.Common.IO.FileSystemTasks; +using static Nuke.Common.Tooling.ProcessTasks; using Octokit; using Octokit.Internal; @@ -38,6 +43,36 @@ static int IndexOfOrThrow(string x, char y) return idx; } + Dictionary CreateEnvVarDictionary() + => Environment.GetEnvironmentVariables() + .Cast() + .ToDictionary(x => (string) x.Key, x => (string) x.Value); + + IProcess InheritedShell(string cmd, [CanBeNull] string workDir = null) + => OperatingSystem.IsWindows() + ? StartProcess("powershell", $"-Command {cmd.DoubleQuote()}", workDir, CreateEnvVarDictionary()) + : StartProcess("bash", $"-c {cmd.DoubleQuote()}", workDir, CreateEnvVarDictionary()); + + void AddToPath(string dir) + { + var pathVar = Environment.GetEnvironmentVariables() + .Cast() + .First(x => ((string) x.Key).Equals("PATH", StringComparison.OrdinalIgnoreCase)); + Environment.SetEnvironmentVariable + ( + (string) pathVar.Key, + (string) pathVar.Value + (OperatingSystem.IsWindows() ? $";{dir}" : $":{dir}") + ); + } + + static void CopyAll(IEnumerable paths, AbsolutePath dir) + { + foreach (var path in paths) + { + CopyFile(path, dir / Path.GetFileName(path), FileExistsPolicy.Overwrite); + } + } + [Nuke.Common.Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] readonly string Configuration = IsLocalBuild ? "Debug" : "Release"; diff --git a/build/submodules/GLFW b/build/submodules/GLFW new file mode 160000 index 0000000000..df8d7bc892 --- /dev/null +++ b/build/submodules/GLFW @@ -0,0 +1 @@ +Subproject commit df8d7bc892937a8b0f7c604c92a9f64f383cf48c From 4b4c462cc1cacdc4f1c67f09cac05a5759b34663 Mon Sep 17 00:00:00 2001 From: mikko Date: Thu, 27 Jan 2022 16:22:28 +0200 Subject: [PATCH 02/14] gh actions now? --- .github/workflows/GLFW.yml | 86 +++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 44 deletions(-) diff --git a/.github/workflows/GLFW.yml b/.github/workflows/GLFW.yml index dfbde87400..3b0ded4bb8 100644 --- a/.github/workflows/GLFW.yml +++ b/.github/workflows/GLFW.yml @@ -1,45 +1,43 @@ name: glfw - on: - push: - paths: - - build/submodules/GLFW - - build/nuke/Build.Native.cs - branches-ignore: - - "ci/*" - - "develop/*" - - "main" - jobs: - Build: - strategy: - fail-fast: false - matrix: - env: - - os: ubuntu-latest - name: Linux - nuke_invoke: ./build.sh - extras: | - sudo apt-get install -y xorg-dev - - os: windows-latest - name: Windows - nuke_invoke: ./build.cmd - extras: "" - - os: macos-latest - name: Darwin - nuke_invoke: ./build.sh - extras: "" - name: ${{ matrix.env.name }} Build - runs-on: ${{ matrix.env.os }} - steps: - - uses: actions/checkout@v2 - - name: Extra prerequisites - run: | - echo running extras - ${{ matrix.env.extras }} - - name: Setup .NET 6.0 - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 6.0.100 - - name: Build GLFW - run: ${{ matrix.env.nuke_invoke }} glfw - env: - +on: + push: + paths: + - build/submodules/GLFW + - build/nuke/Build.Native.cs + branches-ignore: + - "ci/*" + - "develop/*" + - "main" +jobs: + Build: + strategy: + fail-fast: false + matrix: + env: + - os: ubuntu-latest + name: Linux + nuke_invoke: ./build.sh + extras: | + sudo apt-get install -y xorg-dev + - os: windows-latest + name: Windows + nuke_invoke: ./build.cmd + extras: "" + - os: macos-latest + name: Darwin + nuke_invoke: ./build.sh + extras: "" + name: ${{ matrix.env.name }} Build + runs-on: ${{ matrix.env.os }} + steps: + - uses: actions/checkout@v2 + - name: Extra prerequisites + run: | + echo running extras + ${{ matrix.env.extras }} + - name: Setup .NET 6.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.100 + - name: Build GLFW + run: ${{ matrix.env.nuke_invoke }} glfw From 348256cc285596e923e95d4d45fdf3e39902ac19 Mon Sep 17 00:00:00 2001 From: mikko Date: Thu, 27 Jan 2022 16:28:53 +0200 Subject: [PATCH 03/14] now? --- .github/workflows/GLFW.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/GLFW.yml b/.github/workflows/GLFW.yml index 3b0ded4bb8..741868ebc6 100644 --- a/.github/workflows/GLFW.yml +++ b/.github/workflows/GLFW.yml @@ -1,9 +1,6 @@ name: glfw on: push: - paths: - - build/submodules/GLFW - - build/nuke/Build.Native.cs branches-ignore: - "ci/*" - "develop/*" From 3bb11b671bc04efd68635e3870d3b304acea8364 Mon Sep 17 00:00:00 2001 From: roeyskoe <26493216+roeyskoe@users.noreply.github.com> Date: Thu, 27 Jan 2022 16:37:33 +0200 Subject: [PATCH 04/14] Actually get the submodules... --- .github/workflows/GLFW.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/GLFW.yml b/.github/workflows/GLFW.yml index 741868ebc6..20977a42e1 100644 --- a/.github/workflows/GLFW.yml +++ b/.github/workflows/GLFW.yml @@ -28,6 +28,9 @@ jobs: runs-on: ${{ matrix.env.os }} steps: - uses: actions/checkout@v2 + - name: Checkout submodules + run: | + git -c submodule.third_party/git-hooks.update=none submodule update --init --recursive - name: Extra prerequisites run: | echo running extras From dc9dfd989a08c3b2ebd735eacf24d73698a44d6a Mon Sep 17 00:00:00 2001 From: mikko Date: Thu, 27 Jan 2022 17:09:16 +0200 Subject: [PATCH 05/14] It now actually kinda does something --- build/nuke/Build.Native.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/nuke/Build.Native.cs b/build/nuke/Build.Native.cs index 6c6780f604..679eda7d68 100644 --- a/build/nuke/Build.Native.cs +++ b/build/nuke/Build.Native.cs @@ -113,10 +113,10 @@ string AndroidHome var abi = OperatingSystem.IsWindows() ? " -DCMAKE_GENERATOR_PLATFORM=Win32" : string.Empty; InheritedShell ( - $"cmake -S . -B build/ -D BUILD_SHARED_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release{abi}", + $"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release{abi}", GLFWPath ).AssertZeroExitCode(); - InheritedShell("cmake --build build --config Release", GLFWPath) + InheritedShell("cmake --build build", GLFWPath) .AssertZeroExitCode(); var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.GLFW.Native" / "runtimes"; if (OperatingSystem.IsWindows()) From f8fe77c4e572184d54fe6f737dec637628c4505f Mon Sep 17 00:00:00 2001 From: roeyskoe <26493216+roeyskoe@users.noreply.github.com> Date: Thu, 27 Jan 2022 18:45:13 +0200 Subject: [PATCH 06/14] Save artifacts for testing --- .github/workflows/GLFW.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/GLFW.yml b/.github/workflows/GLFW.yml index 20977a42e1..1b2f7194da 100644 --- a/.github/workflows/GLFW.yml +++ b/.github/workflows/GLFW.yml @@ -41,3 +41,6 @@ jobs: dotnet-version: 6.0.100 - name: Build GLFW run: ${{ matrix.env.nuke_invoke }} glfw + - uses: actions/upload-artifact@v2 + with: + path: build/submodules/GLFW/build/src From f88fa0c95603c51fdcc429811cb25a756e2ba618 Mon Sep 17 00:00:00 2001 From: mikko Date: Thu, 27 Jan 2022 19:46:15 +0200 Subject: [PATCH 07/14] Not the prettiest, but may actually work --- build/nuke/Build.Native.cs | 62 +++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/build/nuke/Build.Native.cs b/build/nuke/Build.Native.cs index 679eda7d68..71d2c34881 100644 --- a/build/nuke/Build.Native.cs +++ b/build/nuke/Build.Native.cs @@ -110,28 +110,60 @@ string AndroidHome { var @out = GLFWPath / "build"; EnsureCleanDirectory(@out); - var abi = OperatingSystem.IsWindows() ? " -DCMAKE_GENERATOR_PLATFORM=Win32" : string.Empty; - InheritedShell - ( - $"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release{abi}", - GLFWPath - ).AssertZeroExitCode(); - InheritedShell("cmake --build build", GLFWPath) - .AssertZeroExitCode(); - var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.GLFW.Native" / "runtimes"; + var runtimes = GLFWPath / "compiled"; // testing if (OperatingSystem.IsWindows()) { + InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -A X64", GLFWPath) + .AssertZeroExitCode(); + InheritedShell("cmake --build build", GLFWPath) + .AssertZeroExitCode(); CopyAll(@out.GlobFiles("Release/glfw3.dll"), runtimes / "win-x64" / "native"); + + EnsureCleanDirectory(@out); + + InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -A Win32", GLFWPath) + .AssertZeroExitCode(); + InheritedShell("cmake --build build", GLFWPath) + .AssertZeroExitCode(); + CopyAll(@out.GlobFiles("Release/glfw3.dll"), runtimes / "win-x86" / "native"); } - else + else if (OperatingSystem.IsLinux()) { - CopyAll - ( - @out.GlobFiles("libglfw.so.3", "libglfw.3.dylib"), - runtimes / (OperatingSystem.IsMacOS() ? "osx-x64" : "linux-x64") / "native" - ); + InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -A -m64", GLFWPath) + .AssertZeroExitCode(); + InheritedShell("cmake --build build", GLFWPath) + .AssertZeroExitCode(); + CopyAll(@out.GlobFiles("libglfw.so"), runtimes / "linux-x64" / "native"); + + EnsureCleanDirectory(@out); + + InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -A -m32", GLFWPath) + .AssertZeroExitCode(); + InheritedShell("cmake --build build", GLFWPath) + .AssertZeroExitCode(); + + CopyAll(@out.GlobFiles("libglfw.so"), runtimes / "linux-x86" / "native"); + } + else if (OperatingSystem.IsMacOS()) + { + InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES=x86_64", GLFWPath) + .AssertZeroExitCode(); + InheritedShell("cmake --build build", GLFWPath) + .AssertZeroExitCode(); + CopyAll(@out.GlobFiles("src/libglfw.3.dylib"), runtimes / "osx-x64" / "native"); + + EnsureCleanDirectory(@out); + + InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES=arm64", GLFWPath) + .AssertZeroExitCode(); + InheritedShell("cmake --build build", GLFWPath) + .AssertZeroExitCode(); + + CopyAll(@out.GlobFiles("src/libglfw.3.dylib"), runtimes / "osx-arm64" / "native"); } + + //var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.GLFW.Native" / "runtimes"; } ) ); From b24cf3a18e1d595e05c9c8367ba323086841388f Mon Sep 17 00:00:00 2001 From: mikko Date: Thu, 27 Jan 2022 20:03:22 +0200 Subject: [PATCH 08/14] Maybe now I actually get the artifacts --- .github/workflows/GLFW.yml | 2 +- build/nuke/Build.Native.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/GLFW.yml b/.github/workflows/GLFW.yml index 1b2f7194da..05cba837d8 100644 --- a/.github/workflows/GLFW.yml +++ b/.github/workflows/GLFW.yml @@ -43,4 +43,4 @@ jobs: run: ${{ matrix.env.nuke_invoke }} glfw - uses: actions/upload-artifact@v2 with: - path: build/submodules/GLFW/build/src + path: build/submodules/GLFW/compiled diff --git a/build/nuke/Build.Native.cs b/build/nuke/Build.Native.cs index 71d2c34881..15812deaab 100644 --- a/build/nuke/Build.Native.cs +++ b/build/nuke/Build.Native.cs @@ -130,7 +130,7 @@ string AndroidHome } else if (OperatingSystem.IsLinux()) { - InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -A -m64", GLFWPath) + InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -A -DCMAKE_SYSTEM_PROCESSOR=x86_64", GLFWPath) .AssertZeroExitCode(); InheritedShell("cmake --build build", GLFWPath) .AssertZeroExitCode(); @@ -138,7 +138,7 @@ string AndroidHome EnsureCleanDirectory(@out); - InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -A -m32", GLFWPath) + InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -DCMAKE_SYSTEM_PROCESSOR=i368", GLFWPath) .AssertZeroExitCode(); InheritedShell("cmake --build build", GLFWPath) .AssertZeroExitCode(); From 4fc7fe468eeb5414adbdfa8a70d308d82ebcd696 Mon Sep 17 00:00:00 2001 From: mikko Date: Thu, 27 Jan 2022 20:09:29 +0200 Subject: [PATCH 09/14] Typo --- build/nuke/Build.Native.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/nuke/Build.Native.cs b/build/nuke/Build.Native.cs index 15812deaab..46a52d01be 100644 --- a/build/nuke/Build.Native.cs +++ b/build/nuke/Build.Native.cs @@ -130,7 +130,7 @@ string AndroidHome } else if (OperatingSystem.IsLinux()) { - InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -A -DCMAKE_SYSTEM_PROCESSOR=x86_64", GLFWPath) + InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -DCMAKE_SYSTEM_PROCESSOR=x86_64", GLFWPath) .AssertZeroExitCode(); InheritedShell("cmake --build build", GLFWPath) .AssertZeroExitCode(); From 41343e4968641e882005bfbd9a8cb12d5537f162 Mon Sep 17 00:00:00 2001 From: mikko Date: Thu, 27 Jan 2022 20:19:31 +0200 Subject: [PATCH 10/14] What about now --- build/nuke/Build.Native.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/nuke/Build.Native.cs b/build/nuke/Build.Native.cs index 46a52d01be..54b56608d8 100644 --- a/build/nuke/Build.Native.cs +++ b/build/nuke/Build.Native.cs @@ -115,18 +115,18 @@ string AndroidHome { InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -A X64", GLFWPath) .AssertZeroExitCode(); - InheritedShell("cmake --build build", GLFWPath) + InheritedShell("cmake --build build --config Release", GLFWPath) .AssertZeroExitCode(); - CopyAll(@out.GlobFiles("Release/glfw3.dll"), runtimes / "win-x64" / "native"); + CopyAll(@out.GlobFiles("src/Release/glfw3.dll"), runtimes / "win-x64" / "native"); EnsureCleanDirectory(@out); InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -A Win32", GLFWPath) .AssertZeroExitCode(); - InheritedShell("cmake --build build", GLFWPath) + InheritedShell("cmake --build build --config Release", GLFWPath) .AssertZeroExitCode(); - CopyAll(@out.GlobFiles("Release/glfw3.dll"), runtimes / "win-x86" / "native"); + CopyAll(@out.GlobFiles("src/Release/glfw3.dll"), runtimes / "win-x86" / "native"); } else if (OperatingSystem.IsLinux()) { @@ -134,7 +134,7 @@ string AndroidHome .AssertZeroExitCode(); InheritedShell("cmake --build build", GLFWPath) .AssertZeroExitCode(); - CopyAll(@out.GlobFiles("libglfw.so"), runtimes / "linux-x64" / "native"); + CopyAll(@out.GlobFiles("src/libglfw.so"), runtimes / "linux-x64" / "native"); EnsureCleanDirectory(@out); @@ -143,7 +143,7 @@ string AndroidHome InheritedShell("cmake --build build", GLFWPath) .AssertZeroExitCode(); - CopyAll(@out.GlobFiles("libglfw.so"), runtimes / "linux-x86" / "native"); + CopyAll(@out.GlobFiles("src/libglfw.so"), runtimes / "linux-x86" / "native"); } else if (OperatingSystem.IsMacOS()) { From 522fbd2c4a6a494f8a5d33dc4cfcf1938747c044 Mon Sep 17 00:00:00 2001 From: Mikko Date: Fri, 28 Jan 2022 11:14:45 +0200 Subject: [PATCH 11/14] Now lets put files in the right place --- .github/workflows/GLFW.yml | 3 --- build/nuke/Build.Native.cs | 14 ++++++-------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/GLFW.yml b/.github/workflows/GLFW.yml index 05cba837d8..20977a42e1 100644 --- a/.github/workflows/GLFW.yml +++ b/.github/workflows/GLFW.yml @@ -41,6 +41,3 @@ jobs: dotnet-version: 6.0.100 - name: Build GLFW run: ${{ matrix.env.nuke_invoke }} glfw - - uses: actions/upload-artifact@v2 - with: - path: build/submodules/GLFW/compiled diff --git a/build/nuke/Build.Native.cs b/build/nuke/Build.Native.cs index 54b56608d8..ce1d29c439 100644 --- a/build/nuke/Build.Native.cs +++ b/build/nuke/Build.Native.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; @@ -110,7 +110,7 @@ string AndroidHome { var @out = GLFWPath / "build"; EnsureCleanDirectory(@out); - var runtimes = GLFWPath / "compiled"; // testing + var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.GLFW.Native" / "runtimes"; if (OperatingSystem.IsWindows()) { InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -A X64", GLFWPath) @@ -132,7 +132,7 @@ string AndroidHome { InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -DCMAKE_SYSTEM_PROCESSOR=x86_64", GLFWPath) .AssertZeroExitCode(); - InheritedShell("cmake --build build", GLFWPath) + InheritedShell("cmake --build build --config Release", GLFWPath) .AssertZeroExitCode(); CopyAll(@out.GlobFiles("src/libglfw.so"), runtimes / "linux-x64" / "native"); @@ -140,7 +140,7 @@ string AndroidHome InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -DCMAKE_SYSTEM_PROCESSOR=i368", GLFWPath) .AssertZeroExitCode(); - InheritedShell("cmake --build build", GLFWPath) + InheritedShell("cmake --build build --config Release", GLFWPath) .AssertZeroExitCode(); CopyAll(@out.GlobFiles("src/libglfw.so"), runtimes / "linux-x86" / "native"); @@ -149,7 +149,7 @@ string AndroidHome { InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES=x86_64", GLFWPath) .AssertZeroExitCode(); - InheritedShell("cmake --build build", GLFWPath) + InheritedShell("cmake --build build --config Release", GLFWPath) .AssertZeroExitCode(); CopyAll(@out.GlobFiles("src/libglfw.3.dylib"), runtimes / "osx-x64" / "native"); @@ -157,13 +157,11 @@ string AndroidHome InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES=arm64", GLFWPath) .AssertZeroExitCode(); - InheritedShell("cmake --build build", GLFWPath) + InheritedShell("cmake --build build --config Release", GLFWPath) .AssertZeroExitCode(); CopyAll(@out.GlobFiles("src/libglfw.3.dylib"), runtimes / "osx-arm64" / "native"); } - - //var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.GLFW.Native" / "runtimes"; } ) ); From ca2839220dbb1368b8b95ca12eb2f64e9fad86ff Mon Sep 17 00:00:00 2001 From: Mikko Date: Fri, 28 Jan 2022 11:28:39 +0200 Subject: [PATCH 12/14] Maybe this is a bit nicer now --- build/nuke/Build.Native.cs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/build/nuke/Build.Native.cs b/build/nuke/Build.Native.cs index ce1d29c439..ffe0792688 100644 --- a/build/nuke/Build.Native.cs +++ b/build/nuke/Build.Native.cs @@ -109,55 +109,57 @@ string AndroidHome () => { var @out = GLFWPath / "build"; + var prepare = "cmake -S. -B build -D BUILD_SHARED_LIBS=ON"; + var build = "cmake --build build --config Release"; EnsureCleanDirectory(@out); var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.GLFW.Native" / "runtimes"; if (OperatingSystem.IsWindows()) { - InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -A X64", GLFWPath) + InheritedShell($"{prepare} -A X64", GLFWPath) .AssertZeroExitCode(); - InheritedShell("cmake --build build --config Release", GLFWPath) + InheritedShell(build, GLFWPath) .AssertZeroExitCode(); CopyAll(@out.GlobFiles("src/Release/glfw3.dll"), runtimes / "win-x64" / "native"); EnsureCleanDirectory(@out); - InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -A Win32", GLFWPath) + InheritedShell($"{prepare} -A Win32", GLFWPath) .AssertZeroExitCode(); - InheritedShell("cmake --build build --config Release", GLFWPath) + InheritedShell(build, GLFWPath) .AssertZeroExitCode(); CopyAll(@out.GlobFiles("src/Release/glfw3.dll"), runtimes / "win-x86" / "native"); } else if (OperatingSystem.IsLinux()) { - InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -DCMAKE_SYSTEM_PROCESSOR=x86_64", GLFWPath) + InheritedShell($"{prepare} -DCMAKE_SYSTEM_PROCESSOR=x86_64", GLFWPath) .AssertZeroExitCode(); - InheritedShell("cmake --build build --config Release", GLFWPath) + InheritedShell(build, GLFWPath) .AssertZeroExitCode(); CopyAll(@out.GlobFiles("src/libglfw.so"), runtimes / "linux-x64" / "native"); EnsureCleanDirectory(@out); - InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -DCMAKE_SYSTEM_PROCESSOR=i368", GLFWPath) + InheritedShell($"{prepare} -DCMAKE_SYSTEM_PROCESSOR=i368", GLFWPath) .AssertZeroExitCode(); - InheritedShell("cmake --build build --config Release", GLFWPath) + InheritedShell(build, GLFWPath) .AssertZeroExitCode(); CopyAll(@out.GlobFiles("src/libglfw.so"), runtimes / "linux-x86" / "native"); } else if (OperatingSystem.IsMacOS()) { - InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES=x86_64", GLFWPath) + InheritedShell($"{prepare} -DCMAKE_OSX_ARCHITECTURES=x86_64", GLFWPath) .AssertZeroExitCode(); - InheritedShell("cmake --build build --config Release", GLFWPath) + InheritedShell(build, GLFWPath) .AssertZeroExitCode(); CopyAll(@out.GlobFiles("src/libglfw.3.dylib"), runtimes / "osx-x64" / "native"); EnsureCleanDirectory(@out); - InheritedShell($"cmake -S . -B build -D BUILD_SHARED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES=arm64", GLFWPath) + InheritedShell($"{prepare} -DCMAKE_OSX_ARCHITECTURES=arm64", GLFWPath) .AssertZeroExitCode(); - InheritedShell("cmake --build build --config Release", GLFWPath) + InheritedShell(build, GLFWPath) .AssertZeroExitCode(); CopyAll(@out.GlobFiles("src/libglfw.3.dylib"), runtimes / "osx-arm64" / "native"); From cb89d1cf303262fb185155c92625de695d4aaf4f Mon Sep 17 00:00:00 2001 From: roeyskoe <26493216+roeyskoe@users.noreply.github.com> Date: Fri, 28 Jan 2022 15:03:32 +0200 Subject: [PATCH 13/14] Apply suggestions from code review Co-authored-by: Dylan Perks <11160611+Perksey@users.noreply.github.com> --- .github/workflows/GLFW.yml | 2 +- build/nuke/Build.Native.cs | 9 --------- build/nuke/Build.Support.cs | 4 ++-- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/GLFW.yml b/.github/workflows/GLFW.yml index 20977a42e1..613f2521f0 100644 --- a/.github/workflows/GLFW.yml +++ b/.github/workflows/GLFW.yml @@ -1,4 +1,4 @@ -name: glfw +name: GLFW on: push: branches-ignore: diff --git a/build/nuke/Build.Native.cs b/build/nuke/Build.Native.cs index ffe0792688..50587effba 100644 --- a/build/nuke/Build.Native.cs +++ b/build/nuke/Build.Native.cs @@ -137,15 +137,6 @@ string AndroidHome InheritedShell(build, GLFWPath) .AssertZeroExitCode(); CopyAll(@out.GlobFiles("src/libglfw.so"), runtimes / "linux-x64" / "native"); - - EnsureCleanDirectory(@out); - - InheritedShell($"{prepare} -DCMAKE_SYSTEM_PROCESSOR=i368", GLFWPath) - .AssertZeroExitCode(); - InheritedShell(build, GLFWPath) - .AssertZeroExitCode(); - - CopyAll(@out.GlobFiles("src/libglfw.so"), runtimes / "linux-x86" / "native"); } else if (OperatingSystem.IsMacOS()) { diff --git a/build/nuke/Build.Support.cs b/build/nuke/Build.Support.cs index 83fc43b515..f90458c91b 100644 --- a/build/nuke/Build.Support.cs +++ b/build/nuke/Build.Support.cs @@ -17,10 +17,10 @@ using Nuke.Common.ProjectModel; using Nuke.Common.Tooling; using Nuke.Common.Utilities; -using static Nuke.Common.IO.FileSystemTasks; -using static Nuke.Common.Tooling.ProcessTasks; using Octokit; using Octokit.Internal; +using static Nuke.Common.IO.FileSystemTasks; +using static Nuke.Common.Tooling.ProcessTasks; partial class Build { From 4a7761f72f979eb5b051ead657301b1d13397d14 Mon Sep 17 00:00:00 2001 From: Mikko Date: Fri, 28 Jan 2022 15:06:07 +0200 Subject: [PATCH 14/14] Lock glfw to latest release --- build/submodules/GLFW | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/submodules/GLFW b/build/submodules/GLFW index df8d7bc892..7d5a16ce71 160000 --- a/build/submodules/GLFW +++ b/build/submodules/GLFW @@ -1 +1 @@ -Subproject commit df8d7bc892937a8b0f7c604c92a9f64f383cf48c +Subproject commit 7d5a16ce714f0b5f4efa3262de22e4d948851525