Subdirs Projects targeting iOS from QtCreator 3.0.1 fail to build and run
-
I can build and run a simple iOS application as a single project, but I'd like to have better organization of my project files. I've decided to try and break my project up into apps and libs.
I create a Subdirs Project from QtCreator, then I add a C++ library project and a Qt Quick Application. The projects use the Desktop, iPhone and iPhone simulator kits.
MySubdirsProj.pro
@
CONFIG += ordered
TEMPLATE = subdirs
SUBDIRS +=
MyStaticLib
MyApp
@MyStaticLib/MyStaticLib.pro
@
CONFIG += static
QT -= gui
TARGET = MyStaticLib
TEMPLATE = lib
DEFINES += MYSTATICLIB_LIBRARY
SOURCES += mystaticlib.cpp
HEADERS += mystaticlib.h
mystaticlib_global.h
@MyApp/MyApp.pro
@Add more folders to ship with the application, here
folder_01.source = qml/MyApp
folder_01.target = qml
DEPLOYMENTFOLDERS = folder_01Additional import path used to resolve QML modules in Creator's code model
QML_IMPORT_PATH =
The .cpp file which was generated for your project. Feel free to hack it.
SOURCES += main.cpp
LIBS += -L../MyStaticLib -lMyStaticLibInstallation path
target.path =
Please do not modify the following two lines. Required for deployment.
include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
qtcAddDeployment()
@Building and running on the desktop works perfectly. However, targeting the iPhone simulator results in many errors.
Right clicking the parent MySubdirsProj and building results in the compile error:
@xcodebuild: error: The directory /Users/.../Projects/build-MySubdirsProj-iphonesimulator_clang_Qt_5_2_1_for_iOS-Debug/MyApp does not contain an Xcode project.@I can work around this error by 'handholding' qtcreator through the build process.
Right click the MyStaticLib, run qmake, then right click, build.
Right click the MyApp, run qmake, then right click, build.
Right click the MySubdirsProj, and build now works too.
Clicking run in QtCreator (with the iPhone simulator kit selected) results in the Application Output:
@Application path /Users/.../Projects/build-MySubdirsProj-iphonesimulator_clang_Qt_5_2_1_for_iOS-Debug/Debug-iphonesimulator/MyStaticLib.app doesn't exist!@Noticing that MyStaticLib is not an App, I right click the MyApp project and click run leading to this Application Output:
@Application path /Users/.../Projects/build-MySubdirsProj-iphonesimulator_clang_Qt_5_2_1_for_iOS-Debug/Debug-iphonesimulator/MyApp.app doesn't exist!@The xcodeproject and the app are built--but they're beneath the 'MyApp' subdirectory instead of directly in the aforementioned directory. For example, MyApp.app is located here:
@/Users/.../Projects/build-MySubdirsProj-iphonesimulator_clang_Qt_5_2_1_for_iOS-Debug/MyApp/Debug-iphonesimulator/MyApp.app@Best I can tell Subdirs Projects and iPhone kits don't mix.
I have a few questions.
Is there a way to make QtCreator's build and run commands work with Subdirs Projects using iphone kits? Maybe something I can do in the .pro files?
Can I run the iphone simulator from the command line, is there a smart way to do that so I can still debug using QtCreator?
What is the expected way to organize iOS applications? should everything just be in a single .pro file?
-
--
-
Qt Creator 3.1 will fix some issues with Subdirs projects and iOS applications.
"https://codereview.qt-project.org/#change,80503":https://codereview.qt-project.org/#change,80503In the mean time, I use this:
@Workaround for issues with QtCreator Subdirs projects and iOS
Copy the app bundle to the root build path
CONFIG(debug, debug|release) {
iphonesimulator:DESTDIR=$$OUT_PWD/../Debug-iphonesimulator
iphoneos:DESTDIR=$$OUT_PWD/../Debug-iphoneos
}
CONFIG(release, debug|release) {
iphonesimulator:DESTDIR=$$OUT_PWD/../../Release-iphonesimulator
iphoneos:DESTDIR=$$OUT_PWD/../../Release-iphoneos
}
@