Skip to content

Commit

Permalink
Alright now time for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Kale-Ko committed May 25, 2024
1 parent a00c34b commit 6168c3e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
23 changes: 19 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"])
Expand All @@ -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"])
Expand All @@ -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"])
Expand All @@ -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"])
Expand Down Expand Up @@ -411,6 +424,8 @@ tasks.register("make") {
}

build {
finalizedBy tasks.make

finalizedBy tasks.clientJar
finalizedBy tasks.serverJar
finalizedBy tasks.managerJar
Expand Down

0 comments on commit 6168c3e

Please sign in to comment.