aboutsummaryrefslogtreecommitdiff
path: root/tests/tpcre.nim
blob: 705525f6e7a7e09c66997ce7659026f28ea6a85a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os

import nimterop/[cimport, git, paths]

const
  baseDir = nimteropBuildDir()/"pcre"
  pcreH = baseDir/"pcre.h.in"

static:
  if not pcreH.fileExists():
    downloadUrl("https://github.com/svn2github/pcre/raw/master/pcre.h.in", baseDir)
  cDebug()
  cDisableCaching()

const
  dynpcre =
    when defined(windows):
      when defined(cpu64):
        "pcre64.dll"
      else:
        "pcre32.dll"
    elif hostOS == "macosx":
      "libpcre(.3|.1|).dylib"
    else:
      "libpcre.so(.3|.1|)"

cPlugin:
  import strutils

  proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} =
    sym.name = sym.name.replace("pcre_", "")

cImport(pcreH, dynlib="dynpcre")

echo version()