From 490ca14283e72ca02a47046bae940128a16a6555 Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Mon, 12 Mar 2018 21:14:28 +0200 Subject: Make config.nim more robust --- src/tommath/private/config.nim | 23 ++++++++++++++++++----- 1 file 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.} -- cgit v1.2.3