Closed mratsim closed 3 years ago
2
has the downside that the flags for the nim C code often need to be different that the .compile
code - ie Nim generates pretty inefficient C code that might benefit from different compile options (like LTO) than the dependency being compiled - also, when compiling library code, it often needs "special" private defines and the like which should not be present for "users" of the code. If only 2
is implemented, one will have to create a special, separate compile-only module - feasible, but annoying.
We're going with (1).
Has been implemented, will ship in 1.4.
We have a need to pass file-specific compilation flags to C or ASM files we are wrapping. For now we are using
nim.cfg
to specify the name of the files we want custom flags for.See https://github.com/status-im/nim-beacon-chain/pull/1789
However this is a bandaid as it requires the final applications to copy those nim.cfg instead of setting it at the wrapper level.
Similar to localPassC (https://github.com/nim-lang/Nim/issues/12662) we would need file-level compilation flags for C/ASM files.
Proposals
Here are some ideas to implement this RFC.
compile
pragma now accepts an optional passC stringlocalPassC
applies to localcompile
pragmas