diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2020-06-16 20:41:32 -0500 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2020-06-16 20:43:50 -0500 |
| commit | e0d9751c03261fcfc79d171dab24b0ccc27abb8f (patch) | |
| tree | ff0eeac7db033e9e5aa1ccbcdfc3993f6eae835a | |
| parent | f95139eb43a7ab19271dea3843df5e76bd0252f0 (diff) | |
| download | nimterop-e0d9751c03261fcfc79d171dab24b0ccc27abb8f.tar.gz nimterop-e0d9751c03261fcfc79d171dab24b0ccc27abb8f.zip | |
Fix lib copy issue
| -rw-r--r-- | nimterop/build.nim | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/nimterop/build.nim b/nimterop/build.nim index 6cb497d..b5cdc59 100644 --- a/nimterop/build.nim +++ b/nimterop/build.nim @@ -252,6 +252,17 @@ proc getFileDate*(fullpath: string): string = (result, ret) = execAction(cmd) +proc touchFile*(fullpath: string) = + ## Touch file to update modified date + var + cmd = + when defined(Windows): + &"cmd /c copy /b {fullpath.sanitizePath}+" + else: + &"touch {fullpath.sanitizePath}" + + discard execAction(cmd) + proc getProjectCacheDir*(name: string, forceClean = true): string = ## Get a cache directory where all nimterop artifacts can be stored ## @@ -1367,19 +1378,22 @@ macro getHeader*( `ldeps`* = block: var ldeps = ldeps + copied: seq[string] for i in 0 ..< ldeps.len: let lname = ldeps[i].extractFilenameStatic() ldeptgt = joinPathStatic(`libdir`, lname) - if not fileExists(ldeptgt) or getFileDate(ldeps[i]) > getFileDate(ldeptgt): - echo "# Copying " & lname & " to " & `libdir` + if not fileExists(ldeptgt) or getFileDate(ldeps[i]) != getFileDate(ldeptgt): cpFile(ldeps[i], ldeptgt, psymlink = true) + copied.add lname ldeps[i] = ldeptgt + if copied.len != 0: + echo "# Copying dependencies: " & copied.join(" ") & "\n# to " & `libdir` ldeps static: # Copy shared libraries and dependencies to `libdir` - if not fileExists(`lpath`) or getFileDate(lpath) > getFileDate(`lpath`): + if not fileExists(`lpath`) or getFileDate(lpath) != getFileDate(`lpath`): echo "# Copying " & `lpath`.extractFilenameStatic() & " to " & `libdir` cpFile(lpath, `lpath`) |
