astellato / ofxSyphon

An OF add-on for using the Syphon framework.
Other
193 stars 57 forks source link

Compilation on OSX with QT-creator #28

Open Daandelange opened 8 years ago

Daandelange commented 8 years ago

Hey, I'v been trying to compile ofxSyphon with Qt creator instead of Xcode and finally succeeded. :)

ofApp {
    // dirty workaround for Qt Creator not parsing .mm files from the addons folder
    files: [
        // main.cpp, ofApp.h+cpp, etc.
        '../../../addons/ofxSyphon/src/ofxSyphonClient.mm',
        '../../../addons/ofxSyphon/src/ofxSyphonServer.mm',
        '../../../addons/ofxSyphon/src/ofxSyphonServerDirectory.mm',
        '../../../addons/ofxSyphon/libs/Syphon/src/SyphonNameboundClient.m'
    ]
    of.includePaths: [
        '../../../addons/ofxSyphon/libs',
        '../../../addons/ofxSyphon/libs/Syphon',
        '../../../addons/ofxSyphon/libs/Syphon/lib',
        '../../../addons/ofxSyphon/libs/Syphon/lib/osx',
        '../../../addons/ofxSyphon/libs/Syphon/src',
        '../../../addons/ofxSyphon/src',
    ]
    // include macosx framework
    of.frameworks: ['Syphon']
}

So that's about how far I got, the next step would be using the Syphon.Framework from the addons folder rather then from /Library/Frameworks. Any ideas ? With these lines I couldn't get it to work while [it should](). (even using absolute paths) of.linkerFlags: ['-F../../../addons/ofxSyphon/libs/Syphon/lib/osx'] of.cxxFlags: ['-F../../../addons/ofxSyphon/libs/Syphon/lib/osx']

Including the Syphon.Framework copy step in the Qt build process would be nice too.

(Still looking for better solutions so no PR yet, leaving issue open until then.)

bangnoise commented 5 years ago

The linker will also need -framework Syphon

Don't know much about Qt Creator so not sure about the framework copy I'm afraid

Daandelange commented 3 years ago

Hey, thanks for your reply. Feeding the linker with -framework Syphon throws an unrecognized linker argument warning, but it links fine with of.frameworks: ['Syphon'].

For the record, here's an updated .qbs snippet to get ofxSyphon to compile with QtCreator. This example works fine with Simple Client.app.

So I'm back on getting ofxSyphon to work with QtCreator and hopefully resolve this issue, could you give me some insights ?

The issue is about how #include <Syphon/Syphon.h> is resolved ( in 4 different files).

Also, C++ references state that #include <something> is for system includes (/System/Library/Frameworks/), while ofxSyphon seems to use a local framework. So shouldn't it be #include "Syphon/Syphon.h" ?

Daandelange commented 3 years ago

Ok, I found the right solution.

Qt Creator provides a way of setting framework search paths, together with the frameworks.
While oF wraps and documents cpp.frameworks, there's no trace of frameworkPaths. But there's a way of setting it trough qt's cpp module directly, and that works !

Also, regarding my last question, #include <Framework/Something.h> seems to be the way to go for including Apple Frameworks.

Here's an updated example of ofxSyphon working with Qt Creator.