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

getting clang resource dir automagically #48

Closed
weskerfoot opened this issue Dec 14, 2022 · 2 comments
Closed

getting clang resource dir automagically #48

weskerfoot opened this issue Dec 14, 2022 · 2 comments

Comments

@weskerfoot
Copy link

weskerfoot commented Dec 14, 2022

Not sure if this is the best method but I did this in order to avoid specifying it manually every time

in yourlib.nim

const clangResourceDir {.strdefine.}: string = "nothing" # defined by config.nims
importc:
  sysPath fmt"{clangResourceDir}/include"
  path: "/usr/include/libxml2/libxml"
  path: "/usr/include/libxml2"
  "parser.h"

in config.nims

import system, strformat, strutils

const clangResourceDir = staticExec("clang -print-resource-dir").strip

switch("passL", "/usr/lib/libxml2.so")
switch("d", fmt"clangResourceDir={clangResourceDir}")

Hopefully someone else will find this useful

@PMunch
Copy link
Owner

PMunch commented Jan 7, 2023

With 7dc441b and #51 this is much easier to do. But I will keep this open until I've added a file which can be imported into config.nims so that we could have re-use of this clang finding logic.

@PMunch
Copy link
Owner

PMunch commented Jan 7, 2023

Found a better solution, assuming you have clang in your path callable as clang you should now be able to simply not have a sysPath argument.

@PMunch PMunch closed this as completed Jan 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants