diff options
| author | Oskari Timperi <oskari.timperi@iki.fi> | 2018-03-12 21:14:28 +0200 |
|---|---|---|
| committer | Oskari Timperi <oskari.timperi@iki.fi> | 2018-03-12 21:14:28 +0200 |
| commit | 490ca14283e72ca02a47046bae940128a16a6555 (patch) | |
| tree | b70a607e53753fd5bb65f12dd3879d420f15ef88 | |
| parent | ac4b41450b7e8f59496a374d0f396a3d443f21b2 (diff) | |
| download | tommath-nim-490ca14283e72ca02a47046bae940128a16a6555.tar.gz tommath-nim-490ca14283e72ca02a47046bae940128a16a6555.zip | |
Make config.nim more robust
| -rw-r--r-- | src/tommath/private/config.nim | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/tommath/private/config.nim b/src/tommath/private/config.nim index 07893da..496ea34 100644 --- a/src/tommath/private/config.nim +++ b/src/tommath/private/config.nim @@ -4,10 +4,23 @@ template currentSourceDir(): string = ## Return the directory the current source file resides in. parentDir(currentSourcePath()) -when hostOS == "windows": - const libraryName = currentSourceDir() & "/lib/tommath.lib" +when not defined(tommathPrefix): + const tommathPrefix = currentSourceDir() + +when not defined(tommathIncPath): + const tommathIncPath = tommathPrefix / "include" + +when defined(vcc): + {.passC:"/I" & tommathIncPath.} +else: + {.passC:"-I" & tommathIncPath.} + +when not defined(tommathLibPath): + const tommathLibPath = tommathPrefix / "lib" + +when defined(vcc): + const libraryPath = tommathLibPath / "tommath.lib" else: - const libraryName = currentSourceDir() & "/lib/libtommath.a" + const libraryPath = tommathLibPath / "libtommath.a" -{.passC:"-I" & currentSourceDir() & "/include".} -{.passL:libraryName.} +{.passL:libraryPath.} |
