Files
UniversalMusicPlayer/player/build.gradle
Markil3 adf4cea82c Converts the project to use a licensed WAVE file reader.
This is easier to distribute.
2021-07-24 14:12:42 -07:00

40 lines
1.5 KiB
Groovy

/*
* Copyright (c) 2021 William Hubbard. All Rights Reserved.
*/
import org.gradle.internal.jvm.Jvm
/*
* There is currently no "C application" plugin, so this build uses the "C++ application" plugin and then reconfigures it
* to build C instead.
*/
plugins {
id 'cpp-library'
}
library {
binaries.configureEach { CppBinary binary ->
def compileTask = binary.compileTask.get()
compileTask.includes.from("${Jvm.current().javaHome}/include")
compileTask.source.from fileTree(dir: "src/main/c", include: "player.c")
def osFamily = binary.targetPlatform.targetMachine.operatingSystemFamily
if (osFamily.macOs) {
compileTask.includes.from("${Jvm.current().javaHome}/include/darwin")
compileTask.source.from fileTree(dir: "src/main/c", include: "player_mac.c")
} else if (osFamily.linux) {
compileTask.includes.from("${Jvm.current().javaHome}/include/linux")
compileTask.source.from fileTree(dir: "src/main/c", include: "player_alsa.c")
} else if (osFamily.windows) {
compileTask.includes.from("${Jvm.current().javaHome}/include/win32")
compileTask.source.from fileTree(dir: "src/main/c", include: "player_win.c")
}
def toolChain = binary.toolChain
if (toolChain instanceof VisualCpp) {
compileTask.compilerArgs.addAll(["/TC"])
} else if (toolChain instanceof GccCompatibleToolChain) {
compileTask.compilerArgs.addAll(["-x", "c", "-std=c11"])
}
}
}