In order to avoid adding all the time nim c -r --threads: on --tlsEmulation: off filename.nim when compiling, I create a <filename>.cfg file:
--threads: on
--tlsEmulation: off
Is there a pragma that prevents me from doing so?
You need to call your config file <filename>.nim.cfg not <filename>.cfg
From the Nim Compiler User Guide: A project can also have a project-specific configuration file named $project.nim.cfg that resides in the same directory as $project.nim. This file can be skipped with the --skipProjCfg command-line option.
Sorry I have been a bit cryptic.
I have this transpose.nim
import vapoursynth
Source("2sec.mkv")[0..30].Transpose.Pipey4m
transpose.nim.cfg
--threads: on
--tlsEmulation: off
Two files just for four lines
I would like to avoid the user having to add a <filename>.nim.cfg file.
I was thinking on a {.something: "--threads: on --tlsEmulation: off".} that I could add on the library itself. But any oher alternative would be fine.
I checked and it doesn't work.
I checked the documentation and it looks like only some of the compile time options are implemented: checks, boundChecks, overflowChecks, nilChecks, assertions, warnings, hints, optimization, patterns, callconv.
I don't remember a common way of doing this other than erroring if threads isn't on. You can do it like so:
when not compileOption("threads"):
{.error: "use --threads:on to compile this library".}
If there's a situation where you don't want to error, you could warn:
when not compileOption("tlsEmulation"):
{.warning: "this library runs better with --tlsEmulation:on".}