configure.py
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
--- a/configure.py	Thu Sep 02 20:44:51 2010 +0300
+++ b/configure.py	Fri Sep 17 08:32:10 2010 +0300
@@ -216,12 +216,14 @@
         if QMAKE.platform() == "win32" and MAKE.bin() == "nmake":
             group.add_option("--msvc", action="store_true", dest="msvc",
                              help="Generate a MSVC solution.")
-        group.add_option("--release", action="store_const", dest="config", const="release",
+        group.add_option("--release", action="store_const", dest="release", const="release",
                          help="Build in release mode.")
-        group.add_option("--debug", action="store_const", dest="config", const="debug",
+        group.add_option("--debug", action="store_const", dest="debug", const="debug",
                          help="Build in debug mode.")
-        group.add_option("--debug_and_release", action="store_const", dest="config", const="debug_and_release",
+        group.add_option("--debug_and_release", action="store_const", dest="debug_and_release", const="debug_and_release",
                          help="Build in both debug and release modes.")
+        group.add_option("--config", action="append", dest="config", metavar="config",
+                         help="Add qmake configurations.")
         group.add_option("--debug-output", action="store_true", dest="debug_output",
                             help="Do not suppress debug and warning output (suppressed by default in release-armv5 builds on Symbian).")
         group.add_option("--no-debug-output", action="store_true", dest="no_debug_output",
@@ -236,9 +238,10 @@
                                   "The build tree should be clean ie. no existing "
                                   "makefiles in subdirs, because those won't be "
                                   "regenerated if this option is enabled.")
+        group.add_option("--define", action="append", dest="define", metavar="define",
+                         help="Add compiler macros eg. --define HB_FOO_DEBUG --define HB_BAR_ENABLED.")
         group.add_option("--defines", dest="defines", metavar="defines",
-                         help="Define compiler macros for selecting features "
-                              "and debugging purposes eg. --defines HB_FOO_DEBUG,HB_BAR_ENABLED")
+                         help=optparse.SUPPRESS_HELP)
         if QMAKE.platform() == "unix":
             group.add_option("--rpath", action="store_true", dest="rpath",
                              help="Link Hb libraries and executables using the library install "
@@ -249,9 +252,13 @@
         self.set_defaults(platform=None)
         self.set_defaults(makebin=None)
         self.set_defaults(msvc=None)
+        self.set_defaults(release=None)
+        self.set_defaults(debug=None)
+        self.set_defaults(debug_and_release=None)
         self.set_defaults(config=None)
         self.set_defaults(silent=False)
         self.set_defaults(fast=False)
+        self.set_defaults(define=None)
         self.set_defaults(defines=None)
         self.set_defaults(rpath=None)
 
@@ -272,7 +279,7 @@
                          help="The operating system and compiler you are building on.")
         group.add_option("--qmake-options", dest="qmakeopt", metavar="options",
                          help="Additional qmake options "
-                              "eg. --qmake-options \"CONFIG+=foo DEFINES+=BAR\".")
+                              "eg. --qmake-options \"QMAKE_CC=gcc-4.1 QMAKE_CXX=g++-4.1\".")
         self.add_option_group(group)
         self.set_defaults(qmakeopt=None)
 
@@ -510,6 +517,8 @@
 
         # symbian specific adjustments
         if QMAKE.platform() == "symbian":
+            self._bindir = self._dir_option(options.bindir, "$${EPOCROOT}epoc32/tools")
+
             # TODO: fix to "$${EPOCROOT}resource/hb/plugins"
             self._pluginsdir = "$${EPOCROOT}resource/qt/plugins/hb"
 
@@ -771,6 +780,9 @@
         config.add_value("DEFINES", "HB_TEXT_MEASUREMENT_UTILITY")
     if QMAKE.platform() != "symbian" and options.developer:
         config.add_value("DEFINES", "HB_CSS_INSPECTOR")
+    if options.define:
+        for optdef in options.define:
+            config.add_value("DEFINES", optdef)
     if options.defines:
         config.add_value("DEFINES", " ".join(options.defines.split(",")))
     if options.developerexport:
@@ -819,8 +831,16 @@
         config.add_value("CONFIG", "developer")
     if options.coverage:
         config.add_value("CONFIG", "coverage")
+    if options.release:
+        config.add_value("CONFIG", "release")
+    if options.debug:
+        config.add_value("CONFIG", "debug")
+    if options.debug_and_release:
+        config.add_value("CONFIG", "debug_and_release")
     if options.config:
-        config.add_value("CONFIG", options.config)
+        for optconf in options.config:
+            config.add_value("CONFIG", optconf)
+
     if options.debug_output:
         config.add_value("DEFINES", "HB_DEBUG_OUTPUT")
         config.add_value("DEFINES", "HB_WARNING_OUTPUT")
@@ -831,6 +851,10 @@
     # ensure that no QString(0) -like constructs slip in
     config.add_value("DEFINES", "QT_QCHAR_CONSTRUCTOR")
 
+    # expose a flag indicating that tools were built with a host toolchain
+    if options.hostqmakebin != None and options.hostmakebin != None:
+        config.add_value("CONFIG", "host_tools")
+
     # TODO: is there any better way to expose functions to the whole source tree?
     config._lines.append("include(%s)\n" % ConfigFile.format_dir((os.path.splitdrive(BUILDENV.sourcedir())[1]) + "/mkspecs/hb_functions.prf"))