nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.55k stars 1.47k forks source link

Document `--COMPILER.FOO` switches #9056

Open kaushalmodi opened 6 years ago

kaushalmodi commented 6 years ago

Hello,

While reading through https://hookrace.net/blog/nim-binary-size/#using-the-c-standard-library, I learned that we can have --gcc.exe and --gcc.linkerexe switches.

But I couldn't find the reference to those anywhere in the Nim documentation.

After a bunch of partially arbitrary/partially educated grepping, I discovered this trove of switches that don't show up in nim --fullhelp.

compiler/extccomp.nim:400:25:  conf.compileOptions = getConfigVar(conf, conf.cCompiler, ".options.always")
compiler/extccomp.nim:402:24:  conf.ccompilerpath = getConfigVar(conf, conf.cCompiler, ".path")
compiler/extccomp.nim:427:26:  addCompileOption(conf, getConfigVar(conf, conf.cCompiler, ".options.always"))
compiler/extccomp.nim:428:18:  #addLinkOption(getConfigVar(cCompiler, ".options.linker"))
compiler/extccomp.nim:430:26:    conf.ccompilerpath = getConfigVar(conf, conf.cCompiler, ".path")
compiler/extccomp.nim:474:12:  result = getConfigVar(conf, c, ".options.speed")
compiler/extccomp.nim:479:12:  result = getConfigVar(conf, c, ".options.debug")
compiler/extccomp.nim:484:12:  result = getConfigVar(conf, c, ".options.size")
compiler/extccomp.nim:549:13:  var exe = getConfigVar(conf, c, ".exe")
compiler/extccomp.nim:666:21:    var linkerExe = getConfigVar(conf, conf.cCompiler, ".linkerexe")
compiler/extccomp.nim:700:23:                      getConfigVar(conf, conf.cCompiler, ".options.linker")
compiler/extccomp.nim:701:20:    var linkTmpl = getConfigVar(conf, conf.cCompiler, ".linkTmpl")
compiler/extccomp.nim:913:29:                            getConfigVar(conf, conf.cCompiler, ".options.linker")))

Can the above please be added to nim --fullhelp as something like:

--gcc.options.always
--gcc.path
...

.. with a note saying that the "gcc" part of the switch can be (probably?) replaced with the actual compiler (I am guessing cc, clang, etc.?).

Araq commented 6 years ago

I'm not saying that it's good, but how to use these switches is shown in the default nim.cfg and the names are self explanatory. Cough.