diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index c839dca1313..14f01296f7d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -96,9 +96,16 @@ jobs: task: "build" outputs: "build/allOutputs" - os: windows-2022 - artifact-name: Win32 + artifact-name: Win32FFI architecture: x86 task: ":ntcoreffi:build" + build-options: "-Pntcoreffibuild \"-Dorg.gradle.jvmargs=-Xmx1096m\"" + outputs: "ntcoreffi/build/outputs" + - os: windows-2022 + artifact-name: Win64FFI + architecture: x64 + task: ":ntcoreffi:build" + build-options: "-Pntcoreffibuild -Pbuildwinarm64" outputs: "ntcoreffi/build/outputs" name: "Build - ${{ matrix.artifact-name }}" runs-on: ${{ matrix.os }} diff --git a/ntcoreffi/build.gradle b/ntcoreffi/build.gradle index d20d18b4965..ca86fe8fb8a 100644 --- a/ntcoreffi/build.gradle +++ b/ntcoreffi/build.gradle @@ -1,3 +1,5 @@ +import org.gradle.internal.os.OperatingSystem + plugins { id 'c' id 'cpp' @@ -119,6 +121,10 @@ task cppHeadersZip(type: Zip) { } } +if (OperatingSystem.current().isWindows() && !project.hasProperty('ntcoreffibuild')) { + return +} + build.dependsOn cppHeadersZip addTaskToCopyAllOutputs(cppHeadersZip) diff --git a/shared/config.gradle b/shared/config.gradle index d7dd9d55b9a..4612e5a3ca4 100644 --- a/shared/config.gradle +++ b/shared/config.gradle @@ -41,6 +41,23 @@ nativeUtils.platformConfigs.each { nativeUtils.platformConfigs.linuxathena.linker.args.add("-Wl,--fatal-warnings") +if (project.hasProperty('ntcoreffibuild')) { + // On windows, for ntcoreffi, use static runtime + nativeUtils.platformConfigs.each { + if (it.name.contains('windows')) { + it.cCompiler.releaseArgs.remove('/MD') + it.cppCompiler.releaseArgs.remove('/MD') + it.cCompiler.debugArgs.remove('/MDd') + it.cppCompiler.debugArgs.remove('/MDd') + + it.cCompiler.releaseArgs.add('/MT') + it.cppCompiler.releaseArgs.add('/MT') + it.cCompiler.debugArgs.add('/MTd') + it.cppCompiler.debugArgs.add('/MTd') + } + } +} + model { components { all {