Results 1 to 17 of 17

Thread: QMAKE custom DEFINES & CONFIG

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2009
    Posts
    53
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default Re: QMAKE custom DEFINES & CONFIG

    Thanks Lykurg. I guess I have to convert output to Qt-Windows and then open using Qt-VsIntegration.

  2. #2
    Join Date
    Jan 2009
    Posts
    53
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default Re: QMAKE custom DEFINES & CONFIG

    I think I should rephrase my question...

    How to carry forward "DEFINES += WIN32_ADVANCED" to all *pro under SUBDIRS?

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: QMAKE custom DEFINES & CONFIG

    global.pro
    Qt Code:
    1. TEMPLATE = subdirs
    2. SUBDIRS = testsub
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. qmake "DEFINES += WIN32_ADVANCED" global.pro
    To copy to clipboard, switch view to plain text mode 
    results in Makefile
    Qt Code:
    1. //..
    2. testsub/$(MAKEFILE):
    3. @$(CHK_DIR_EXISTS) testsub/ || $(MKDIR) testsub/
    4. cd testsub/ && $(QMAKE) testsub.pro -unix DEFINES\ +=\ WIN32_ADVANCED -o $(MAKEFILE)
    5. sub-testsub-qmake_all: FORCE
    6. @$(CHK_DIR_EXISTS) testsub/ || $(MKDIR) testsub/
    7. cd testsub/ && $(QMAKE) testsub.pro -unix DEFINES\ +=\ WIN32_ADVANCED -o $(MAKEFILE)
    8. //..
    To copy to clipboard, switch view to plain text mode 

    just fine

  4. #4
    Join Date
    Jan 2009
    Posts
    53
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default Re: QMAKE custom DEFINES & CONFIG

    Lykurg, thanks a lot for your help on this issue. Appreciated your effort by showing me the solution the UNIX way.
    However, I'm having a hard time to make it work on Qt Visual Studio Integration tool.

    Qt Code:
    1. win32:DEFINES += WIN32_ADVANCED
    2. win32:CONFIG += win32_Advanced
    3.  
    4. SUBDIRS += simple_build.pro //WIN32_ADVANCED and win32_Advanced should be also available inside simple_build.pro
    To copy to clipboard, switch view to plain text mode 

    I do not want to open all the *.pro files and add the WIN32_ADVANCED and win32_Advanced manually.

    Hope someone know how to do it on Windows.
    Last edited by sheeeng; 23rd April 2009 at 15:13.

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: QMAKE custom DEFINES & CONFIG

    Qt is platform independent so all I have said is also usable under Windows, but if you can't transfer I do It for you:

    c:\global.pro
    TEMPLATE = subdirs
    SUBDIRS = testsub // and all the other subdirs you have
    c:\>qmake "DEFINES += WIN32_ADVANCED" "CONFIG += win32_Advanced" global.pro
    results in:
    ################################################## ###########################
    # Makefile for building: global
    # Generated by qmake (2.01a) (Qt 4.4.3) on: Do 23. Apr 15:45:05 2009
    # Project: ..\global.pro
    # Template: subdirs
    # Command: c:\Qt\4.4.3\bin\qmake.exe -win32 "DEFINES += WIN32_ADVANCED" "CONFIG += win32_Advanced" -o ..\Makefile ..\global.pro
    ################################################## ###########################

    first: make_default
    MAKEFILE = Makefile
    QMAKE = c:\Qt\4.4.3\bin\qmake.exe
    DEL_FILE = del
    CHK_DIR_EXISTS= if not exist
    MKDIR = mkdir
    COPY = copy /y
    COPY_FILE = $(COPY)
    COPY_DIR = xcopy /s /q /y /i
    INSTALL_FILE = $(COPY_FILE)
    INSTALL_PROGRAM = $(COPY_FILE)
    INSTALL_DIR = $(COPY_DIR)
    DEL_FILE = del
    SYMLINK =
    DEL_DIR = rmdir
    MOVE = move
    CHK_DIR_EXISTS= if not exist
    MKDIR = mkdir
    SUBTARGETS = \
    sub-testsub

    testsub\$(MAKEFILE):
    @$(CHK_DIR_EXISTS) testsub\ $(MKDIR) testsub\
    cd testsub\ && $(QMAKE) testsub.pro -win32 "DEFINES += WIN32_ADVANCED" "CONFIG += win32_Advanced" -o $(MAKEFILE)
    sub-testsub-qmake_all: FORCE
    @$(CHK_DIR_EXISTS) testsub\ $(MKDIR) testsub\
    cd testsub\ && $(QMAKE) testsub.pro -win32 "DEFINES += WIN32_ADVANCED" "CONFIG += win32_Advanced" -o $(MAKEFILE)
    sub-testsub: testsub\$(MAKEFILE) FORCE
    cd testsub\ && $(MAKE) -f $(MAKEFILE)
    sub-testsub-make_default: testsub\$(MAKEFILE) FORCE
    cd testsub\ && $(MAKE) -f $(MAKEFILE)
    sub-testsub-make_first: testsub\$(MAKEFILE) FORCE
    cd testsub\ && $(MAKE) -f $(MAKEFILE) first
    sub-testsub-all: testsub\$(MAKEFILE) FORCE
    cd testsub\ && $(MAKE) -f $(MAKEFILE) all
    sub-testsub-clean: testsub\$(MAKEFILE) FORCE
    cd testsub\ && $(MAKE) -f $(MAKEFILE) clean
    sub-testsub-distclean: testsub\$(MAKEFILE) FORCE
    cd testsub\ && $(MAKE) -f $(MAKEFILE) distclean
    sub-testsub-install_subtargets: testsub\$(MAKEFILE) FORCE
    cd testsub\ && $(MAKE) -f $(MAKEFILE) install
    sub-testsub-uninstall_subtargets: testsub\$(MAKEFILE) FORCE
    cd testsub\ && $(MAKE) -f $(MAKEFILE) uninstall

    ..\Makefile: ../global.pro ../Qt/4.4.3/mkspecs/win32-g++/qmake.conf ../Qt/4.4.3/mkspecs/qconfig.pri \
    ../Qt/4.4.3/mkspecs/features/qt_functions.prf \
    ../Qt/4.4.3/mkspecs/features/qt_config.prf \
    ../Qt/4.4.3/mkspecs/features/exclusive_builds.prf \
    ../Qt/4.4.3/mkspecs/features/default_pre.prf \
    ../Qt/4.4.3/mkspecs/features/win32/default_pre.prf \
    ../Qt/4.4.3/mkspecs/features/debug.prf \
    ../Qt/4.4.3/mkspecs/features/debug_and_release.prf \
    ../Qt/4.4.3/mkspecs/features/default_post.prf \
    ../Qt/4.4.3/mkspecs/features/win32/rtti.prf \
    ../Qt/4.4.3/mkspecs/features/win32/exceptions.prf \
    ../Qt/4.4.3/mkspecs/features/win32/stl.prf \
    ../Qt/4.4.3/mkspecs/features/shared.prf \
    ../Qt/4.4.3/mkspecs/features/warn_on.prf \
    ../Qt/4.4.3/mkspecs/features/qt.prf \
    ../Qt/4.4.3/mkspecs/features/win32/thread.prf \
    ../Qt/4.4.3/mkspecs/features/moc.prf \
    ../Qt/4.4.3/mkspecs/features/win32/windows.prf \
    ../Qt/4.4.3/mkspecs/features/resources.prf \
    ../Qt/4.4.3/mkspecs/features/uic.prf \
    ../Qt/4.4.3/mkspecs/features/yacc.prf \
    ../Qt/4.4.3/mkspecs/features/lex.prf
    $(QMAKE) -win32 "DEFINES += WIN32_ADVANCED" "CONFIG += win32_Advanced" -o ..\Makefile ..\global.pro
    ..\Qt\4.4.3\mkspecs\qconfig.pri:
    ..\Qt\4.4.3\mkspecs\features\qt_functions.prf:
    ..\Qt\4.4.3\mkspecs\features\qt_config.prf:
    ..\Qt\4.4.3\mkspecs\features\exclusive_builds.prf:
    ..\Qt\4.4.3\mkspecs\features\default_pre.prf:
    ..\Qt\4.4.3\mkspecs\features\win32\default_pre.prf :
    ..\Qt\4.4.3\mkspecs\features\debug.prf:
    ..\Qt\4.4.3\mkspecs\features\debug_and_release.prf :
    ..\Qt\4.4.3\mkspecs\features\default_post.prf:
    ..\Qt\4.4.3\mkspecs\features\win32\rtti.prf:
    ..\Qt\4.4.3\mkspecs\features\win32\exceptions.prf:
    ..\Qt\4.4.3\mkspecs\features\win32\stl.prf:
    ..\Qt\4.4.3\mkspecs\features\shared.prf:
    ..\Qt\4.4.3\mkspecs\features\warn_on.prf:
    ..\Qt\4.4.3\mkspecs\features\qt.prf:
    ..\Qt\4.4.3\mkspecs\features\win32\thread.prf:
    ..\Qt\4.4.3\mkspecs\features\moc.prf:
    ..\Qt\4.4.3\mkspecs\features\win32\windows.prf:
    ..\Qt\4.4.3\mkspecs\features\resources.prf:
    ..\Qt\4.4.3\mkspecs\features\uic.prf:
    ..\Qt\4.4.3\mkspecs\features\yacc.prf:
    ..\Qt\4.4.3\mkspecs\features\lex.prf:
    qmake: qmake_all FORCE
    @$(QMAKE) -win32 "DEFINES += WIN32_ADVANCED" "CONFIG += win32_Advanced" -o ..\Makefile ..\global.pro

    qmake_all: sub-testsub-qmake_all FORCE

    make_default: sub-testsub-make_default FORCE
    make_first: sub-testsub-make_first FORCE
    all: sub-testsub-all FORCE
    clean: sub-testsub-clean FORCE
    distclean: sub-testsub-distclean FORCE
    -$(DEL_FILE) ..\Makefile
    install_subtargets: sub-testsub-install_subtargets FORCE
    uninstall_subtargets: sub-testsub-uninstall_subtargets FORCE

    sub-testsub-sub_Debug: testsub\\$(MAKEFILE)
    cd testsub\ && $(MAKE) debug
    debug: sub-testsub-sub_Debug

    sub-testsub-sub_Release: testsub\\$(MAKEFILE)
    cd testsub\ && $(MAKE) release
    release: sub-testsub-sub_Release

    mocclean: compiler_moc_header_clean compiler_moc_source_clean

    mocables: compiler_moc_header_make_all compiler_moc_source_make_all
    install: install_subtargets FORCE

    uninstall: uninstall_subtargets FORCE

    FORCE:
    Look:
    testsub\$(MAKEFILE):
    @$(CHK_DIR_EXISTS) testsub\ $(MKDIR) testsub\
    cd testsub\ && $(QMAKE) testsub.pro -win32 "DEFINES += WIN32_ADVANCED" "CONFIG += win32_Advanced" -o $(MAKEFILE)
    c:\>make
    be happy...


    ...or I don't get your problem.

  6. The following user says thank you to Lykurg for this useful post:

    sheeeng (23rd April 2009)

  7. #6
    Join Date
    Jan 2009
    Posts
    53
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default Re: QMAKE custom DEFINES & CONFIG

    Thanks, Lykurg! Felt so bad to trouble you on this simple task.
    I think the problem is not with us. It is with the Qt Visual Studio Integration. I just open *pro using Visual Studio by Qt | Open Qt *pro file and it will generate the Visual Studio *sln and *proj files for us.
    I did not use any qmake or make commands when building Qt. It was taken care of by the integration tool.
    I do feel that this should NOT be a big issue.
    Anyway, thanks a lot! Really appreciate your pointers!

  8. #7
    Join Date
    Jan 2012
    Location
    St. Petersburg, Russia
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Wiki edits
    1

    Default Re: QMAKE custom DEFINES & CONFIG

    I faced the same problem. I would like to forward a definition into each subdir mentioned in my .pro file:

    Qt Code:
    1. DEFINES += SOME_VERY_COMMON_MACRO
    2. TEMPLATE = subdirs
    3. SUBDIRS = testsub
    To copy to clipboard, switch view to plain text mode 

    But unfortunately it doesn't work! SOME_VERY_COMMON_MACRO is not forwarded to testsub Makefile.

    Lykurg's solution is enough, but it's less convenient: it makes me write build instructions for other project developers. And it makes them read it . I think there must be simpler solution.
    Last edited by monst; 12th January 2012 at 15:08.

  9. #8
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: QMAKE custom DEFINES & CONFIG

    I haven't time to check it right now myself, but as an other possibility you can create a *.pri file and include it once in each other *.pro file. This is a one time work and then you only have to alter the *.pri file. Thus nobody has to read your build instructions.

  10. The following user says thank you to Lykurg for this useful post:

    monst (12th January 2012)

  11. #9
    Join Date
    Jan 2012
    Location
    St. Petersburg, Russia
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Wiki edits
    1

    Default Re: QMAKE custom DEFINES & CONFIG

    Yes, that will do. But in my case one of sub directories is something like a third party project, and I don't want to modify its .pro files.
    All I want is to provide a macro definition to a compiler when I build a whole project. Maybe I want a strange thing .

Similar Threads

  1. qmake sux a lot
    By singermornings in forum Qt Programming
    Replies: 6
    Last Post: 29th January 2009, 09:33
  2. qmake and CONFIG copy_dir_files
    By Vanir in forum Qt Programming
    Replies: 0
    Last Post: 25th February 2008, 15:56
  3. Adding custom defines when on debug build
    By chus in forum Qt Programming
    Replies: 2
    Last Post: 2nd March 2007, 12:38
  4. Custom action added to make by qmake
    By NTwoO in forum Qt Programming
    Replies: 2
    Last Post: 2nd March 2007, 11:17
  5. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 06:57

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.