Use Swig to wrap a library using QT

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Use Swig to wrap a library using QT

Grégory S
Hi,

I need to wrap a library which use QT Core. It does not use GUI.
The library use:
QString
QMap
QVector
QStringList
QSet
QColor
QDateTime

How can i wrap this library ?
Do i have to had all QT .h in the .i file ? In which order ? I try but there are some errors i do not understand.

Thanks,
Regards,
Gregory

------------------------------------------------------------------------------

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: Use Swig to wrap a library using QT

Grégory S
Ps: I export to C#

2016-08-03 12:01 GMT+02:00 Grégory S <[hidden email]>:
Hi,

I need to wrap a library which use QT Core. It does not use GUI.
The library use:
QString
QMap
QVector
QStringList
QSet
QColor
QDateTime

How can i wrap this library ?
Do i have to had all QT .h in the .i file ? In which order ? I try but there are some errors i do not understand.

Thanks,
Regards,
Gregory


------------------------------------------------------------------------------

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: Use Swig to wrap a library using QT

Mark Pallone
I have a project that does the same thing, except that it exposes Qt/C++ code to Python. 

I'm on vacation and don't want to spend a lot of time replying, but "cookbooking" off of my interface and project files might help you. So, here's a stripped down version of my interface file: 

    %module mymodule 
    
    %include "std_string.i"
    %include "std_vector.i"
    %include "std_map.i"
    
    %{
    #include "mymodule.hpp" 
    
    // Not all of these are necessary, but it's simpler to just 
    // make it match the header file that we're providing the 
    // interface to. 
    #include <QDebug>
    #include <QPolygon>    
    #include <QPoint> 
    #include <QStringList>
    #include <QFileInfo> 
    #include <QDir> 
    #include <QString>  
    #include <cstring>
    #include <string> 
    #include <iostream> 
    #include <stdlib.h>
    #include <stdexcept> 
    #include <assert.h> 
    #include "library1.hpp"
    #include "library2.hpp"
     
    using namespace mymodule; 
    
    %}
    
    namespace std {
       // Tell SWIG about our data structures 
       %template(vectori) vector<int>;
       %template(vectord) vector<double>;
    };
    
    namespace mymodule {
    
    /*****************************************************************************
     * Library initialization and utilities 
     *****************************************************************************/ 
    
    void initmymodule(std::string filename = ""); 
    
    
    /* Other wrapped code declarations go here */ 
    
    
    } // namespace


And here's a simplified version of my .pro file: 

    
    #==============================================================================
    # Typical Qt initialization 
    #==============================================================================
    
    TEMPLATE = lib 
    # CONFIG += qt warn_on release 
    CONFIG += qt warn_on debug_and_release
    CONFIG += plugin
    
    linux-g++ {
        CONFIG += dll 
    }
    
    
    LIB_DEPENDENCIES = library1 library2 
    
    include(../custom.pri)
    
    release {
        DEFINES += QT_NO_DEBUG_OUTPUT
    }
    
    macx {
        LIBS += -L../libs/macx 
    }
    linux-g++ {
        LIBS += -L../libs/unix 
    }
    
    INCLUDEPATH += ../library1
    INCLUDEPATH += ../library2
    
    
    
    HEADERS += ../library1/library1.hpp
    SOURCES += ../library1/library1.cpp
    
    HEADERS += ../library2/library2.hpp 
    SOURCES += ../library2/library2.cpp
    
    
    
    
    #==============================================================================
    # Python 3 stuff to include 
    #==============================================================================
    
    # Builders of this project may need to change these parameters. 
    # 
    # Make sure that Python.h is in one of the INCLUDEPATH directories. 
    # 
    # grep for "libpython" to find the dynamic library file that should be added 
    # to LIBS. 
    
    macx {
        INCLUDEPATH += /Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m 
        LIBS +=        /Library/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4.dylib
    
        INCLUDEPATH += /Library/Frameworks/QtCore.framework/Versions/4/Headers
    }
    linux-g++ {
        # When Python3 is installed on wherever, it should be installed with
        # "./configure --enable-shared". This is necessary so that the library files
        # generated contain position independent (-fPIC) code. 
        INCLUDEPATH += /usr/local/include/python3.4m
        LIBS += /usr/local/lib/python3.4/config-3.4m/libpython3.4m.a
    }
    
    #==============================================================================
    # Code we want to wrap 
    #==============================================================================
    
    HEADERS += codetowrap.hpp 
    SOURCES += codetowrap.cpp 
    
    # Run SWIG! 
    system(swig -Wall -c++ -python codetowrap.i)
    
    # SWIG-generated files 
    SOURCES += codetowrap_wrap.cxx 
    
    macx {
        QMAKE_LFLAGS_PLUGIN -= -dynamiclib
        QMAKE_LFLAGS_PLUGIN += -bundle
    }
    linux-g++ {
        QMAKE_LFLAGS_PLUGIN += -fPIC
    }
    
    TARGET = codetowrap
    
    # Bundles have no strictly enforced file extension, but swig expects the 
    # libraries it uses to be of the form _<module name>.so , so rename the output
    # file. (Don't forget the leading underscore. It's a common pitfall.)
    macx {
        QMAKE_POST_LINK = "mv libcodetowrap.dylib _codetowrap.so"
    }
    linux-g++ {
        QMAKE_POST_LINK = "mv libcodetowrap.so _codetowrap.so"
    }
    
    DESTDIR = .

I can then build the project using 

    make clean & qmake -spec macx-g++ c699util.pro && make release

Hope it helps!
-Mark 


On Wed, Aug 3, 2016 at 9:10 AM Grégory S <[hidden email]> wrote:
Ps: I export to C#

2016-08-03 12:01 GMT+02:00 Grégory S <[hidden email]>:
Hi,

I need to wrap a library which use QT Core. It does not use GUI.
The library use:
QString
QMap
QVector
QStringList
QSet
QColor
QDateTime

How can i wrap this library ?
Do i have to had all QT .h in the .i file ? In which order ? I try but there are some errors i do not understand.

Thanks,
Regards,
Gregory

------------------------------------------------------------------------------
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user

------------------------------------------------------------------------------

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: Use Swig to wrap a library using QT

Grégory S
Thanks for your answer.
If i use this interface file:

------------------------------------------
%module qt_test_library

%include "std_string.i"
%include "std_vector.i"
%include "std_map.i"

%{
   #include "Qt_test.h"

    #include <QDebug>
    #include <QStringList>
    #include <QFileInfo> 
    #include <QDir> 
    #include <QString>  
    #include <cstring>
    #include <string> 
    #include <iostream> 
    #include <stdlib.h>
    #include <stdexcept> 
    #include <assert.h> 
%}

%include "Qt_test.h"
------------------------------------------

It will generate a .cs file named: SWIGTYPE_p_QString.cs
How will my C# code handle this type ? How can i get a CSharp String from it ? How can i affect to it a  CSharp String ?

Gregory






2016-08-03 17:15 GMT+02:00 Mark Pallone <[hidden email]>:
I have a project that does the same thing, except that it exposes Qt/C++ code to Python. 

I'm on vacation and don't want to spend a lot of time replying, but "cookbooking" off of my interface and project files might help you. So, here's a stripped down version of my interface file: 

    %module mymodule 
    
    %include "std_string.i"
    %include "std_vector.i"
    %include "std_map.i"
    
    %{
    #include "mymodule.hpp" 
    
    // Not all of these are necessary, but it's simpler to just 
    // make it match the header file that we're providing the 
    // interface to. 
    #include <QDebug>
    #include <QPolygon>    
    #include <QPoint> 
    #include <QStringList>
    #include <QFileInfo> 
    #include <QDir> 
    #include <QString>  
    #include <cstring>
    #include <string> 
    #include <iostream> 
    #include <stdlib.h>
    #include <stdexcept> 
    #include <assert.h> 
    #include "library1.hpp"
    #include "library2.hpp"
     
    using namespace mymodule; 
    
    %}
    
    namespace std {
       // Tell SWIG about our data structures 
       %template(vectori) vector<int>;
       %template(vectord) vector<double>;
    };
    
    namespace mymodule {
    
    /*****************************************************************************
     * Library initialization and utilities 
     *****************************************************************************/ 
    
    void initmymodule(std::string filename = ""); 
    
    
    /* Other wrapped code declarations go here */ 
    
    
    } // namespace


And here's a simplified version of my .pro file: 

    
    #==============================================================================
    # Typical Qt initialization 
    #==============================================================================
    
    TEMPLATE = lib 
    # CONFIG += qt warn_on release 
    CONFIG += qt warn_on debug_and_release
    CONFIG += plugin
    
    linux-g++ {
        CONFIG += dll 
    }
    
    
    LIB_DEPENDENCIES = library1 library2 
    
    include(../custom.pri)
    
    release {
        DEFINES += QT_NO_DEBUG_OUTPUT
    }
    
    macx {
        LIBS += -L../libs/macx 
    }
    linux-g++ {
        LIBS += -L../libs/unix 
    }
    
    INCLUDEPATH += ../library1
    INCLUDEPATH += ../library2
    
    
    
    HEADERS += ../library1/library1.hpp
    SOURCES += ../library1/library1.cpp
    
    HEADERS += ../library2/library2.hpp 
    SOURCES += ../library2/library2.cpp
    
    
    
    
    #==============================================================================
    # Python 3 stuff to include 
    #==============================================================================
    
    # Builders of this project may need to change these parameters. 
    # 
    # Make sure that Python.h is in one of the INCLUDEPATH directories. 
    # 
    # grep for "libpython" to find the dynamic library file that should be added 
    # to LIBS. 
    
    macx {
        INCLUDEPATH += /Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m 
        LIBS +=        /Library/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4.dylib
    
        INCLUDEPATH += /Library/Frameworks/QtCore.framework/Versions/4/Headers
    }
    linux-g++ {
        # When Python3 is installed on wherever, it should be installed with
        # "./configure --enable-shared". This is necessary so that the library files
        # generated contain position independent (-fPIC) code. 
        INCLUDEPATH += /usr/local/include/python3.4m
        LIBS += /usr/local/lib/python3.4/config-3.4m/libpython3.4m.a
    }
    
    #==============================================================================
    # Code we want to wrap 
    #==============================================================================
    
    HEADERS += codetowrap.hpp 
    SOURCES += codetowrap.cpp 
    
    # Run SWIG! 
    system(swig -Wall -c++ -python codetowrap.i)
    
    # SWIG-generated files 
    SOURCES += codetowrap_wrap.cxx 
    
    macx {
        QMAKE_LFLAGS_PLUGIN -= -dynamiclib
        QMAKE_LFLAGS_PLUGIN += -bundle
    }
    linux-g++ {
        QMAKE_LFLAGS_PLUGIN += -fPIC
    }
    
    TARGET = codetowrap
    
    # Bundles have no strictly enforced file extension, but swig expects the 
    # libraries it uses to be of the form _<module name>.so , so rename the output
    # file. (Don't forget the leading underscore. It's a common pitfall.)
    macx {
        QMAKE_POST_LINK = "mv libcodetowrap.dylib _codetowrap.so"
    }
    linux-g++ {
        QMAKE_POST_LINK = "mv libcodetowrap.so _codetowrap.so"
    }
    
    DESTDIR = .

I can then build the project using 

    make clean & qmake -spec macx-g++ c699util.pro && make release

Hope it helps!
-Mark 


On Wed, Aug 3, 2016 at 9:10 AM Grégory S <[hidden email]> wrote:
Ps: I export to C#

2016-08-03 12:01 GMT+02:00 Grégory S <[hidden email]>:
Hi,

I need to wrap a library which use QT Core. It does not use GUI.
The library use:
QString
QMap
QVector
QStringList
QSet
QColor
QDateTime

How can i wrap this library ?
Do i have to had all QT .h in the .i file ? In which order ? I try but there are some errors i do not understand.

Thanks,
Regards,
Gregory

------------------------------------------------------------------------------
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user


------------------------------------------------------------------------------

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: Use Swig to wrap a library using QT

Mark Pallone
I'm not sure. FWIW, when the library I was wrapping returned QStrings, I wrote wrapper code around it that would return C++ strings instead. If I needed fancier data types, I would use %pythoncode to construct them on the Python side. I've never worked with C#, so I'm not sure if you have the latter option. 

-Mark

On Wed, Aug 3, 2016 at 12:56 PM Grégory S <[hidden email]> wrote:
Thanks for your answer.
If i use this interface file:

------------------------------------------
%module qt_test_library

%include "std_string.i"
%include "std_vector.i"
%include "std_map.i"

%{
   #include "Qt_test.h"

    #include <QDebug>
    #include <QStringList>
    #include <QFileInfo> 
    #include <QDir> 
    #include <QString>  
    #include <cstring>
    #include <string> 
    #include <iostream> 
    #include <stdlib.h>
    #include <stdexcept> 
    #include <assert.h> 
%}

%include "Qt_test.h"
------------------------------------------

It will generate a .cs file named: SWIGTYPE_p_QString.cs
How will my C# code handle this type ? How can i get a CSharp String from it ? How can i affect to it a  CSharp String ?

Gregory






2016-08-03 17:15 GMT+02:00 Mark Pallone <[hidden email]>:
I have a project that does the same thing, except that it exposes Qt/C++ code to Python. 

I'm on vacation and don't want to spend a lot of time replying, but "cookbooking" off of my interface and project files might help you. So, here's a stripped down version of my interface file: 

    %module mymodule 
    
    %include "std_string.i"
    %include "std_vector.i"
    %include "std_map.i"
    
    %{
    #include "mymodule.hpp" 
    
    // Not all of these are necessary, but it's simpler to just 
    // make it match the header file that we're providing the 
    // interface to. 
    #include <QDebug>
    #include <QPolygon>    
    #include <QPoint> 
    #include <QStringList>
    #include <QFileInfo> 
    #include <QDir> 
    #include <QString>  
    #include <cstring>
    #include <string> 
    #include <iostream> 
    #include <stdlib.h>
    #include <stdexcept> 
    #include <assert.h> 
    #include "library1.hpp"
    #include "library2.hpp"
     
    using namespace mymodule; 
    
    %}
    
    namespace std {
       // Tell SWIG about our data structures 
       %template(vectori) vector<int>;
       %template(vectord) vector<double>;
    };
    
    namespace mymodule {
    
    /*****************************************************************************
     * Library initialization and utilities 
     *****************************************************************************/ 
    
    void initmymodule(std::string filename = ""); 
    
    
    /* Other wrapped code declarations go here */ 
    
    
    } // namespace


And here's a simplified version of my .pro file: 

    
    #==============================================================================
    # Typical Qt initialization 
    #==============================================================================
    
    TEMPLATE = lib 
    # CONFIG += qt warn_on release 
    CONFIG += qt warn_on debug_and_release
    CONFIG += plugin
    
    linux-g++ {
        CONFIG += dll 
    }
    
    
    LIB_DEPENDENCIES = library1 library2 
    
    include(../custom.pri)
    
    release {
        DEFINES += QT_NO_DEBUG_OUTPUT
    }
    
    macx {
        LIBS += -L../libs/macx 
    }
    linux-g++ {
        LIBS += -L../libs/unix 
    }
    
    INCLUDEPATH += ../library1
    INCLUDEPATH += ../library2
    
    
    
    HEADERS += ../library1/library1.hpp
    SOURCES += ../library1/library1.cpp
    
    HEADERS += ../library2/library2.hpp 
    SOURCES += ../library2/library2.cpp
    
    
    
    
    #==============================================================================
    # Python 3 stuff to include 
    #==============================================================================
    
    # Builders of this project may need to change these parameters. 
    # 
    # Make sure that Python.h is in one of the INCLUDEPATH directories. 
    # 
    # grep for "libpython" to find the dynamic library file that should be added 
    # to LIBS. 
    
    macx {
        INCLUDEPATH += /Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m 
        LIBS +=        /Library/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4.dylib
    
        INCLUDEPATH += /Library/Frameworks/QtCore.framework/Versions/4/Headers
    }
    linux-g++ {
        # When Python3 is installed on wherever, it should be installed with
        # "./configure --enable-shared". This is necessary so that the library files
        # generated contain position independent (-fPIC) code. 
        INCLUDEPATH += /usr/local/include/python3.4m
        LIBS += /usr/local/lib/python3.4/config-3.4m/libpython3.4m.a
    }
    
    #==============================================================================
    # Code we want to wrap 
    #==============================================================================
    
    HEADERS += codetowrap.hpp 
    SOURCES += codetowrap.cpp 
    
    # Run SWIG! 
    system(swig -Wall -c++ -python codetowrap.i)
    
    # SWIG-generated files 
    SOURCES += codetowrap_wrap.cxx 
    
    macx {
        QMAKE_LFLAGS_PLUGIN -= -dynamiclib
        QMAKE_LFLAGS_PLUGIN += -bundle
    }
    linux-g++ {
        QMAKE_LFLAGS_PLUGIN += -fPIC
    }
    
    TARGET = codetowrap
    
    # Bundles have no strictly enforced file extension, but swig expects the 
    # libraries it uses to be of the form _<module name>.so , so rename the output
    # file. (Don't forget the leading underscore. It's a common pitfall.)
    macx {
        QMAKE_POST_LINK = "mv libcodetowrap.dylib _codetowrap.so"
    }
    linux-g++ {
        QMAKE_POST_LINK = "mv libcodetowrap.so _codetowrap.so"
    }
    
    DESTDIR = .

I can then build the project using 

    make clean & qmake -spec macx-g++ c699util.pro && make release

Hope it helps!
-Mark 


On Wed, Aug 3, 2016 at 9:10 AM Grégory S <[hidden email]> wrote:
Ps: I export to C#

2016-08-03 12:01 GMT+02:00 Grégory S <[hidden email]>:
Hi,

I need to wrap a library which use QT Core. It does not use GUI.
The library use:
QString
QMap
QVector
QStringList
QSet
QColor
QDateTime

How can i wrap this library ?
Do i have to had all QT .h in the .i file ? In which order ? I try but there are some errors i do not understand.

Thanks,
Regards,
Gregory

------------------------------------------------------------------------------
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user


------------------------------------------------------------------------------

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: Use Swig to wrap a library using QT

William S Fulton
There is some recent info which may be of interest on QT and SWIG in
this ticket: https://github.com/swig/swig/issues/88

William

On 3 August 2016 at 18:06, Mark Pallone <[hidden email]> wrote:

> I'm not sure. FWIW, when the library I was wrapping returned QStrings, I
> wrote wrapper code around it that would return C++ strings instead. If I
> needed fancier data types, I would use %pythoncode to construct them on the
> Python side. I've never worked with C#, so I'm not sure if you have the
> latter option.
>
> -Mark
>
> On Wed, Aug 3, 2016 at 12:56 PM Grégory S <[hidden email]> wrote:
>>
>> Thanks for your answer.
>> If i use this interface file:
>>
>> ------------------------------------------
>> %module qt_test_library
>>
>> %include "std_string.i"
>> %include "std_vector.i"
>> %include "std_map.i"
>>
>> %{
>>    #include "Qt_test.h"
>>
>>     #include <QDebug>
>>     #include <QStringList>
>>     #include <QFileInfo>
>>     #include <QDir>
>>     #include <QString>
>>     #include <cstring>
>>     #include <string>
>>     #include <iostream>
>>     #include <stdlib.h>
>>     #include <stdexcept>
>>     #include <assert.h>
>> %}
>>
>> %include "Qt_test.h"
>> ------------------------------------------
>>
>> It will generate a .cs file named: SWIGTYPE_p_QString.cs
>> How will my C# code handle this type ? How can i get a CSharp String from
>> it ? How can i affect to it a  CSharp String ?
>>
>> Gregory
>>
>>
>>
>>
>>
>>
>> 2016-08-03 17:15 GMT+02:00 Mark Pallone <[hidden email]>:
>>>
>>> I have a project that does the same thing, except that it exposes Qt/C++
>>> code to Python.
>>>
>>> I'm on vacation and don't want to spend a lot of time replying, but
>>> "cookbooking" off of my interface and project files might help you. So,
>>> here's a stripped down version of my interface file:
>>>
>>>     %module mymodule
>>>
>>>     %include "std_string.i"
>>>     %include "std_vector.i"
>>>     %include "std_map.i"
>>>
>>>     %{
>>>     #include "mymodule.hpp"
>>>
>>>     // Not all of these are necessary, but it's simpler to just
>>>     // make it match the header file that we're providing the
>>>     // interface to.
>>>     #include <QDebug>
>>>     #include <QPolygon>
>>>     #include <QPoint>
>>>     #include <QStringList>
>>>     #include <QFileInfo>
>>>     #include <QDir>
>>>     #include <QString>
>>>     #include <cstring>
>>>     #include <string>
>>>     #include <iostream>
>>>     #include <stdlib.h>
>>>     #include <stdexcept>
>>>     #include <assert.h>
>>>     #include "library1.hpp"
>>>     #include "library2.hpp"
>>>
>>>     using namespace mymodule;
>>>
>>>     %}
>>>
>>>     namespace std {
>>>        // Tell SWIG about our data structures
>>>        %template(vectori) vector<int>;
>>>        %template(vectord) vector<double>;
>>>     };
>>>
>>>     namespace mymodule {
>>>
>>>
>>> /*****************************************************************************
>>>      * Library initialization and utilities
>>>
>>> *****************************************************************************/
>>>
>>>     void initmymodule(std::string filename = "");
>>>
>>>
>>>     /* Other wrapped code declarations go here */
>>>
>>>
>>>     } // namespace
>>>
>>>
>>> And here's a simplified version of my .pro file:
>>>
>>>
>>>
>>> #==============================================================================
>>>     # Typical Qt initialization
>>>
>>> #==============================================================================
>>>
>>>     TEMPLATE = lib
>>>     # CONFIG += qt warn_on release
>>>     CONFIG += qt warn_on debug_and_release
>>>     CONFIG += plugin
>>>
>>>     linux-g++ {
>>>         CONFIG += dll
>>>     }
>>>
>>>
>>>     LIB_DEPENDENCIES = library1 library2
>>>
>>>     include(../custom.pri)
>>>
>>>     release {
>>>         DEFINES += QT_NO_DEBUG_OUTPUT
>>>     }
>>>
>>>     macx {
>>>         LIBS += -L../libs/macx
>>>     }
>>>     linux-g++ {
>>>         LIBS += -L../libs/unix
>>>     }
>>>
>>>     INCLUDEPATH += ../library1
>>>     INCLUDEPATH += ../library2
>>>
>>>
>>>
>>>     HEADERS += ../library1/library1.hpp
>>>     SOURCES += ../library1/library1.cpp
>>>
>>>     HEADERS += ../library2/library2.hpp
>>>     SOURCES += ../library2/library2.cpp
>>>
>>>
>>>
>>>
>>>
>>> #==============================================================================
>>>     # Python 3 stuff to include
>>>
>>> #==============================================================================
>>>
>>>     # Builders of this project may need to change these parameters.
>>>     #
>>>     # Make sure that Python.h is in one of the INCLUDEPATH directories.
>>>     #
>>>     # grep for "libpython" to find the dynamic library file that should
>>> be added
>>>     # to LIBS.
>>>
>>>     macx {
>>>         INCLUDEPATH +=
>>> /Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m
>>>         LIBS +=
>>> /Library/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4.dylib
>>>
>>>         INCLUDEPATH +=
>>> /Library/Frameworks/QtCore.framework/Versions/4/Headers
>>>     }
>>>     linux-g++ {
>>>         # When Python3 is installed on wherever, it should be installed
>>> with
>>>         # "./configure --enable-shared". This is necessary so that the
>>> library files
>>>         # generated contain position independent (-fPIC) code.
>>>         INCLUDEPATH += /usr/local/include/python3.4m
>>>         LIBS += /usr/local/lib/python3.4/config-3.4m/libpython3.4m.a
>>>     }
>>>
>>>
>>> #==============================================================================
>>>     # Code we want to wrap
>>>
>>> #==============================================================================
>>>
>>>     HEADERS += codetowrap.hpp
>>>     SOURCES += codetowrap.cpp
>>>
>>>     # Run SWIG!
>>>     system(swig -Wall -c++ -python codetowrap.i)
>>>
>>>     # SWIG-generated files
>>>     SOURCES += codetowrap_wrap.cxx
>>>
>>>     macx {
>>>         QMAKE_LFLAGS_PLUGIN -= -dynamiclib
>>>         QMAKE_LFLAGS_PLUGIN += -bundle
>>>     }
>>>     linux-g++ {
>>>         QMAKE_LFLAGS_PLUGIN += -fPIC
>>>     }
>>>
>>>     TARGET = codetowrap
>>>
>>>     # Bundles have no strictly enforced file extension, but swig expects
>>> the
>>>     # libraries it uses to be of the form _<module name>.so , so rename
>>> the output
>>>     # file. (Don't forget the leading underscore. It's a common pitfall.)
>>>     macx {
>>>         QMAKE_POST_LINK = "mv libcodetowrap.dylib _codetowrap.so"
>>>     }
>>>     linux-g++ {
>>>         QMAKE_POST_LINK = "mv libcodetowrap.so _codetowrap.so"
>>>     }
>>>
>>>     DESTDIR = .
>>>
>>> I can then build the project using
>>>
>>>     make clean & qmake -spec macx-g++ c699util.pro && make release
>>>
>>> Hope it helps!
>>> -Mark
>>>
>>>
>>> On Wed, Aug 3, 2016 at 9:10 AM Grégory S <[hidden email]> wrote:
>>>>
>>>> Ps: I export to C#
>>>>
>>>> 2016-08-03 12:01 GMT+02:00 Grégory S <[hidden email]>:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I need to wrap a library which use QT Core. It does not use GUI.
>>>>> The library use:
>>>>> QString
>>>>> QMap
>>>>> QVector
>>>>> QStringList
>>>>> QSet
>>>>> QColor
>>>>> QDateTime
>>>>>
>>>>> How can i wrap this library ?
>>>>> Do i have to had all QT .h in the .i file ? In which order ? I try but
>>>>> there are some errors i do not understand.
>>>>>
>>>>> Thanks,
>>>>> Regards,
>>>>> Gregory
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> _______________________________________________
>>>> Swig-user mailing list
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/swig-user
>>
>>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Swig-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/swig-user
>

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user