Adds basic support for native APIs for a local song player.

This commit is contained in:
Markil3
2021-07-17 07:20:14 -06:00
parent 704ab06f85
commit 94ffd80c8d
12 changed files with 968 additions and 1 deletions

37
player/build.gradle Normal file
View 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"])
}
}
}