Add passing options to Nim compiler

This commit is contained in:
Joey Yakimowich-Payne 2018-07-02 21:06:42 +09:00
commit ceb084963a
2 changed files with 9 additions and 2 deletions

View file

@ -24,6 +24,8 @@ type
elfLocation: string elfLocation: string
nimCompilerArgs: string
proc execProc(cmd: string, verbose: bool=false): string {.discardable.}= proc execProc(cmd: string, verbose: bool=false): string {.discardable.}=
result = "" result = ""
@ -92,6 +94,7 @@ Options:
-q, --romfsPath:PATH Path to use to build in a romfs image -q, --romfsPath:PATH Path to use to build in a romfs image
-p, --icon:PATH sets the icon to use for the generated NRO and NACP -p, --icon:PATH sets the icon to use for the generated NRO and NACP
(defaults to "$DKP/libnx/default_icon.jpg) (defaults to "$DKP/libnx/default_icon.jpg)
--nimCompilerArgs: STR Args to pass to the nim compiler
-h, --help show this help -h, --help show this help
Note, single letter options that take an argument require a colon. E.g. -p:PATH. Note, single letter options that take an argument require a colon. E.g. -p:PATH.
@ -114,6 +117,7 @@ proc buildElf(buildInfo: BuildInfo): string =
args &= " --passL='" & buildInfo.libs & "'" args &= " --passL='" & buildInfo.libs & "'"
if buildInfo.includes != "": if buildInfo.includes != "":
args &= " --passC='" & buildInfo.includes & "'" args &= " --passC='" & buildInfo.includes & "'"
args &= " " & buildInfo.nimCompilerArgs
cmd = cmd % ["args", args] cmd = cmd % ["args", args]
execProc cmd, buildInfo.verbose execProc cmd, buildInfo.verbose
@ -243,7 +247,8 @@ proc processArgs() =
verbose: false, verbose: false,
release: false, release: false,
elfLocation: "" elfLocation: "",
nimCompilerArgs: ""
) )
var buildTypes: seq[string] = @[] var buildTypes: seq[string] = @[]
@ -284,6 +289,8 @@ proc processArgs() =
buildInfo.release = true buildInfo.release = true
of "romfsPath", "romfsDir", "q": of "romfsPath", "romfsDir", "q":
buildInfo.romfsPath = val.sanitizePath() buildInfo.romfsPath = val.sanitizePath()
of "nimCompilerArgs":
buildInfo.nimCompilerArgs = val
of "verbose": of "verbose":
buildInfo.verbose = true buildInfo.verbose = true
of "help", "h": of "help", "h":

View file

@ -1,6 +1,6 @@
# Package # Package
version = "0.1.0" version = "0.1.1"
author = "Joey Payne" author = "Joey Payne"
description = "Nintendo Switch library libnx for Nim." description = "Nintendo Switch library libnx for Nim."
license = "The Unlicense" license = "The Unlicense"