OSDN Git Service

revamp build system
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Fri, 17 Apr 2009 09:26:03 +0000 (11:26 +0200)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Mon, 20 Apr 2009 14:51:10 +0000 (16:51 +0200)
now bin and share are not pegged to linking the executable any more,
but are proper subdirs targets of their own.
unforturnately, qmake is a bit tenacious, so we hack around a bit. :)

more or less in passing by, i removed some superfluous trailing slashes
and added path normalization as well.

14 files changed:
bin/bin.pro [new file with mode: 0644]
qtcreator.pri [moved from src/qworkbench.pri with 54% similarity]
qtcreator.pro
share/qtcreator/static.pro [new file with mode: 0644]
share/share.pri [deleted file]
share/share.pro [new file with mode: 0644]
src/app/Info.plist [moved from share/qtcreator/Info.plist with 100% similarity]
src/app/app.pro
src/libs/utils/process_stub.pro
src/qworkbenchlibrary.pri
src/qworkbenchplugin.pri
src/tools/qdebugger/qdebugger.pro
src/tools/qtlibspatcher/qtlibspatcher.pro
src/tools/texteditor/texteditor.pro

diff --git a/bin/bin.pro b/bin/bin.pro
new file mode 100644 (file)
index 0000000..f035203
--- /dev/null
@@ -0,0 +1,16 @@
+IDE_BUILD_TREE = $$OUT_PWD/..
+
+include(../qtcreator.pri)
+
+TEMPLATE = app
+TARGET = $$IDE_APP_WRAPPER
+OBJECTS_DIR =
+
+PRE_TARGETDEPS = $$PWD/qtcreator
+
+QMAKE_LINK = cp $$PWD/qtcreator $@ && : IGNORE REST
+
+QMAKE_CLEAN = $$IDE_APP_WRAPPER
+
+target.path  = /bin
+INSTALLS    += target
similarity index 54%
rename from src/qworkbench.pri
rename to qtcreator.pri
index 17df81d..0166ab6 100644 (file)
@@ -1,4 +1,22 @@
-IDE_SOURCE_TREE = $$PWD/../
+IDE_SOURCE_TREE = $$PWD
+
+defineReplace(cleanPath) {
+    win32:1 ~= s|\\\\|/|g
+    contains(1, ^/.*):pfx = /
+    else:pfx =
+    segs = $$split(1, /)
+    out =
+    for(seg, segs) {
+        equals(seg, ..):out = $$member(out, 0, -2)
+        else:!equals(seg, .):out += $$seg
+    }
+    return($$join(out, /, $$pfx))
+}
+
+defineReplace(targetPath) {
+    win32:1 ~= s|/|\|g
+    return($$1)
+}
 
 isEmpty(TEST):CONFIG(debug, debug|release) {
     !debug_and_release|build_pass {
@@ -18,33 +36,35 @@ equals(TEST, 1) {
 }
 
 isEmpty(IDE_BUILD_TREE) {
-    error("qworkbench.pri: including file must define IDE_BUILD_TREE (probably a relative path)")
+    error("qtcreator.pri: including file must define IDE_BUILD_TREE (probably a relative path)")
 }
+IDE_BUILD_TREE = $$cleanPath($$IDE_BUILD_TREE)
 macx {
     IDE_APP_TARGET   = QtCreator
     IDE_LIBRARY_PATH = $$IDE_BUILD_TREE/bin/$${IDE_APP_TARGET}.app/Contents/PlugIns
-    IDE_PLUGIN_PATH  = $$IDE_LIBRARY_PATH 
+    IDE_PLUGIN_PATH  = $$IDE_LIBRARY_PATH
+    IDE_DATA_PATH    = $$IDE_BUILD_TREE/bin/$${IDE_APP_TARGET}.app/Contents/Resources
     contains(QT_CONFIG, ppc):CONFIG += ppc x86
 } else {
-    IDE_APP_WRAPPER  = qtcreator
-    IDE_APP_TARGET   = qtcreator.bin
+    win32 {
+        IDE_APP_TARGET   = qtcreator
+    } else {
+        IDE_APP_WRAPPER  = qtcreator
+        IDE_APP_TARGET   = qtcreator.bin
+    }
     IDE_LIBRARY_PATH = $$IDE_BUILD_TREE/$$IDE_LIBRARY_BASENAME/qtcreator
-    IDE_PLUGIN_PATH  = $$IDE_LIBRARY_PATH/plugins/
+    IDE_PLUGIN_PATH  = $$IDE_LIBRARY_PATH/plugins
+    IDE_DATA_PATH    = $$IDE_BUILD_TREE/share/qtcreator
 }
 IDE_APP_PATH = $$IDE_BUILD_TREE/bin
-win32 {
-    IDE_APP_TARGET   = qtcreator
-    IDE_LIBRARY_PATH ~= s|/+|\|
-    IDE_APP_PATH ~= s|/+|\|
-}
 
 INCLUDEPATH += \
     $$IDE_SOURCE_TREE/src/libs \
-    $$IDE_SOURCE_TREE/tools \
+    $$IDE_SOURCE_TREE/tools
 
 DEPENDPATH += \
     $$IDE_SOURCE_TREE/src/libs \
-    $$IDE_SOURCE_TREE/tools \
+    $$IDE_SOURCE_TREE/tools
 
 LIBS += -L$$IDE_LIBRARY_PATH
 
@@ -58,8 +78,8 @@ unix {
     debug:MOC_DIR = $${OUT_PWD}/.moc/debug-shared
     release:MOC_DIR = $${OUT_PWD}/.moc/release-shared
 
-    RCC_DIR = $${OUT_PWD}/.rcc/
-    UI_DIR = $${OUT_PWD}/.uic/
+    RCC_DIR = $${OUT_PWD}/.rcc
+    UI_DIR = $${OUT_PWD}/.uic
 }
 
 linux-g++-* {
index d9d0eb4..b2d042c 100644 (file)
@@ -10,7 +10,8 @@ include(doc/doc.pri)
 TEMPLATE  = subdirs
 CONFIG   += ordered
 
-SUBDIRS = src
+SUBDIRS = src share
+unix:!macx:!equals(_PRO_FILE_PWD_, $$OUT_PWD):SUBDIRS += bin
 
 # for Qt Creator translations
 QTC_BUILD_ROOT = $$PWD
diff --git a/share/qtcreator/static.pro b/share/qtcreator/static.pro
new file mode 100644 (file)
index 0000000..bf72fc0
--- /dev/null
@@ -0,0 +1,74 @@
+IDE_BUILD_TREE = $$OUT_PWD/../..
+
+include(../../qtcreator.pri)
+
+win32:i_flag = i
+defineReplace(stripSrcDir) {
+    win32 {
+        !contains(1, ^.:.*):1 = $$OUT_PWD/$$1
+    } else {
+        !contains(1, ^/.*):1 = $$OUT_PWD/$$1
+    }
+    out = $$cleanPath($$1)
+    out ~= s|^$$re_escape($$PWD/)||$$i_flag
+    return($$out)
+}
+
+contains(TEMPLATE, vc.*)|contains(TEMPLATE_PREFIX, vc):vcproj = 1
+
+TEMPLATE = app
+TARGET = phony_target
+
+isEmpty(vcproj) {
+    QMAKE_LINK = : IGNORE REST
+    OBJECTS_DIR =
+    win32:CONFIG -= embed_manifest_exe
+} else {
+    PHONY_DEPS = .
+    phony_src.input = PHONY_DEPS
+    phony_src.output = phony.c
+    phony_src.commands = echo int main() { return 0; } > phony.c
+    phony_src.CONFIG += combine
+    QMAKE_EXTRA_COMPILERS += phony_src
+}
+
+DATA_DIRS = \
+    snippets \
+    templates \
+    designer \
+    schemes \
+    gdbmacros
+
+macx|!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
+
+    for(data_dir, DATA_DIRS) {
+        files = $$files($$PWD/$$data_dir/*.*, true)
+        win32:files ~= s|\\\\|/|g
+        FILES += $$files
+    }
+
+    copy2build.input = FILES
+    copy2build.output = $$IDE_DATA_PATH/${QMAKE_FUNC_FILE_IN_stripSrcDir}
+    isEmpty(vcproj):copy2build.variable_out = PRE_TARGETDEPS
+    copy2build.commands = $$QMAKE_COPY \"${QMAKE_FILE_IN}\" \"${QMAKE_FILE_OUT}\"
+    copy2build.name = COPY ${QMAKE_FILE_IN}
+    copy2build.CONFIG += no_link
+    QMAKE_EXTRA_COMPILERS += copy2build
+
+    macx {
+        run_in_term.target = $$IDE_DATA_PATH/runInTerminal.command
+        run_in_term.depends = $$PWD/runInTerminal.command
+        run_in_term.commands = $$QMAKE_COPY $< $@
+        QMAKE_EXTRA_TARGETS += run_in_term
+        PRE_TARGETDEPS += $$run_in_term.target
+        QMAKE_CLEAN += $$run_in_term.target
+    }
+}
+
+unix:!macx {
+    for(data_dir, DATA_DIRS) {
+        eval($${data_dir}.files = $$quote($$PWD/$$data_dir))
+        eval($${data_dir}.path = /share/qtcreator)
+        INSTALLS += $$data_dir
+    }
+}
diff --git a/share/share.pri b/share/share.pri
deleted file mode 100644 (file)
index 653f2ed..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-macx {
-    SNIPPETS.path = Contents/Resources
-    SNIPPETS.files = $$PWD/qtcreator/snippets
-    TEMPLATES.path = Contents/Resources
-    TEMPLATES.files = $$PWD/qtcreator/templates
-    DESIGNER.path = Contents/Resources
-    DESIGNER.files = $$PWD/qtcreator/designer
-    SCHEMES.path = Contents/Resources
-    SCHEMES.files = $$PWD/qtcreator/schemes
-    GDBDEBUGGER.path = Contents/Resources
-    GDBDEBUGGER.files = $$PWD/qtcreator/gdbmacros
-    RUNINTERMINAL.path = Contents/Resources
-    RUNINTERMINAL.files = $$PWD/qtcreator/runInTerminal.command
-    QMAKE_BUNDLE_DATA += SNIPPETS TEMPLATES DESIGNER SCHEMES GDBDEBUGGER RUNINTERMINAL
-    QMAKE_INFO_PLIST = $$PWD/qtcreator/Info.plist
-} else {
-    # make sure the resources are in place
-    !exists($$OUT_PWD/app.pro) {
-        # we are shadow build
-        unix:SEPARATOR = ;
-        win32:SEPARATOR = &
-        COPYSRC = snippets \
-                   templates \
-                   designer \
-                   schemes \
-                   gdbmacros
-        COPYDEST = $${OUT_PWD}/../../share/qtcreator
-        win32:COPYDEST ~= s|/+|\|
-        QMAKE_POST_LINK += $${QMAKE_MKDIR} $$COPYDEST $$SEPARATOR
-        for(tmp,COPYSRC) {
-          REALSRC = $$PWD/qtcreator/$$tmp
-          REALDEST = $$COPYDEST/$$tmp
-          win32:REALSRC ~= s|/+|\|
-          win32:REALDEST ~= s|/+|\|
-          QMAKE_POST_LINK += $${QMAKE_COPY_DIR} $${REALSRC} $${REALDEST} $$SEPARATOR
-        }
-    }
-}
-
-linux-* {
-    keymaps.files           += $$PWD/qtcreator/schemes/MS_Visual_C++.kms
-    keymaps.files           += $$PWD/qtcreator/schemes/Xcode.kms
-    keymaps.path             = /share/qtcreator/schemes
-
-    gdbsupport.files        += $$PWD/qtcreator/gdbmacros/LICENSE.LGPL
-    gdbsupport.files        += $$PWD/qtcreator/gdbmacros/LGPL_EXCEPTION.TXT
-    gdbsupport.files        += $$PWD/qtcreator/gdbmacros/gdbmacros.cpp
-    gdbsupport.files        += $$PWD/qtcreator/gdbmacros/gdbmacros.pro
-    gdbsupport.path          = /share/qtcreator/gdbmacros
-
-    designertemplates.files += $$PWD/qtcreator/designer/templates.xml
-    designertemplates.files += $$PWD/qtcreator/designer/templates/*
-    designertemplates.path   = /share/qtcreator/designer/templates
-
-    snippets.files          += $$PWD/qtcreator/snippets/*.snp
-    snippets.path            = /share/qtcreator/snippets
-
-    projecttemplates.files  += $$PWD/qtcreator/templates/qt4project/mywidget_form.h
-    projecttemplates.files  += $$PWD/qtcreator/templates/qt4project/main.cpp
-    projecttemplates.files  += $$PWD/qtcreator/templates/qt4project/mywidget.cpp
-    projecttemplates.files  += $$PWD/qtcreator/templates/qt4project/mywidget.h
-    projecttemplates.files  += $$PWD/qtcreator/templates/qt4project/widget.ui
-    projecttemplates.files  += $$PWD/qtcreator/templates/qt4project/mywidget_form.cpp
-    projecttemplates.path    = /share/qtcreator/templates/qt4project
-
-    INSTALLS += \
-       keymaps \
-       gdbsupport \
-       designertemplates \
-       snippets \
-       projecttemplates
-
-}
-
diff --git a/share/share.pro b/share/share.pro
new file mode 100644 (file)
index 0000000..a997a81
--- /dev/null
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS = qtcreator/static.pro
index 0894b2a..31864cc 100644 (file)
@@ -1,6 +1,6 @@
-IDE_BUILD_TREE = $$OUT_PWD/../../
+IDE_BUILD_TREE = $$OUT_PWD/../..
 
-include(../qworkbench.pri)
+include(../../qtcreator.pri)
 include(../shared/qtsingleapplication/qtsingleapplication.pri)
 
 TEMPLATE = app
@@ -18,6 +18,7 @@ win32 {
 
 macx {
         ICON = qtcreator.icns
+        QMAKE_INFO_PLIST = Info.plist
 }
 
 macx {
@@ -31,25 +32,6 @@ win32 {
 unix:!macx {
     LIBS *= -lExtensionSystem -lAggregation
 
-    # make sure the wrapper is in place
-    !exists($$OUT_PWD/app.pro) {
-        # we are shadow build
-        COPYSRC = $$PWD/$$DESTDIR/$$IDE_APP_WRAPPER
-        COPYDEST = $$OUT_PWD/$$DESTDIR/$$IDE_APP_WRAPPER
-        win32:COPYSRC ~= s|/+|\|
-        win32:COPYDEST ~= s|/+|\|
-        unix:SEPARATOR = ;
-        win32:SEPARATOR = &
-        QMAKE_POST_LINK += $${QMAKE_COPY_FILE} $${COPYSRC} $${COPYDEST} $$SEPARATOR
-    }
-
-    wrapper.files  = $$OUT_PWD/$$DESTDIR/$$IDE_APP_WRAPPER
-    wrapper.path   = /bin
-
     target.path  = /bin
-
-    INSTALLS    += target wrapper
-
+    INSTALLS    += target
 }
-
-include(../../share/share.pri)
index 996aece..8057f49 100644 (file)
@@ -1,5 +1,5 @@
-IDE_BUILD_TREE=../../../
-include(../../qworkbench.pri)
+IDE_BUILD_TREE=../../..
+include(../../../qtcreator.pri)
 
 TEMPLATE        = app
 TARGET          = qtcreator_process_stub
index 7a04fe4..7d260b6 100644 (file)
@@ -1,5 +1,5 @@
-IDE_BUILD_TREE = $$OUT_PWD/../../../
-include(qworkbench.pri)
+IDE_BUILD_TREE = $$OUT_PWD/../../..
+include(../qtcreator.pri)
 
 win32 {
        DLLDESTDIR = $$IDE_APP_PATH
index d7c9a64..a6143a9 100644 (file)
@@ -1,13 +1,13 @@
 isEmpty(IDE_BUILD_TREE) {
-  IDE_BUILD_TREE = $$OUT_PWD/../../../
+  IDE_BUILD_TREE = $$OUT_PWD/../../..
 }
-include(qworkbench.pri)
+include(../qtcreator.pri)
 
 isEmpty(PROVIDER) {
     PROVIDER = Nokia
 }
 
-DESTDIR = $$IDE_PLUGIN_PATH/$$PROVIDER/
+DESTDIR = $$IDE_PLUGIN_PATH/$$PROVIDER
 LIBS += -L$$DESTDIR
 INCLUDEPATH += $$IDE_SOURCE_TREE/src/plugins
 DEPENDPATH += $$IDE_SOURCE_TREE/src/plugins
index a4ff3e3..0b28902 100644 (file)
@@ -1,5 +1,5 @@
 
-QTCREATOR = ../../plugins/
+QTCREATOR = ../../plugins
 
 TARGET = ../../../bin/qdebugger
 
@@ -115,9 +115,9 @@ SOURCES += \
 
 
 unix {
-    OBJECTS_DIR = .tmp/
-    MOC_DIR = .tmp/
-    RCC_DIR = .tmp/
-    UI_DIR = .tmp/
+    OBJECTS_DIR = .tmp
+    MOC_DIR = .tmp
+    RCC_DIR = .tmp
+    UI_DIR = .tmp
 }
 
index fb0b51c..453c4fc 100644 (file)
@@ -8,7 +8,7 @@ TEMPLATE = app
 TARGET = 
 DEPENDPATH += .
 INCLUDEPATH += .
-DESTDIR = ./
+DESTDIR = .
 
 # Input
 HEADERS += binpatch.h
index fd4db87..9e118db 100644 (file)
@@ -1,5 +1,5 @@
 
-QTCREATOR = ../../plugins/
+QTCREATOR = ../../plugins
 
 TARGET = ../../../bin/texteditor
 
@@ -39,8 +39,8 @@ SOURCES += \
 #    $${QTCREATOR}/gdbdebugger/gdbdebugger.qrc
 
 unix {
-    OBJECTS_DIR = .tmp/
-    MOC_DIR = .tmp/
-    RCC_DIR = .tmp/
-    UI_DIR = .tmp/
+    OBJECTS_DIR = .tmp
+    MOC_DIR = .tmp
+    RCC_DIR = .tmp
+    UI_DIR = .tmp
 }