Couple of months earlier I wrote how to compile Qt projects (.pro files) from command line both on OS X and Windows. Basically it comes down to calling qmake executable and passing path to your .pro file and path to make spec file for specific compiler. It goes something like this:
C:\QT5_build\bin\qmake.exe [Path to your .pro file]
-r spec C:\QT5_build\mkspecs\win32-msvc2010
I am using shared .pri configuration files which I later include in my .pro files to have consistent settings across different project. In my base .pri settings files I define where are shared libraries, include files, platform specific compiler flags.
One of the things I want to control is where should output go, namely DESTDIR. I wanted to for my 32 bit builds to land in Output folder and 64 bit in Outputx64, both on Windows and OS X. Here is my shared configuration .pri file:
BUILD_TARGET = SimpleProjectName
win32{
PROJECT_FOLDER = ..\\..
}
else{
PROJECT_FOLDER = ../..
}
macx-clang{
OUTPUT_FOLDER = $$PROJECT_FOLDER/Outputx64
}
macx-clang-32{
OUTPUT_FOLDER = $$PROJECT_FOLDER/Output
}
win32{
SOURCE_FOLDER = $$PROJECT_FOLDER\\Source
OUTPUT_FOLDER = $$PROJECT_FOLDER\\Output$$(Platform)
TEMP_FOLDER = $$OUTPUT_FOLDER\\Temp
MODULE_TEMP_FOLDER = $$TEMP_FOLDER\\$$BUILD_TARGET
GENERATED_FOLDER = $$OUTPUT_FOLDER\\Generated
MODULE_GENERATED_FOLDER = $$MODULE_TEMP_FOLDER\\Generated
}
else{
SOURCE_FOLDER = $$PROJECT_FOLDER/Source
TEMP_FOLDER = $$OUTPUT_FOLDER/Temp
MODULE_TEMP_FOLDER = $$TEMP_FOLDER/$$BUILD_TARGET
GENERATED_FOLDER = $$OUTPUT_FOLDER/Generated
MODULE_GENERATED_FOLDER = $$MODULE_TEMP_FOLDER/Generated
}
CONFIG(debug, debug|release): CONFIGURATION = Debug
CONFIG(release, debug|release): CONFIGURATION = Release
win32{
CONFIGURATION_OUTPUT_FOLDER = $$OUTPUT_FOLDER\\$$CONFIGURATION
CONFIGURATION_MODULE_TEMP_FOLDER = $$MODULE_TEMP_FOLDER\\$$CONFIGURATION
}
else{
CONFIGURATION_OUTPUT_FOLDER = $$OUTPUT_FOLDER/$$CONFIGURATION
CONFIGURATION_MODULE_TEMP_FOLDER = $$MODULE_TEMP_FOLDER/$$CONFIGURATION
}
# set intermediate directories
win32{
UI_DIR = $$GENERATED_FOLDER\\Qt\\$$BUILD_TARGET
RCC_DIR = $$CONFIGURATION_MODULE_TEMP_FOLDER
MOC_DIR = $$MODULE_GENERATED_FOLDER
OBJECTS_DIR= $$CONFIGURATION_MODULE_TEMP_FOLDER
}
else{
UI_DIR = $$GENERATED_FOLDER/Qt/$$BUILD_TARGET
RCC_DIR = $$CONFIGURATION_MODULE_TEMP_FOLDER
MOC_DIR = $$MODULE_GENERATED_FOLDER
OBJECTS_DIR= $$CONFIGURATION_MODULE_TEMP_FOLDER
}
DESTDIR = $$CONFIGURATION_OUTPUT_FOLDER
With this configuration my project files are normally under "Source" folder and then I will get to right next to it Output or Outputx64 depending on -arch I am using. Inside Output folder there will be Debug or Release folder, based on configuration I am compiling. Next to Debug and Release there will be folders for Temp and Generated files. Something like this:
Key lines for mac OS X are number 11 and number 15. macx-clang is 64bit build configuration and macx-clang-32 is 32 bit build configuration. On line 21 I set Windows build configuration based on $$(Platform) variable. This will in case of 64 bit build add “x64” to “Output”. This flag works only for windows as far as I know.
Note: In order to be able to build both 32 and 64 bit executables with Qt on OS X platform Qt must be also compiled for desired architecture. To be able to build Qt on OS X for 32bit architecture Qt build must be configured with -platform macx-clang-32 flag before calling make command. For example:
./configure -opensource -confirm-license -platform macx-clang-32 -debug-and-release -no-compile-examples ….
Once again getting my hands dirty with old C++ MFC code and I ran into strange problem.
It looks like this has been well-known issue since VS 6.0 over VS2005 up to newest 2010 version.
If you are trying to debug C++ MFC application on 64Bit OS using Visual Studio 2010 you will most likely get System.AccessViolationException in “Unknow Module”.
Did some research over MSDN and as it turns out only solution to this problem is to disable RPC debugging.
In Visual Studio go to Tools->Options->Debugging->Native and just uncheck “Enable RPC debugging”. This setting is always enabled by default.
I will defiantly find my own post search for this solution in near future .
Hope it helps you and please don’t use MFC any more .