Results 1 to 5 of 5

Thread: Separate Source, Build, and Install Directories

  1. #1

    Default Separate Source, Build, and Install Directories

    This has probably been asked a bazillion times before but can you build Qt in a different directory from the source directory? And can you install from the build directory into a different 3rd directory?

    While building the open source version on Windows, I see the following lines (albeit with hypothetical pathnames):

    Sources are in..............C:\Source\qt-win-opensource-src-4.4.1
    Build is done in............C:\Build\qt-default-cfg
    Install prefix..............C:\Install\qt-4

    This leads me to think that it can be done but the configure help message does not indicate options for doing such.

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Separate Source, Build, and Install Directories

    Quote Originally Posted by elemings View Post
    but the configure help message does not indicate options for doing such.
    I'm not sure about the build directory, but you can change installation directory without any problems:
    Qt Code:
    1. $ ./configure -help
    2. [...]
    3. Installation options:
    4.  
    5. These are optional, but you may specify install directories.
    6.  
    7. -prefix <dir> ...... This will install everything relative to <dir>
    8. (default /usr/local/Trolltech/Qt-4.4.1)
    9. [...]
    To copy to clipboard, switch view to plain text mode 

    P.S. Please don't post the same question more than once.

  3. #3
    Join Date
    Jul 2008
    Location
    Netherlands
    Posts
    33
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2
    Thanked 3 Times in 3 Posts

    Default Re: Separate Source, Build, and Install Directories

    I use a directory structure like this:
    Qt Code:
    1. /trunk
    2. --/build
    3. --/doc
    4. --/res
    5. --/src
    6. ----/include
    To copy to clipboard, switch view to plain text mode 
    and use a .pro file like:
    Qt Code:
    1. SRCDIR = ../src
    2. INCDIR = $$SRCDIR/include
    3. RESDIR = ../res
    4.  
    5. QT = core gui network xml
    6.  
    7. SOURCES += $$SRCDIR/main.cpp
    8. SOURCES += $$SRCDIR/appsettings.cpp
    9. SOURCES += $$SRCDIR/mainwindow.cpp
    10. SOURCES += $$SRCDIR/settingsdialog.cpp
    11.  
    12. HEADERS += $$INCDIR/appsettings.h
    13. HEADERS += $$INCDIR/mainwindow.h
    14. HEADERS += $$INCDIR/settingsdialog.h
    15.  
    16. FORMS += $$RESDIR/mainwindow.ui
    17. FORMS += $$RESDIR/settingsdialog.ui
    18.  
    19. RESOURCES = $$RESDIR/resources.qrc
    To copy to clipboard, switch view to plain text mode 
    and save this in the build directory.
    Of course, this .pro file was created manually, but I think this is doable for most projects. You could write a simple script that creates a .pro file like this for larger projects.

  4. #4

    Default Re: Separate Source, Build, and Install Directories

    Quote Originally Posted by jacek View Post
    I'm not sure about the build directory, but you can change installation directory without any problems:
    Qt Code:
    1. $ ./configure -help
    2. [...]
    3. Installation options:
    4.  
    5. These are optional, but you may specify install directories.
    6.  
    7. -prefix <dir> ...... This will install everything relative to <dir>
    8. (default /usr/local/Trolltech/Qt-4.4.1)
    9. [...]
    To copy to clipboard, switch view to plain text mode 
    That must be an option in the Mac and/or Linux configure command because it doesn't appear in the help message for the Windows configure command.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Separate Source, Build, and Install Directories

    Quote Originally Posted by elemings View Post
    That must be an option in the Mac and/or Linux configure command because it doesn't appear in the help message for the Windows configure command.
    Hmm... Indeed. I've never noticed that earlier.

    Take a look at .qmake.cache file.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.