Page 1 of 2 12 LastLast
Results 1 to 20 of 24

Thread: Small task for Windows programmers

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

    Default Small task for Windows programmers

    I have a small and probably very simple task for people programming for Windows. Correct me if I'm wrong, but if you compile Qt from sources on Windows, you don't get start menu entries related to the build. Of course one can always create such a group and shortcuts himself, but why not write a small batch script that would do it for us? We could place it in the wiki, so that people can benefit from it. From my point of view the script should create entries such as shortcuts to Qt tools - Designer, Assistant, Linguist and to a Qt command prompt with all variables set - just like the menu Trolltech creates when installing from binary. Or maybe such a script already exists? In that case, could you point me to it?

  2. #2
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Small task for Windows programmers

    Quote Originally Posted by wysota View Post
    ...but why not write a small batch script that would do it for us?
    Are you volunteering?

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 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

    No, I'm looking for a volunteer I'm not experienced in Windows. I don't know how to add an entry to the menu from within a script, etc.

    Are you volunteering?

    Do you think this is a sane idea at all? It's just something that came to my mind after compiling Qt on Windows...
    Last edited by wysota; 25th October 2007 at 21:37. Reason: updated contents

  4. #4
    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

    . I don't know how to add an entry to the menu from within a script, etc.
    You can go around that and copy the links to the start menu folder.

    But I'll see what I can do when I have the time, maybe in the weekend. That is if someone doesn't do it till then.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 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

    But I don't have the links. I don't have a binary release installed, just the source. So the steps needed are:
    1. create links
    2. create a folder in the start menu
    3. move links to the above mentioned folder
    4. create a script that will setup all the vars
    5. create a link that will run the script
    6. move the link (or the script directly) to the folder
    7. say "voilla"

  6. #6
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Small task for Windows programmers

    Quote Originally Posted by wysota View Post
    Are you volunteering?
    No! I don't know much about Windows either. Which is why I use NSIS or BitRock to install Qt apps on that godforsaken platform.

  7. #7
    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

    No! I don't know much about Windows either. Which is why I use NSIS or BitRock to install Qt apps on that godforsaken platform.
    I first want to say that I literally hate Windows and any other MS product! But "godforsaken"? Come on guys... That operating system is more popular among developers than all the other platforms.
    I don't know much about the IT industries int you countries, but how does a developer can earn a decent buck there? From Linux programming? A .NET or JEE developer makes far more money than a developer doing c/c++ in Linux . I think that's a fact, at least for the past few years and at least a few to come.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 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

    For me it's easier to find a well paid assignment abroad than to look for it in Poland. I would probably find something I'd like to work on, but I doubt I'd be satisfied with the financial side of it. That's why it says "freelancer" in my LinkedIn profile.

  9. #9
    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
    But I don't have the links. I don't have a binary release installed, just the source. So the steps needed are:
    1. create links
    2. create a folder in the start menu
    3. move links to the above mentioned folder
    4. create a script that will setup all the vars
    5. create a link that will run the script
    6. move the link (or the script directly) to the folder
    7. say "voilla"
    Voilla!
    Since what you asked for is not possible with a batch script, I turned my head towards WSH. So you guys can find enclosed a small vb script, which you can test. If your Windows installation is somehow missing wscript, then you're out of luck, but normally, it should be there.
    The script will prompt you to enter the Qt instalation root, such as C:\Qt\4.3.2 and it will do the work from there.

    Currently it creates shortcuts for all the 4 tools and command prompt, and also creates a qtvars.bat which sets the environment. The makespec is hardcoded to win32-g++.

    To run the script, just double-click it.
    Attached Files Attached Files

  10. The following user says thank you to marcel for this useful post:

    wysota (27th October 2007)

  11. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 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

    Great! I'll test it tomorrow. Unfortunately I'll be testing it with msvc, but I understand fixing the specs shouldn't be much work.

  12. #11
    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
    Great! I'll test it tomorrow.
    It works fine for me, on Vista even, with UAC enabled. But some users have very strict security configurations (I call it paranoia) so the scripting host might be disabled.

    So, if possible, someone should test it on XP too, but my opinion is that if it works on Vista with UAC it should work very well on XP.

    If not, the only alternative is a native application that does the very same thing. Something like an installer.

    Unfortunately I'll be testing it with msvc, but I understand fixing the specs shouldn't be much work.
    Yes, just modify the line txtStream.WriteLine("set QMAKESPEC=win32-g++") with what you need, and also the comment above it. Or, edit the generated batch file.

    BTW, Qt should be already compiled when you run the script . If not, it will probably throw some runtime errors. I didn't exactly handled them all.
    Last edited by marcel; 27th October 2007 at 21:21.

  13. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 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.

  14. #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

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

  15. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 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...

  16. #15
    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

  17. #16
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 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...

  18. #17
    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?

  19. #18
    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.

  20. #19
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 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.

  21. #20
    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.

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.