[tetris] Support Windows resources in Gradle build
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
@echo off
|
||||
setlocal
|
||||
set DIR=.
|
||||
if "%KONAN_DATA_DIR%"=="" (set KONAN_DATA_DIR="%HOME%\.konan")
|
||||
if "%KONAN_DATA_DIR%"=="" (set "KONAN_DATA_DIR=%userprofile%\.konan")
|
||||
set "PATH=..\..\dist\bin;..\..\bin;%KONAN_DATA_DIR%\dependencies\msys2-mingw-w64-x86_64-gcc-7.2.0-clang-llvm-5.0.0-windows-x86-64\bin;%PATH%"
|
||||
if "%TARGET%" == "" set TARGET=mingw
|
||||
rem Requires default mingw64 install path yet.
|
||||
|
||||
@@ -3,6 +3,7 @@ apply plugin: 'konan'
|
||||
konan.targets = ['macbook', 'linux', 'raspberrypi', 'mingw']
|
||||
|
||||
def konanUserDir = System.getenv("KONAN_DATA_DIR") ?: "${System.getProperty("user.home")}/.konan"
|
||||
def resFile = file("$buildDir/konan/res/Tetris.res")
|
||||
|
||||
konanArtifacts {
|
||||
|
||||
@@ -50,11 +51,26 @@ konanArtifacts {
|
||||
}
|
||||
|
||||
target 'mingw', {
|
||||
linkerOpts "-L${System.getenv("MINGW64_DIR")?:"c:/msys64/mingw64"}/lib -lSDL2 -mwindows"
|
||||
linkerOpts "$resFile -L${System.getenv("MINGW64_DIR")?:"c:/msys64/mingw64"}/lib -lSDL2 -mwindows"
|
||||
dependsOn 'windowsResources'
|
||||
inputs.file resFile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task windowsResources (type: Exec) {
|
||||
def rcFile = file('Tetris.rc')
|
||||
def path = System.getenv("PATH")
|
||||
|
||||
def windresDir = "$konanUserDir/dependencies/msys2-mingw-w64-x86_64-gcc-7.2.0-clang-llvm-5.0.0-windows-x86-64/bin"
|
||||
|
||||
commandLine "$windresDir/windres", rcFile, '-O', 'coff', '-o', resFile
|
||||
environment 'PATH', "$windresDir;$path"
|
||||
|
||||
inputs.file rcFile
|
||||
outputs.file resFile
|
||||
}
|
||||
|
||||
compileKonan {
|
||||
doLast {
|
||||
konanArtifacts.tetris.forEach() { task ->
|
||||
|
||||
Reference in New Issue
Block a user