Results 1 to 20 of 24

Thread: Small task for Windows programmers

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Small task for Windows programmers

    I wonder if it's possible to auto detect the specs like Qt does. The script could then be extended to find it itself.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Small task for Windows programmers

    What do you mean? Qt knows because it's reading the QMAKESPEC env variable.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Small task for Windows programmers

    Quote Originally Posted by marcel View Post
    What do you mean? Qt knows because it's reading the QMAKESPEC env variable.
    I mean to be able to auto detect the specs from within the script to set the variable in the first place. If QMAKESPEC is not set, I know qmake tries (and often manages) to detect it. Maybe the script could use it somehow... but it would require qmake to dump the information somewhere, maybe it does...

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Small task for Windows programmers

    Perhaps "qmake -query" and/or $QTDIR\.qmake.cache could help somehow? Basically it should be enough to ask for the location of qmake.exe and everything else could be then figured out..
    J-P Nurmi

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Small task for Windows programmers

    Under Linux in the specs directory there is a soft link called "default" that points to the default specs. I don't know if there is anything similar on Windows, but that could be a way to detect the specs.

    If we can't make it all happen from within a script, maybe a small statically compiled app using QWizard would be an option as well...

  6. #6
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Small task for Windows programmers

    Quote Originally Posted by wysota View Post
    Under Linux in the specs directory there is a soft link called "default" that points to the default specs. I don't know if there is anything similar on Windows, but that could be a way to detect the specs.

    If we can't make it all happen from within a script, maybe a small statically compiled app using QWizard would be an option as well...
    I thought of this too.
    I think I'm gonna make a wizard that also let's you fully configure, compile and install Qt Open Source.
    I don't know if I'm gonna write it with Qt or when it's gonna be ready, but I hope sometime soon.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Small task for Windows programmers

    Quote Originally Posted by marcel View Post
    What do you think about letting the user choose the make spec/compiler in the script interface?
    Yes, that's an option too. If it can't detect the platform itself, it can fall back to asking the user.

    Quote Originally Posted by marcel View Post
    I think I'm gonna make a wizard that also let's you fully configure, compile and install Qt Open Source.
    I thought of this too, but didn't have time to start working on it and also there is a problem with switches changes between different versions. If you wanted help, I'd be willing to provide it.

  8. #8
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Small task for Windows programmers

    Ok, just had a quick look at the qmake sources.
    It expects the user to provide the make spec either as a qmake option( -spec or -platform ) or in the QMAKESPEC environment variable. If it cannot find it this way, it takes the default, which is located in QTDIR/mkspecs/default. The problem is that in the opensource version this folder does not exist. In the version precompiled for mingw it exists and it is the same as win32-g++ and for the commercial versions is set according to the msvc version of the distribution.
    If it cannot find it in the default directory error it displays an error message:
    Qt Code:
    1. if(cmd & ReadConf) { // parse mkspec
    2. QString qmakespec = fixEnvVariables(Option::mkfile::qmakespec);
    3. QStringList mkspec_roots = qmake_mkspec_paths();
    4. debug_msg(2, "Looking for mkspec %s in (%s)", qmakespec.toLatin1().constData(),
    5. mkspec_roots.join("::").toLatin1().constData());
    6. if(qmakespec.isEmpty()) {
    7. for(QStringList::ConstIterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) {
    8. QString mkspec = (*it) + QDir::separator() + "default";
    9. QFileInfo default_info(mkspec);
    10. if(default_info.exists() && default_info.isDir()) {
    11. qmakespec = mkspec;
    12. break;
    13. }
    14. }
    15. if(qmakespec.isEmpty()) {
    16. fprintf(stderr, "QMAKESPEC has not been set, so configuration cannot be deduced.\n");
    17. return false;
    18. }
    19. Option::mkfile::qmakespec = qmakespec;
    20. }
    To copy to clipboard, switch view to plain text mode 
    So I think it is ok and enough to provide a dropdown or a list with all the makespecs available on windows and let the user choose from them

    ...and also there is a problem with switches changes between different versions
    No problem whatsoever. VS also has the option to switch between different Qt installations, but it does it internally.
    It is just a matter of setting the environment variables to the desired installation.

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Small task for Windows programmers

    Quote Originally Posted by marcel View Post
    No problem whatsoever. VS also has the option to switch between different Qt installations, but it does it internally.
    It is just a matter of setting the environment variables to the desired installation.
    No, I meant something else. Configuration options change between versions. To avoid creating a new installer for each new version, the software should be able to auto detect those switches and be able to handle them without rebuilding the installer.

  10. #10
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Small task for Windows programmers

    Yes, I see now. The problem with this is that the options are stored inside configure, which is an executable(vs a script on linux).

    I don't think there is a problem in creating a new version of the installer. Qt releases are not that often and I think it is normal to update the installer to handle the new qt version.

    Maybe the options together with their descriptions should be stored in an external file, which should be updated with every qt release, while keeping the options for the older releases. This way the installer doesn't have to be rebuilt.

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Small task for Windows programmers

    You can always run configure -help and inspect the options, so an external file is not that important. The problem is you have to think about handling those options afterwards The simplest solution is to just... ignore new switches or give a list of options to enable/modify them at the end of the configuration process and I think it's a good solution for a start.

  12. #12
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Small task for Windows programmers

    Quote Originally Posted by wysota View Post
    You can always run configure -help and inspect the options, so an external file is not that important. The problem is you have to think about handling those options afterwards The simplest solution is to just... ignore new switches or give a list of options to enable/modify them at the end of the configuration process and I think it's a good solution for a start.
    I'll think about it. I will choose the solution which seems most fit on a long term.
    I think I will start this project this week, but I don't know when it's gonna be ready. Hope it won't take more than two weeks.

  13. #13
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Small task for Windows programmers

    Perhaps "qmake -query" and/or $QTDIR\.qmake.cache could help somehow? Basically it should be enough to ask for the location of qmake.exe and everything else could be then figured out..
    I don't think we can use that... qmake -query QMAKE_MKSPECS only gives you the path where the make specs are located.

    but it would require qmake to dump the information somewhere, maybe it does...
    Maybe have the script output a test program and then call qmake and parse its output?
    I don't really trust this method. What if qmake can't tell the correct make spec?

    What do you think about letting the user choose the make spec/compiler in the script interface?

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.