Skip to content

Commit 318d599

Browse files
committed
Fix build for windows: return generator for mingw
1 parent 13f3085 commit 318d599

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

gradle/multik_jni-cmake.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ def cmake_c_compiler = System.getenv("CMAKE_C_COMPILER") ?: "gcc"
2929
def cmake_cxx_compiler = System.getenv("CMAKE_CXX_COMPILER") ?: "g++"
3030
def lib_gcc_path = System.getenv("GCC_LIB_Path") ?: ""
3131

32+
static boolean isWindows() {
33+
return System.getProperty('os.name').toLowerCase().contains('windows')
34+
}
35+
3236
tasks.register('createBuildDir') {
3337
doLast {
3438
mkdir(layout.buildDirectory.get().asFile)
@@ -38,6 +42,7 @@ tasks.register('createBuildDir') {
3842

3943
tasks.register('config_cmake') {
4044
dependsOn createBuildDir
45+
String gen = isWindows() ? "-G CodeBlocks - MinGW Makefiles" : ""
4146
doLast {
4247
exec {
4348
commandLine "cmake",
@@ -46,6 +51,7 @@ tasks.register('config_cmake') {
4651
"-DCMAKE_CXX_COMPILER=$cmake_cxx_compiler",
4752
"-DGCC_LIB_PATH=$lib_gcc_path",
4853
"-DTARGET_OS=$targetOS",
54+
gen,
4955
"-S", cmake_path,
5056
"-B", path_to_build
5157
}

0 commit comments

Comments
 (0)