Fix: nintendoswitch compilation (#21368)

* Fix: make nintendoswitch someGcc, remove symlink support for nintendoswitch, add getAppFilename for nintendoswitch

* Fix: use getApplHeuristic on nintendoswitch
This commit is contained in:
Dmitry Arkhipenko
2023-02-25 13:47:19 +03:00
committed by GitHub
parent d4782c9e42
commit b2edfe7a02
4 changed files with 11 additions and 5 deletions

View File

@@ -584,7 +584,8 @@ proc pread*(a1: cint, a2: pointer, a3: int, a4: Off): int {.
proc pwrite*(a1: cint, a2: pointer, a3: int, a4: Off): int {.
importc, header: "<unistd.h>".}
proc read*(a1: cint, a2: pointer, a3: int): int {.importc, header: "<unistd.h>".}
proc readlink*(a1, a2: cstring, a3: int): int {.importc, header: "<unistd.h>".}
when not defined(nintendoswitch):
proc readlink*(a1, a2: cstring, a3: int): int {.importc, header: "<unistd.h>".}
proc ioctl*(f: FileHandle, device: uint): int {.importc: "ioctl",
header: "<sys/ioctl.h>", varargs, tags: [WriteIOEffect].}
## A system call for device-specific input/output operations and other
@@ -603,7 +604,10 @@ proc setsid*(): Pid {.importc, header: "<unistd.h>".}
proc setuid*(a1: Uid): cint {.importc, header: "<unistd.h>".}
proc sleep*(a1: cint): cint {.importc, header: "<unistd.h>".}
proc swab*(a1, a2: pointer, a3: int) {.importc, header: "<unistd.h>".}
proc symlink*(a1, a2: cstring): cint {.importc, header: "<unistd.h>".}
when not defined(nintendoswitch):
proc symlink*(a1, a2: cstring): cint {.importc, header: "<unistd.h>".}
else:
proc symlink*(a1, a2: cstring): cint = -1
proc sync*() {.importc, header: "<unistd.h>".}
proc sysconf*(a1: cint): int {.importc, header: "<unistd.h>".}
proc tcgetpgrp*(a1: cint): Pid {.importc, header: "<unistd.h>".}

View File

@@ -254,7 +254,7 @@ proc findExe*(exe: string, followSymlinks: bool = true;
for ext in extensions:
var x = addFileExt(x, ext)
if fileExists(x):
when not defined(windows):
when not (defined(windows) or defined(nintendoswitch)):
while followSymlinks: # doubles as if here
if x.symlinkExists:
var r = newString(maxSymlinkLen)
@@ -702,6 +702,8 @@ proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [ReadIOEffect], noW
result = getApplHaiku()
elif defined(openbsd):
result = getApplOpenBsd()
elif defined(nintendoswitch):
result = ""
# little heuristic that may work on other POSIX-like systems:
if result.len == 0:

View File

@@ -67,7 +67,7 @@ proc expandSymlink*(symlinkPath: string): string {.noWeirdTarget.} =
##
## See also:
## * `createSymlink proc`_
when defined(windows):
when defined(windows) or defined(nintendoswitch):
result = symlinkPath
else:
result = newString(maxSymlinkLen)

View File

@@ -15,7 +15,7 @@ when defined(nimPreviewSlimSystem):
const
hasThreadSupport = compileOption("threads") and not defined(nimscript)
const someGcc = defined(gcc) or defined(llvm_gcc) or defined(clang)
const someGcc = defined(gcc) or defined(llvm_gcc) or defined(clang) or defined(nintendoswitch)
const someVcc = defined(vcc) or defined(clang_cl)
type