summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOskari Timperi <oskari.timperi@iki.fi>2018-03-12 19:55:03 +0200
committerOskari Timperi <oskari.timperi@iki.fi>2018-03-12 19:55:03 +0200
commitac4b41450b7e8f59496a374d0f396a3d443f21b2 (patch)
tree4fe4f6eaaa19d8688c4007ede68a8a168439e9d4
parent2a3380a93c95cbeb75e49a1e31450c330cf80024 (diff)
downloadtommath-nim-ac4b41450b7e8f59496a374d0f396a3d443f21b2.tar.gz
tommath-nim-ac4b41450b7e8f59496a374d0f396a3d443f21b2.zip
Make the library include & link stuff
-rw-r--r--src/tommath/private/config.nim13
-rw-r--r--src/tommath/tommath.nim2
2 files changed, 15 insertions, 0 deletions
diff --git a/src/tommath/private/config.nim b/src/tommath/private/config.nim
new file mode 100644
index 0000000..07893da
--- /dev/null
+++ b/src/tommath/private/config.nim
@@ -0,0 +1,13 @@
+import os
+
+template currentSourceDir(): string =
+ ## Return the directory the current source file resides in.
+ parentDir(currentSourcePath())
+
+when hostOS == "windows":
+ const libraryName = currentSourceDir() & "/lib/tommath.lib"
+else:
+ const libraryName = currentSourceDir() & "/lib/libtommath.a"
+
+{.passC:"-I" & currentSourceDir() & "/include".}
+{.passL:libraryName.}
diff --git a/src/tommath/tommath.nim b/src/tommath/tommath.nim
index 9287778..f45763c 100644
--- a/src/tommath/tommath.nim
+++ b/src/tommath/tommath.nim
@@ -1,3 +1,5 @@
+include private/config
+
type
mp_digit* = distinct uint32
mp_word* = distinct uint64