[Qt-interest] Distributing Qt with source code usingVisualStudio

Eli Hooten elir.hooten at gmail.com
Wed Jul 6 19:47:27 CEST 2011


Daniel,

This has been really helpful, and I think it gets to the main problem with
my approach. In my .vcproj that uses Qt, the property page is severely
limited versus what I see when I just create the standard Empty Project
(File -> New Project -> Select Empty Project from the available types). For
example, in the Empty Project I have all of the options you specify in its
property page (e.g.,  Configuration Properties has linker, C/C++, etc);
however, in the Qt project, I only have General, Debugging, and NMake under
the Configuration Properties, so I cannot do things like specify additional
dependencies. Is there a way to do this in the .pro file, perhaps?

Right now my solution works except for specifying the additional
dependencies, so as a post-build event I have to copy the needed Qt dlls
into the same directory at the .exe I am building. It's not the best
approach, but it works for now, I guess. Although I would rather have the
dependency known in the .pro file so I don't have to rely on a batch script
to copy the appropriate DLLs all over the place.

Thanks,
Eli

On Wed, Jul 6, 2011 at 11:53 AM, Daniel Bowen
<qtmailinglist1 at bowensite.com>wrote:

> 7. Should be “… General -> Intermediate Directory” not Output Directory***
> *
>
> ** **
>
> -Daniel****
>
> ** **
>
> *From:* Daniel Bowen [mailto:qtmailinglist1 at bowensite.com]
> *Sent:* Wednesday, July 06, 2011 10:51 AM
>
> *To:* 'qt-interest at qt.nokia.com'
> *Cc:* 'Eli Hooten'
> *Subject:* RE: [Qt-interest] Distributing Qt with source code
> usingVisualStudio****
>
> ** **
>
> Oh, I should also give a couple more common settings that go along with all
> this:****
>
> ** **
>
> 6. Project Output Directory:****
>
> Project Properties -> (Select all Configurations and Platforms) ->
> Configuration Properties -> General -> Output Directory****
>
> Example: ..\..\..\bin\Windows-$(PlatformName)\$(ConfigurationName)****
>
> ** **
>
> 7. Project Intermediate Directory:****
>
> Project Properties -> (Select all Configurations and Platforms) ->
> Configuration Properties -> General -> Output Directory****
>
> Example:
> ..\..\..\obj\Windows-$(PlatformName)\$(ConfigurationName)\$(ProjectName)**
> **
>
> ** **
>
> -Daniel****
>
> ** **
>
> *From:* Daniel Bowen [mailto:qtmailinglist1 at bowensite.com]
> *Sent:* Wednesday, July 06, 2011 10:02 AM
> *To:* 'qt-interest at qt.nokia.com'
> *Cc:* 'Eli Hooten'
> *Subject:* RE: [Qt-interest] Distributing Qt with source code
> usingVisualStudio****
>
> ** **
>
> So, for the scenario I had outlined earlier, here's where those Visual
> Studio project properties are set (using Visual Studio 2008).  I wouldn't
> set project debugging properties to find DLLs.  Project debugging properties
> however are handy if you're going to specify command line arguments for your
> own debugging (and like you noticed, those end up in the per-user .suo
> file).****
>
> ** **
>
> 1. Project Include Path:****
>
> Project Properties -> (Select all Configurations and Platforms) ->
> Configuration Properties -> C/C++ -> Additional Include Directories****
>
> Example: (For project under GroupAbc / Project1)****
>
> ..\..\..\include;..\..\..\..\ThirdParty\include****
>
> NOTE: We don't put include\QtCore, etc. directory in the include path,
> because we use #include <QtCore\QString>, etc.****
>
> ** **
>
> 2. Project Library Path:****
>
> Project Properties -> (Select all Configurations and Platforms) ->
> Configuration Properties -> Linker -> General -> Additional Library
> Directories****
>
> Example: (For project under GroupAbc / Project1)****
>
>
> "..\..\..\lib\Windows-$(PlatformName)\$(ConfigurationName)\";"..\..\..\..\GroupDef\lib\Windows-$(PlatformName)\$(ConfigurationName)\";"..\..\..\..\ThirdParty\lib\Windows-$(PlatformName)\$(ConfigurationName)\Qt\"
> ****
>
> NOTE: $(PlatformName) is a Visual Studio variable, and ends up being Win32
> (or x64, etc., depending on what platforms you have added).
> $(ConfigurationName) is a Visual Studio variable that ends up being the name
> of your configuration (such as Debug or Release).  Also note, that we put
> all the .lib files for Qt related DLLs into the lib\(platform)\(config)\Qt
> directory in source control.****
>
> ** **
>
> 3. Project Library Dependencies, Debug:****
>
> Project Properties -> (Select only Debug Configuration and all Platforms)
> -> Configuration Properties -> Linker -> Input-> Additional Dependencies**
> **
>
> Example: Ws2_32.lib Project2.lib Project3.lib QtCored4.lib QtNetworkd4.lib
> ****
>
> NOTE: Debug Qt libraries have a "d" suffix.****
>
> ** **
>
> 4. Project Library Dependencies, Release:****
>
> Project Properties -> (Select only Release Configuration and all Platforms)
> -> Configuration Properties -> Linker -> Input-> Additional Dependencies**
> **
>
> Example: Ws2_32.lib Project2.lib Project3.lib QtCore4.lib QtNetwork4.lib**
> **
>
> ** **
>
> 5. Project Post-Build Event:****
>
> Project Properties -> (Select all Configurations and Platforms) ->
> Configuration Properties -> Build Events -> Post-Build Event -> Command Line
> ****
>
> Example: For our projects, we always have a file for Windows called
> "Publish-Windows.bat" that lives under the project directory (not under
> src). We also reference this file in the project just for convenience by
> making a Visual Studio folder "Script Files" and referencing the
> Publish-Windows.bat under there.  Then, our post-build command line always
> looks the same:****
>
> (hit the ... to edit - don't edit on the single line)****
>
> set _Build_ProjectDir=$(ProjectDir)****
>
> set _Build_TargetDir=$(TargetDir)****
>
> set _Build_TargetPath=$(TargetPath)****
>
> set _Build_ConfigurationName=$(ConfigurationName)****
>
> set _Build_PlatformName=$(PlatformName)****
>
> pushd $(ProjectDir)****
>
> Publish-Windows.bat****
>
> popd****
>
> An example Publish-Windows.bat might look like:****
>
> @echo off****
>
> ** **
>
> SETLOCAL****
>
> ** **
>
> :: NOTE: This script depends on the current directory being the project
> directory****
>
> ** **
>
> :: NOTE: We build our .exe/.dll and .lib directly to "published"
> directories,****
>
> ::  so there's nothing more we need to do with them, or with others in our
> "group".****
>
> ::  However, any dependencies outside our group we copy here, so that we
> can debug.****
>
> ** **
>
> :: Dependencies****
>
> ** **
>
> :: Project3 from GroupDef****
>
> xcopy /Y /D /R /F
> ..\..\..\..\GroupDef\bin\Windows-%_Build_PlatformName%\%_Build_ConfigurationName%\Project3.*
> "%_Build_TargetDir%"****
>
> ** **
>
> :: Qt****
>
> xcopy /Y /D /R /F
> ..\..\..\..\ThirdParty\bin\Windows-%_Build_PlatformName%\%_Build_ConfigurationName%\QtCore*.*
> "%_Build_TargetDir%"****
>
> xcopy /Y /D /R /F
> ..\..\..\..\ThirdParty\bin\Windows-%_Build_PlatformName%\%_Build_ConfigurationName%\QtNetwork*.*
> "%_Build_TargetDir%"****
>
> xcopy /Y /D /R /F
> ..\..\..\..\ThirdParty\bin\Windows-%_Build_PlatformName%\%_Build_ConfigurationName%\QtXml*.*
> "%_Build_TargetDir%"****
>
> ** **
>
> :: QtNetwork depends on openssl****
>
> :: openssl (Win32, x64) - Always Release configuration****
>
> xcopy /Y /D /R /F
> ..\..\..\..\ThirdParty\bin\Windows-%_Build_PlatformName%\Release\libeay32.dll
> "%_Build_TargetDir%"****
>
> xcopy /Y /D /R /F
> ..\..\..\..\ThirdParty\bin\Windows-%_Build_PlatformName%\Release\libeay32.pdb
> "%_Build_TargetDir%"****
>
> xcopy /Y /D /R /F
> ..\..\..\..\ThirdParty\bin\Windows-%_Build_PlatformName%\Release\ssleay32.dll
> "%_Build_TargetDir%"****
>
> xcopy /Y /D /R /F
> ..\..\..\..\ThirdParty\bin\Windows-%_Build_PlatformName%\Release\ssleay32.pdb
> "%_Build_TargetDir%"****
>
> ** **
>
> :: log4c****
>
> xcopy /Y /D /R /F
> ..\..\..\..\ThirdParty\bin\Windows-%_Build_PlatformName%\%_Build_ConfigurationName%\log4c*.*
> "%_Build_TargetDir%"****
>
> ** **
>
> ENDLOCAL****
>
> ** **
>
> @echo on****
>
> ** **
>
> ** **
>
> Hope this helps,****
>
> -Daniel****
>
> ** **
>
> *From:* qt-interest-bounces+qtmailinglist1=bowensite.com at qt.nokia.com[mailto:
> qt-interest-bounces+qtmailinglist1=bowensite.com at qt.nokia.com] *On Behalf
> Of *Eli Hooten
> *Sent:* Tuesday, July 05, 2011 6:52 PM
> *To:* David Ching
> *Cc:* qt-interest at qt.nokia.com
> *Subject:* Re: [Qt-interest] Distributing Qt with source code
> usingVisualStudio****
>
> ** **
>
> Tony: That is what I am doing now manually. The problem is that the
> environment changes are not specific to the .vcproj, but rather to the .suo.
> Which is why I would have to distribute my .suo with the .vcproj, which I do
> not want to do.
>
>
> David: Interesting. I might give that approach a shot.
>
> Any other suggestions are welcome.
>
> Thanks,
> Eli****
>
> On Tue, Jul 5, 2011 at 6:42 PM, David Ching <dc at dcsoft.com> wrote:****
>
> "Eli Hooten" <elir.hooten at gmail.com> wrote in message
> news:<CAD7caDKbfW9urnXH5GHDXCSAYkXWTpmRhs1Ats1g6Uhw_yi4rA at mail.gmail.com
> >...****
>
> > (Note that if I don't add the $(QTDIR)\bin to PATH, the program launches
> > but errors with the "..cannot find QtGuid4.dll.." error, which shouldn't
> be
> > that surprising since I haven't told the application where to look!)****
>
> Perhaps you could add a post-build step that copies QtGuid4.dll, etc. to
> the
> folder containing your .exe?****
>
>
> -- David
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest****
>
> ** **
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110706/6bde0eeb/attachment.html 


More information about the Qt-interest-old mailing list