1

I'm experimenting with compiling Chromium on Mac OS and want to add a 3rd party framework to the project.

I already added my TParty.framework to the chrome_browser.gypi as following:

...
   ['OS=="mac"', {
      'dependencies': [
        '../third_party/google_toolbox_for_mac/google_toolbox_for_mac.gyp:google_toolbox_for_mac',
        ...
      ],
      'link_settings': {
        'libraries': [
          '../third_party/TParty.framework',
          '$(SDKROOT)/System/Library/Frameworks/Accelerate.framework',
          '$(SDKROOT)/System/Library/Frameworks/AddressBook.framework',
          ...
        ],
      },
    }],
...

Then somewhere in the code I import header from this framework:

#import <TParty/main_header.h>

I believe this is the correct approach but compiler gives me an error:

fatal error: 'TParty/main_header.h' file not found

How can I fix the configs so that TParty.framework became available to the compiler?

There will be no error if I'd import the header directly, like this:

#import "../third_party/TParty.framework/Versions/A/Headers/main_header.h"

But importing this way looks to be a bad practice.

Mykola
  • 435
  • 4
  • 17

1 Answers1

0

Try to set a path to the framework with mac_framework_dirs GYP directive:

...
   ['OS=="mac"', {
      'dependencies': [
        '../third_party/google_toolbox_for_mac/google_toolbox_for_mac.gyp:google_toolbox_for_mac',
        ...
      ],
      'link_settings': {
        'libraries': [
          'TParty.framework',
          'Accelerate.framework',
          'AddressBook.framework',
          ...
        ],
        'mac_framework_dirs': [
          '../third_party',
          '$(SDKROOT)/System/Library/Frameworks', # probably the system path is used by default
        ],
      },
    }],
...
pmed
  • 1,536
  • 8
  • 13
  • Thanks pmed. Indeed, mac_framework_dirs section does the job - my 3rd party framework is recognised by compiler. However, built app has error on start: "crashes on start with error: dyld: Library not loaded: @rpath/TParty.framework/Versions/A/TParty". Will handle it by myself. – Mykola Oct 19 '15 at 13:13