Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix fileExists ambiguity for Nim < 1.4 & bump version #13

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions nimcuda.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.1.8"
version = "0.1.9"
author = "Andrea Ferretti"
description = "Nim binding for CUDA"
license = "Apache2"
Expand All @@ -12,6 +12,12 @@ requires "nim >= 0.16.0"

import os, strutils

proc fExists(f: string): bool =
when (NimMajor, NimMinor) < (1, 4):
result = os.fileExists(f)
else:
result = fileExists(f)

proc patch(libName: string): string =
when defined(windows):
let libpath = getEnv("CUDA_PATH") / "include" / libName
Expand All @@ -23,7 +29,7 @@ proc patch(libName: string): string =
patchPath = "c2nim" / libName
outPath = "headers" / libName
libContent =
if fileExists(simpleLibPath): readFile(simpleLibPath)
if fExists(simpleLibPath): readFile(simpleLibPath)
else: readFile(libPath) #.replace("#if defined(__cplusplus)", "#ifdef __cplusplus")
patchContent = readFile(patchPath)
writeFile(outPath, patchContent & libContent)
Expand Down