ctucx.git: nimexif

nim-wrapper for libexif

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 
import os
import nimterop/build
import nimterop/cimport

cPlugin:
  import strutils
  # Strip leading and trailing underscores
  proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} =
    sym.name = sym.name.strip(chars={'_'})

const
  baseDir = getProjectCacheDir("exif" / "libexif")

when isDefined(libexifLocal):
  cIncludeDir("libexif/include")
  cImport("libexif/include/libexif/exif-data.h" , recurse = true, dynlib = "libexif/lib/libexif.so")

else:
  getHeader(
    header = "libexif/exif-data.h",
    giturl = "https://github.com/libexif/libexif/",
    dlurl = "https://github.com/libexif/libexif/releases/download/libexif-0_6_22-release/libexif-0.6.22.tar.gz",
    outdir = baseDir,
    altNames = "exif"
  )

  cIncludeDir(exifdataPath.parentDir())
  cImport(exifdataPath, recurse = true, dynlib = exifdataLPath)