Frage

I'm trying to include gtk in my gyp project. I can compile by hand, but with gyp I always get the error that #include <gtk/gtk.h> cannot be found. I've seen other gyp projects like chromium include it like this but have been unsuccessful in duplicating.

Thanks for taking a look!

{
    'variables': {
        'pkg-config': 'pkg-config' 
    },
    'targets': [
        {
            'target_name': 'application',
            'type': 'executable',
            'sources': [
                'src/main_linux.cc',
            ],
        },
    ],
    'conditions': [
        ['OS=="linux"', {
            'direct_dependent_settings': {
                'cflags': [
                    '<!@(<(pkg-config) --cflags gtk+-2.0)',
                ],
            },
            'link_settings': {
                'ldflags': [
                    '<!@(<(pkg-config) --libs-only-other gtk+-2.0)',
                ],
                'libraries': [
                    '<!@(<(pkg-config) --libs-only-l gtk+-2.0)',
                ],
            },
        }],
    ],
}
War es hilfreich?

Lösung

Here is the working file I'm now using:

 {
        'variables': {
            'pkg-config': 'pkg-config' 
        },
        'conditions': [
            ['OS=="linux"', {
            'targets': [
                {
                    'target_name': 'trackbox',
                    'type': 'executable',
                    'sources': [
                        'src/main_linux.cc',
                    ],
                    'cflags': [
                        '<!@(<(pkg-config) --cflags gtk+-2.0)',
                    ],
                    'ldflags': [
                        '<!@(<(pkg-config) --libs-only-L --libs-only-other gtk+-2.0)',
                    ],
                    'libraries': [
                        '<!@(<(pkg-config) --libs-only-l gtk+-2.0)',
                    ],
                },
            ],
            }]
        ],
    }
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top