[RESOLVED] Creator/qmake: Adding another project as a library on Windows



  • I managed to get this working on OS X using only Creator, but not in a cross-platform way. Now I'm trying to do it on Windows, and really it needs to be done cross-platform. A new requirement is that I also need it to work in Subversion. If it could even work for debug and release builds on all platforms, that would be sweet... but I think that's probably asking too much. I suspect I'll need to use some fancy qmake code, but what I've learned of it in the past is rather rusty.

    On OS X I had linked to the other project as an external library, but I'm not sure how well that would work in Subversion. Because these are test/example projects I expect them to be volatile, so one repo per project would be inconvenient. I intend to store multiple Qt projects in one repo, but they might not all be checked out together. If I use svn:externals I can ensure all the right libraries are always included, at the expense of duplicate versions of library projects within the projects that use them. This would make Creator's option for internal libraries more appropriate.

    I built my library project on Windows 7 but cannot find a .lib file for it anywhere, although I do have empty debug and release folders (in the build marked Debug... odd). Creator's wizard for internal libraries wants me to select a folder, but I can't find one to select which allows me to continue the wizard. Part of the issue here is that the dependent project always looks for iOS build directories, but that seems to be simplest problem to solve.

    So, does anyone have some advice? (Maybe I should split the SVN portion into a more relevant community, but I'm thinking it'd be best to get help with it from someone who also knows Creator/qmake.)

    EDIT:

    The dependent project's .pro file (with legacy code from OS X, broken on Windows):

    @#-------------------------------------------------

    Project created by QtCreator 2013-05-25T08:57:00

    #-------------------------------------------------

    QT += core gui widgets

    TARGET = FourSquare
    TEMPLATE = app
    CONFIG += c++11

    SOURCES +=
    mainwindow.cpp
    main.cpp
    sprite.cpp
    boxview.cpp

    HEADERS += mainwindow.h
    sprite.h
    boxview.h

    FORMS += mainwindow.ui

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Qnity/build-Qnity-iOS_Simulator-Release/release/ -lQnity
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Qnity/build-Qnity-iOS_Simulator-Release/debug/ -lQnity
    else:unix: LIBS += -L$$PWD/../../Qnity/build-Qnity-iOS_Simulator-Release/ -lQnity

    INCLUDEPATH += $$PWD/../../Qnity/build-Qnity-iOS_Simulator-Release
    INCLUDEPATH += $$PWD/../../Qnity/Qnity
    DEPENDPATH += $$PWD/../../Qnity/build-Qnity-iOS_Simulator-Release

    win32:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../Qnity/build-Qnity-iOS_Simulator-Release/release/Qnity.lib
    else:win32:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../Qnity/build-Qnity-iOS_Simulator-Release/debug/Qnity.lib
    else:unix: PRE_TARGETDEPS += $$PWD/../../Qnity/build-Qnity-iOS_Simulator-Release/libQnity.a

    cache()
    @

    The library project's .pro file:
    @#-------------------------------------------------

    Project created by QtCreator 2013-05-24T05:02:43

    #-------------------------------------------------

    QT += widgets opengl

    TARGET = Qnity
    TEMPLATE = lib
    CONFIG += staticlib c++11

    QMAKE_CXXFLAGS = -std=c++11

    SOURCES +=
    entity.cpp
    typed.cpp
    system.cpp
    entitymanager.cpp
    component.cpp

    HEADERS += entity.h
    typed.h
    system.h
    entitymanager.h
    component.h
    @



  • My answer is at the bottom of http://qt-project.org/quarterly/view/using_cmake_to_build_qt_projects - namely, use CMake. The project's complexity has quickly outgrown QMake. (I discovered this first-hand by trying to re-implement the shadow-builds feature in my .pro file. I got awfully close, but QMake has some implementation details which make it impossible.)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.