From 6168c3e948f47685030f972b6037c06462ada05d Mon Sep 17 00:00:00 2001 From: Kale-Ko Date: Sat, 25 May 2024 09:05:55 -0400 Subject: [PATCH] Alright now time for windows --- .github/workflows/build-test.yml | 11 +++++++++++ build.gradle | 23 +++++++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index f261cfd..09afcab 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -24,6 +24,11 @@ jobs: distribution: temurin java-version: 21 + - name: Setup C++ + uses: aminya/setup-cpp@v1 + with: + compiler: gcc + - name: Setup Dependencies run: | sudo dpkg --add-architecture amd64 @@ -70,6 +75,12 @@ jobs: distribution: temurin java-version: 21 + - name: Setup C++ + uses: aminya/setup-cpp@v1 + with: + compiler: msvc + vcvarsall: true + - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 diff --git a/build.gradle b/build.gradle index 6d18667..9e44dab 100644 --- a/build.gradle +++ b/build.gradle @@ -148,6 +148,19 @@ static boolean isExecutable(String name) { return getExecutable(name) != null } +static String getvcvarsall() { + if (Files.exists(Path.of("C:\\Program Files\\Microsoft Visual Studio\\"))) { + println(Files.list(Path.of("C:\\Program Files\\\\Microsoft Visual Studio")).toList()) + } else if (Files.exists(Path.of("C:\\Program Files (x86)\\Microsoft Visual Studio\\"))) { + println(Files.list(Path.of("C:\\Program Files (x86)\\Microsoft Visual Studio\\")).toList()) + } else { + logger.log(LogLevel.ERROR, "No Visual Studio installation!!") + return "check console" + } + + return "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvarsall.bat" +} + if (isLinux()) { tasks.register("make-linux-x86_64", Exec) { dependsOn tasks.compileJava @@ -288,7 +301,7 @@ if (isWindows()) { Files.createDirectories(outPath) } - commandLine "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvarsall.bat", "x64", "&&", "cl", "/nologo", "/utf-8", "src/main/native/desktopCapture-windows.cpp", "kernel32.lib", "user32.lib", "gdi32.lib", "/Fe:", outPath.resolve("libDesktopCapture-windows-x86_64.dll").toString(), "/std:c++20", "/EHsc", "/W4", "/wd4100", "/WX", "/O2", "/LD", "/I", rootDir.toPath().resolve("build/generated/sources/headers/java/main").toString(), "/I", includeDir.toString(), "/I", includeDir.resolve("win32/").toString(), "/link", "/WX", "/subsystem:console", "/debug:none" + commandLine getvcvarsall(), "x64", "&&", "cl", "/nologo", "/utf-8", "src/main/native/desktopCapture-windows.cpp", "kernel32.lib", "user32.lib", "gdi32.lib", "/Fe:", outPath.resolve("libDesktopCapture-windows-x86_64.dll").toString(), "/std:c++20", "/EHsc", "/W4", "/wd4100", "/WX", "/O2", "/LD", "/I", rootDir.toPath().resolve("build/generated/sources/headers/java/main").toString(), "/I", includeDir.toString(), "/I", includeDir.resolve("win32/").toString(), "/link", "/WX", "/subsystem:console", "/debug:none" workingDir rootDir inputs.files(["src/main/native/desktopCapture-windows.cpp", "src/main/native/desktopCapture-common.cpp"]) @@ -305,7 +318,7 @@ if (isWindows()) { Files.createDirectories(outPath) } - commandLine "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvarsall.bat", "x64_x86", "&&", "cl", "/nologo", "/utf-8", "src/main/native/desktopCapture-windows.cpp", "kernel32.lib", "user32.lib", "gdi32.lib", "/Fe:", outPath.resolve("libDesktopCapture-windows-x86.dll").toString(), "/std:c++20", "/EHsc", "/W4", "/wd4100", "/WX", "/O2", "/LD", "/I", rootDir.toPath().resolve("build/generated/sources/headers/java/main").toString(), "/I", includeDir.toString(), "/I", includeDir.resolve("win32/").toString(), "/link", "/WX", "/subsystem:console", "/debug:none" + commandLine getvcvarsall(), "x64_x86", "&&", "cl", "/nologo", "/utf-8", "src/main/native/desktopCapture-windows.cpp", "kernel32.lib", "user32.lib", "gdi32.lib", "/Fe:", outPath.resolve("libDesktopCapture-windows-x86.dll").toString(), "/std:c++20", "/EHsc", "/W4", "/wd4100", "/WX", "/O2", "/LD", "/I", rootDir.toPath().resolve("build/generated/sources/headers/java/main").toString(), "/I", includeDir.toString(), "/I", includeDir.resolve("win32/").toString(), "/link", "/WX", "/subsystem:console", "/debug:none" workingDir rootDir inputs.files(["src/main/native/desktopCapture-windows.cpp", "src/main/native/desktopCapture-common.cpp"]) @@ -322,7 +335,7 @@ if (isWindows()) { Files.createDirectories(outPath) } - commandLine "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvarsall.bat", "x64_arm64", "&&", "cl", "/nologo", "/utf-8", "src/main/native/desktopCapture-windows.cpp", "kernel32.lib", "user32.lib", "gdi32.lib", "/Fe:", outPath.resolve("libDesktopCapture-windows-arm64.dll").toString(), "/std:c++20", "/EHsc", "/W4", "/wd4100", "/WX", "/O2", "/LD", "/I", rootDir.toPath().resolve("build/generated/sources/headers/java/main").toString(), "/I", includeDir.toString(), "/I", includeDir.resolve("win32/").toString(), "/link", "/WX", "/subsystem:console", "/debug:none" + commandLine getvcvarsall(), "x64_arm64", "&&", "cl", "/nologo", "/utf-8", "src/main/native/desktopCapture-windows.cpp", "kernel32.lib", "user32.lib", "gdi32.lib", "/Fe:", outPath.resolve("libDesktopCapture-windows-arm64.dll").toString(), "/std:c++20", "/EHsc", "/W4", "/wd4100", "/WX", "/O2", "/LD", "/I", rootDir.toPath().resolve("build/generated/sources/headers/java/main").toString(), "/I", includeDir.toString(), "/I", includeDir.resolve("win32/").toString(), "/link", "/WX", "/subsystem:console", "/debug:none" workingDir rootDir inputs.files(["src/main/native/desktopCapture-windows.cpp", "src/main/native/desktopCapture-common.cpp"]) @@ -339,7 +352,7 @@ if (isWindows()) { Files.createDirectories(outPath) } - commandLine "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvarsall.bat", "x64_arm", "&&", "cl", "/nologo", "/utf-8", "src/main/native/desktopCapture-windows.cpp", "kernel32.lib", "user32.lib", "gdi32.lib", "/Fe:", outPath.resolve("libDesktopCapture-windows-arm.dll").toString(), "/std:c++20", "/EHsc", "/W4", "/wd4100", "/WX", "/O2", "/LD", "/I", rootDir.toPath().resolve("build/generated/sources/headers/java/main").toString(), "/I", includeDir.toString(), "/I", includeDir.resolve("win32/").toString(), "/link", "/WX", "/subsystem:console", "/debug:none" + commandLine getvcvarsall(), "x64_arm", "&&", "cl", "/nologo", "/utf-8", "src/main/native/desktopCapture-windows.cpp", "kernel32.lib", "user32.lib", "gdi32.lib", "/Fe:", outPath.resolve("libDesktopCapture-windows-arm.dll").toString(), "/std:c++20", "/EHsc", "/W4", "/wd4100", "/WX", "/O2", "/LD", "/I", rootDir.toPath().resolve("build/generated/sources/headers/java/main").toString(), "/I", includeDir.toString(), "/I", includeDir.resolve("win32/").toString(), "/link", "/WX", "/subsystem:console", "/debug:none" workingDir rootDir inputs.files(["src/main/native/desktopCapture-windows.cpp", "src/main/native/desktopCapture-common.cpp"]) @@ -411,6 +424,8 @@ tasks.register("make") { } build { + finalizedBy tasks.make + finalizedBy tasks.clientJar finalizedBy tasks.serverJar finalizedBy tasks.managerJar