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

How to add a Framework? #129

Open
danjenkins opened this issue Sep 16, 2022 · 5 comments
Open

How to add a Framework? #129

danjenkins opened this issue Sep 16, 2022 · 5 comments

Comments

@danjenkins
Copy link

danjenkins commented Sep 16, 2022

I've offered up CFLAGS and LDFLAGS for how to find the CoreFoundation framework but while it's processing the file given in Includes in the GENERATOR section...it fails to find the framework during the processing step

processing decklink.yml ⠋[ERR] ./sdk/Mac/include/DeckLinkAPI.h:46:10: include file not found: CoreFoundation/CoreFoundation.h. Search paths:

The search paths don't note the flags....

Here are the flags given...

  FlagGroups:
    - name: CFLAGS
      traits: ["darwin"]
      flags:
        - "-F/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/System/Library/Frameworks"
        - "-framework CoreFoundation"
    - name: LDFLAGS
      traits: ["darwin"]
      flags:
        - "-F/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/System/Library/Frameworks"
        - "-framework CoreFoundation"

If anyones got any ideas that would be great :D

EDIT:

My parser section looks like...

PARSER:
  IncludePaths:
    - /usr/include
    - /usr/local/include
  SourcesPaths:
    - ./sdk/Mac/include/DeckLinkAPI.h
  Arch: aarch64

But then theres no way to provide framework's to the parser section?

@xlab
Copy link
Owner

xlab commented Sep 16, 2022

  1. Parser uses those paths to find and parse headers. Usually I plug in the frameworks only to provide symbols for linking, i.e. in LDFLAGS.

  2. Parsing frameworks (OS X) folders weren't feasible before, as it contained too much VERY advanced code constructs, and CCv1 (the previous parser) wasn't able to handle it. After this PR Update cc to v4 and add unit tests #127 which upgraded to new parser CCv4 the situation might've changed.

  3. If you need to provide frameworks for linking, the best way is to put those flags into a separate file manually, because using that in FlagGroups means that it will be included in every Go file generated. Which is not always a problem, but just doesn't look nice.

Example file: https://github.com/vulkan-go/vulkan/blob/master/vulkan_darwin.go
(I did it manually)

Also, check out how folks at GLFW do it:
https://github.com/go-gl/glfw/blob/master/v3.3/glfw/build.go

@xlab
Copy link
Owner

xlab commented Sep 16, 2022

If you don't mind sharing a minimal reproducible example.. I can try :D

@danjenkins
Copy link
Author

hey @xlab here's the repo - https://github.com/broadcastervc/go-decklink - I wouldnt call the Decklink SDK minimal though :(

The Decklink SDK is a c++ sdk with "extern C" which should mean it's usable by c-for-go ?

To get c-for-go to be happy with the files on linux I needed to add struct before REFIID in a few files. The files would all get processed correctly but then I'm stuck on what I need to add to the yml file to make it output functions.

I still can't get past the CoreFoundation framework on mac though even after upgrading to the latest version of c-for-go

@xlab
Copy link
Owner

xlab commented Sep 19, 2022

I wouldnt call the Decklink SDK minimal though

I am not afraid of big examples :D Just mentioned minimal in case you don't want to share the full code.

which should mean it's usable by c-for-go ?

true!

I still can't get past the CoreFoundation framework

I will try on this week.

@danjenkins
Copy link
Author

hey @xlab did you ever get a chance to take a look at this? just coming back to it now myself.

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