Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using QMAKE_EXTRA_COMPILERS
Forum Updated to NodeBB v4.3 + New Features

Using QMAKE_EXTRA_COMPILERS

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 347 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KeithS
    wrote on last edited by
    #1

    I've been trying to get qmake to build python wrapper files for c++ using SWIG. The .pri file has this:

    swig for ui.i

    #GENERATED_SOURCES += \

    ui_wrap.cxx

    #SWIG_FILES += \

    ui.i

    #swig.input = SWIG_FILES
    #swig.variable_out = GENERATED_SOURCES
    #swig.commands = /usr/local/bin/swig -w454 -c++ -python ${QMAKE_FILE_NAME};
    #swig.output = ${QMAKE_FILE_BASE}_wrap.cxx
    #QMAKE_EXTRA_COMPILERS += swig

    This works fine if qmake / make is run from the command line (this is on OSX, similar for Linux). But if I try and build the app using Qt Creator in shadow build mode, it doesn't work. And the reason it doesn't work is that under Qt Creator, make is expecting to find the ui_wrap.cxx file in the build/glade shadow directory, whereas it only exists in the source tree.

    More precisely, the makefile qmake generates has all c++ files as ../../projdir/*.cpp i.e. relative paths from the shadow build dir to the source tree, but ui_wrap.cxx has no relative path.

    Am I missing something obvious? Resource files generated by rcc are placed in the shadow build tree, so they get compiled correct But QMAKE_EXTRA_COMPILERS is not doing the same...

    kkoehneK 1 Reply Last reply
    0
    • K KeithS

      I've been trying to get qmake to build python wrapper files for c++ using SWIG. The .pri file has this:

      swig for ui.i

      #GENERATED_SOURCES += \

      ui_wrap.cxx

      #SWIG_FILES += \

      ui.i

      #swig.input = SWIG_FILES
      #swig.variable_out = GENERATED_SOURCES
      #swig.commands = /usr/local/bin/swig -w454 -c++ -python ${QMAKE_FILE_NAME};
      #swig.output = ${QMAKE_FILE_BASE}_wrap.cxx
      #QMAKE_EXTRA_COMPILERS += swig

      This works fine if qmake / make is run from the command line (this is on OSX, similar for Linux). But if I try and build the app using Qt Creator in shadow build mode, it doesn't work. And the reason it doesn't work is that under Qt Creator, make is expecting to find the ui_wrap.cxx file in the build/glade shadow directory, whereas it only exists in the source tree.

      More precisely, the makefile qmake generates has all c++ files as ../../projdir/*.cpp i.e. relative paths from the shadow build dir to the source tree, but ui_wrap.cxx has no relative path.

      Am I missing something obvious? Resource files generated by rcc are placed in the shadow build tree, so they get compiled correct But QMAKE_EXTRA_COMPILERS is not doing the same...

      kkoehneK Offline
      kkoehneK Offline
      kkoehne
      Moderators
      wrote on last edited by
      #2

      You need to tell swig to generate the file in the build directory, where qmake (and therefore also make) expects it. E.g.

      swig.commands = /usr/local/bin/swig -w454 -c++ -python ${QMAKE_FILE_NAME} -o {QMAKE_FILE_OUT}
      

      Director R&D, The Qt Company

      1 Reply Last reply
      1
      • K Offline
        K Offline
        KeithS
        wrote on last edited by
        #3

        Thats' a good idea, I'll give it a try.

        A slightly more complicated workaround was to specify:
        swig.output = ../../project/${QMAKE_FILE_BASE}_wrap.cxx
        GENERATED_SOURCES += ../../project/ui_wrap.cxx

        which keeps the wrapper file location but adds a relative path to it which is valid for both the source tree and shadow build tree.

        But that is not as neat as your idea.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved