Skip to content

Commit

Permalink
Use SpMsMediaSession on Windows, allow arch as file plat specifier
Browse files Browse the repository at this point in the history
  • Loading branch information
toasterofbread committed May 6, 2024
1 parent 0a9a45d commit 8934b51
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,17 @@ val platform_specific_files: List<String> = listOf(
enum class Arch {
X86_64, ARM64;

val libdir_name: String get() = when (this) {
X86_64 -> "x86_64-linux-gnu"
ARM64 -> "aarch64-linux-gnu"
}
val identifier: String get() =
when (this) {
X86_64 -> "x86_64"
ARM64 -> "arm64"
}

val libdir_name: String get() =
when (this) {
X86_64 -> "x86_64-linux-gnu"
ARM64 -> "aarch64-linux-gnu"
}

val PKG_CONFIG_PATH: String get() = "/usr/lib/$libdir_name/pkgconfig"

Expand Down Expand Up @@ -77,9 +84,6 @@ enum class Platform {
}

val gen_file_extension: String
get() = identifier.replace("-", ".")

val alt_gen_file_extension: String
get() = when (this) {
LINUX_X86, LINUX_ARM64 -> "linux"
WINDOWS -> "windows"
Expand Down Expand Up @@ -456,23 +460,25 @@ for (platform in Platform.supported) {
for (path in platform_specific_files) {
val out_file: File = path.getFile()

var platform_file: File = path.getFile('.' + platform.gen_file_extension)

if (!platform_file.isFile) {
platform_file = path.getFile('.' + platform.alt_gen_file_extension)

if (!platform_file.isFile) {
platform_file = path.getFile(".other")
}
}

if (platform_file.isFile) {
out_file.writer().use { writer ->
writer.write(GENERATED_FILE_PREFIX)

platform_file.reader().use { reader ->
reader.transferTo(writer)
for (platform_file in listOf(
// OS and arch
path.getFile('.' + platform.gen_file_extension + '.' + platform.arch.identifier),
// OS only
path.getFile('.' + platform.gen_file_extension),
// Arch only
path.getFile('.' + platform.arch.identifier),
// Other
path.getFile(".other")
)) {
if (platform_file.isFile) {
out_file.writer().use { writer ->
writer.write(GENERATED_FILE_PREFIX)

platform_file.reader().use { reader ->
reader.transferTo(writer)
}
}
break
}
}
}
Expand Down

0 comments on commit 8934b51

Please sign in to comment.