Skip to content

Stable API for wrapper generators #17

@haxscramper

Description

@haxscramper

Stable documented API for automatically writing wrapper generators scripts using multiple parsing frontends and code expansion logic. Ideally it should not be necessary in large number of cases (for simpler libraries), but something like this libgit wrappers

let resultGrouped = wrapCSharedLibViaTsWave(
  inDir       = AbsDir"/usr/include/git2",
  outDir      = currentAbsSourceDir(),
  tmpDir      = getAppTempDir() / "v4",
  libName     = "git2",
  packageName = package,
  ignoreIn    = @["stdint"],
  depDirs     = @[ssh2],
  extraTypes  = @{
    cxxName("git_iterator"): cxxLibImport(package, @["libgit2_config"])
  }
)

or this libssh2 wrappers

let
  dir     = AbsDir"/usr/include"
  tmpDir  = getAppTempDir() / "libssh2"
  package = "hlibssh2"
  files   = @[
    dir /. "libssh2.h",
    dir /. "libssh2_sftp.h",
    dir /. "libssh2_publickey.h"
  ]
  map     = expandViaWave(files, tmpDir, baseCParseConf)
  conf    = initCSharedLibFixConf("ssh2", package, false, dir, map)
  wrapped = tmpDir.wrapViaTs(conf)
  outDir  = currentAbsSourceDir()
  grouped = writeFiles(outDir, wrapped, cCodegenConf, extraTypes = @{
    cxxName("_LIBSSH2_SESSION"): cxxLibImport(package, @["libssh2_config"])
  })

is necessary. This API can further be expanded on, to automate handling of the conan packages, git and github repositories, automatic tracking of changes (#9) and so on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions