Adds basic support for native APIs for a local song player.
This commit is contained in:
37
player/build.gradle
Normal file
37
player/build.gradle
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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")
|
||||
|
||||
def osFamily = binary.targetPlatform.targetMachine.operatingSystemFamily
|
||||
if (osFamily.macOs) {
|
||||
compileTask.includes.from("${Jvm.current().javaHome}/include/darwin")
|
||||
} else if (osFamily.linux) {
|
||||
compileTask.includes.from("${Jvm.current().javaHome}/include/linux")
|
||||
} else if (osFamily.windows) {
|
||||
compileTask.includes.from("${Jvm.current().javaHome}/include/win32")
|
||||
}
|
||||
|
||||
compileTask.source.from fileTree(dir: "src/main/c", include: "**/*.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"])
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user