configure.py
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
equal deleted inserted replaced
23:e6ad4ef83b23 28:b7da29130b0e
   214                          help="Specify the make tool (make, nmake, mingw32-make, gmake...). "
   214                          help="Specify the make tool (make, nmake, mingw32-make, gmake...). "
   215                               "The one detected in PATH is used by default if not specified.")
   215                               "The one detected in PATH is used by default if not specified.")
   216         if QMAKE.platform() == "win32" and MAKE.bin() == "nmake":
   216         if QMAKE.platform() == "win32" and MAKE.bin() == "nmake":
   217             group.add_option("--msvc", action="store_true", dest="msvc",
   217             group.add_option("--msvc", action="store_true", dest="msvc",
   218                              help="Generate a MSVC solution.")
   218                              help="Generate a MSVC solution.")
   219         group.add_option("--release", action="store_const", dest="config", const="release",
   219         group.add_option("--release", action="store_const", dest="release", const="release",
   220                          help="Build in release mode.")
   220                          help="Build in release mode.")
   221         group.add_option("--debug", action="store_const", dest="config", const="debug",
   221         group.add_option("--debug", action="store_const", dest="debug", const="debug",
   222                          help="Build in debug mode.")
   222                          help="Build in debug mode.")
   223         group.add_option("--debug_and_release", action="store_const", dest="config", const="debug_and_release",
   223         group.add_option("--debug_and_release", action="store_const", dest="debug_and_release", const="debug_and_release",
   224                          help="Build in both debug and release modes.")
   224                          help="Build in both debug and release modes.")
       
   225         group.add_option("--config", action="append", dest="config", metavar="config",
       
   226                          help="Add qmake configurations.")
   225         group.add_option("--debug-output", action="store_true", dest="debug_output",
   227         group.add_option("--debug-output", action="store_true", dest="debug_output",
   226                             help="Do not suppress debug and warning output (suppressed by default in release-armv5 builds on Symbian).")
   228                             help="Do not suppress debug and warning output (suppressed by default in release-armv5 builds on Symbian).")
   227         group.add_option("--no-debug-output", action="store_true", dest="no_debug_output",
   229         group.add_option("--no-debug-output", action="store_true", dest="no_debug_output",
   228                             help="Suppress debug and warning output (suppressed by default in release-armv5 builds on Symbian).")
   230                             help="Suppress debug and warning output (suppressed by default in release-armv5 builds on Symbian).")
   229         if QMAKE.platform() != "symbian":
   231         if QMAKE.platform() != "symbian":
   234                                   "in recursive mode (default) is more reliable but "
   236                                   "in recursive mode (default) is more reliable but "
   235                                   "takes relatively long due to deep project hierarchy. "
   237                                   "takes relatively long due to deep project hierarchy. "
   236                                   "The build tree should be clean ie. no existing "
   238                                   "The build tree should be clean ie. no existing "
   237                                   "makefiles in subdirs, because those won't be "
   239                                   "makefiles in subdirs, because those won't be "
   238                                   "regenerated if this option is enabled.")
   240                                   "regenerated if this option is enabled.")
       
   241         group.add_option("--define", action="append", dest="define", metavar="define",
       
   242                          help="Add compiler macros eg. --define HB_FOO_DEBUG --define HB_BAR_ENABLED.")
   239         group.add_option("--defines", dest="defines", metavar="defines",
   243         group.add_option("--defines", dest="defines", metavar="defines",
   240                          help="Define compiler macros for selecting features "
   244                          help=optparse.SUPPRESS_HELP)
   241                               "and debugging purposes eg. --defines HB_FOO_DEBUG,HB_BAR_ENABLED")
       
   242         if QMAKE.platform() == "unix":
   245         if QMAKE.platform() == "unix":
   243             group.add_option("--rpath", action="store_true", dest="rpath",
   246             group.add_option("--rpath", action="store_true", dest="rpath",
   244                              help="Link Hb libraries and executables using the library install "
   247                              help="Link Hb libraries and executables using the library install "
   245                                   "path as a runtime library path.")
   248                                   "path as a runtime library path.")
   246             group.add_option("--no-rpath", action="store_false", dest="rpath",
   249             group.add_option("--no-rpath", action="store_false", dest="rpath",
   247                              help="Do not use the library install path as a runtime library path.")
   250                              help="Do not use the library install path as a runtime library path.")
   248         self.add_option_group(group)
   251         self.add_option_group(group)
   249         self.set_defaults(platform=None)
   252         self.set_defaults(platform=None)
   250         self.set_defaults(makebin=None)
   253         self.set_defaults(makebin=None)
   251         self.set_defaults(msvc=None)
   254         self.set_defaults(msvc=None)
       
   255         self.set_defaults(release=None)
       
   256         self.set_defaults(debug=None)
       
   257         self.set_defaults(debug_and_release=None)
   252         self.set_defaults(config=None)
   258         self.set_defaults(config=None)
   253         self.set_defaults(silent=False)
   259         self.set_defaults(silent=False)
   254         self.set_defaults(fast=False)
   260         self.set_defaults(fast=False)
       
   261         self.set_defaults(define=None)
   255         self.set_defaults(defines=None)
   262         self.set_defaults(defines=None)
   256         self.set_defaults(rpath=None)
   263         self.set_defaults(rpath=None)
   257 
   264 
   258         group = optparse.OptionGroup(self, "Host options")
   265         group = optparse.OptionGroup(self, "Host options")
   259         group.add_option("--host-qmake-bin", dest="hostqmakebin", metavar="path",
   266         group.add_option("--host-qmake-bin", dest="hostqmakebin", metavar="path",
   270                               "in PATH is used by default if not specified.")
   277                               "in PATH is used by default if not specified.")
   271         group.add_option("--qmake-spec", dest="qmakespec", metavar="spec",
   278         group.add_option("--qmake-spec", dest="qmakespec", metavar="spec",
   272                          help="The operating system and compiler you are building on.")
   279                          help="The operating system and compiler you are building on.")
   273         group.add_option("--qmake-options", dest="qmakeopt", metavar="options",
   280         group.add_option("--qmake-options", dest="qmakeopt", metavar="options",
   274                          help="Additional qmake options "
   281                          help="Additional qmake options "
   275                               "eg. --qmake-options \"CONFIG+=foo DEFINES+=BAR\".")
   282                               "eg. --qmake-options \"QMAKE_CC=gcc-4.1 QMAKE_CXX=g++-4.1\".")
   276         self.add_option_group(group)
   283         self.add_option_group(group)
   277         self.set_defaults(qmakeopt=None)
   284         self.set_defaults(qmakeopt=None)
   278 
   285 
   279         group = optparse.OptionGroup(self, "Feature options")
   286         group = optparse.OptionGroup(self, "Feature options")
   280         group.add_option("--make", action="append", dest="make", metavar="part",
   287         group.add_option("--make", action="append", dest="make", metavar="part",
   508         self._resourcesdir = self._dir_option(options.resourcesdir, self._prefix + "/resources")
   515         self._resourcesdir = self._dir_option(options.resourcesdir, self._prefix + "/resources")
   509         self._translationsdir = self._dir_option(options.translationsdir, self._prefix + "/translations")
   516         self._translationsdir = self._dir_option(options.translationsdir, self._prefix + "/translations")
   510 
   517 
   511         # symbian specific adjustments
   518         # symbian specific adjustments
   512         if QMAKE.platform() == "symbian":
   519         if QMAKE.platform() == "symbian":
       
   520             self._bindir = self._dir_option(options.bindir, "$${EPOCROOT}epoc32/tools")
       
   521 
   513             # TODO: fix to "$${EPOCROOT}resource/hb/plugins"
   522             # TODO: fix to "$${EPOCROOT}resource/hb/plugins"
   514             self._pluginsdir = "$${EPOCROOT}resource/qt/plugins/hb"
   523             self._pluginsdir = "$${EPOCROOT}resource/qt/plugins/hb"
   515 
   524 
   516             if not options.developer:
   525             if not options.developer:
   517                 if os.path.isdir("/s60"):
   526                 if os.path.isdir("/s60"):
   769         config.add_value("DEFINES", "HB_EFFECTS")
   778         config.add_value("DEFINES", "HB_EFFECTS")
   770     if options.textMeasurement:
   779     if options.textMeasurement:
   771         config.add_value("DEFINES", "HB_TEXT_MEASUREMENT_UTILITY")
   780         config.add_value("DEFINES", "HB_TEXT_MEASUREMENT_UTILITY")
   772     if QMAKE.platform() != "symbian" and options.developer:
   781     if QMAKE.platform() != "symbian" and options.developer:
   773         config.add_value("DEFINES", "HB_CSS_INSPECTOR")
   782         config.add_value("DEFINES", "HB_CSS_INSPECTOR")
       
   783     if options.define:
       
   784         for optdef in options.define:
       
   785             config.add_value("DEFINES", optdef)
   774     if options.defines:
   786     if options.defines:
   775         config.add_value("DEFINES", " ".join(options.defines.split(",")))
   787         config.add_value("DEFINES", " ".join(options.defines.split(",")))
   776     if options.developerexport:
   788     if options.developerexport:
   777         config.add_value("DEFINES", "HB_DEVELOPER")
   789         config.add_value("DEFINES", "HB_DEVELOPER")
   778     if options.rpath == None or options.rpath == True:
   790     if options.rpath == None or options.rpath == True:
   817         config.add_value("CONFIG", "gestures")
   829         config.add_value("CONFIG", "gestures")
   818     if options.developer:
   830     if options.developer:
   819         config.add_value("CONFIG", "developer")
   831         config.add_value("CONFIG", "developer")
   820     if options.coverage:
   832     if options.coverage:
   821         config.add_value("CONFIG", "coverage")
   833         config.add_value("CONFIG", "coverage")
       
   834     if options.release:
       
   835         config.add_value("CONFIG", "release")
       
   836     if options.debug:
       
   837         config.add_value("CONFIG", "debug")
       
   838     if options.debug_and_release:
       
   839         config.add_value("CONFIG", "debug_and_release")
   822     if options.config:
   840     if options.config:
   823         config.add_value("CONFIG", options.config)
   841         for optconf in options.config:
       
   842             config.add_value("CONFIG", optconf)
       
   843 
   824     if options.debug_output:
   844     if options.debug_output:
   825         config.add_value("DEFINES", "HB_DEBUG_OUTPUT")
   845         config.add_value("DEFINES", "HB_DEBUG_OUTPUT")
   826         config.add_value("DEFINES", "HB_WARNING_OUTPUT")
   846         config.add_value("DEFINES", "HB_WARNING_OUTPUT")
   827     if options.no_debug_output:
   847     if options.no_debug_output:
   828         config.add_value("DEFINES", "HB_NO_DEBUG_OUTPUT")
   848         config.add_value("DEFINES", "HB_NO_DEBUG_OUTPUT")
   829         config.add_value("DEFINES", "HB_NO_WARNING_OUTPUT")
   849         config.add_value("DEFINES", "HB_NO_WARNING_OUTPUT")
   830 
   850 
   831     # ensure that no QString(0) -like constructs slip in
   851     # ensure that no QString(0) -like constructs slip in
   832     config.add_value("DEFINES", "QT_QCHAR_CONSTRUCTOR")
   852     config.add_value("DEFINES", "QT_QCHAR_CONSTRUCTOR")
       
   853 
       
   854     # expose a flag indicating that tools were built with a host toolchain
       
   855     if options.hostqmakebin != None and options.hostmakebin != None:
       
   856         config.add_value("CONFIG", "host_tools")
   833 
   857 
   834     # TODO: is there any better way to expose functions to the whole source tree?
   858     # TODO: is there any better way to expose functions to the whole source tree?
   835     config._lines.append("include(%s)\n" % ConfigFile.format_dir((os.path.splitdrive(BUILDENV.sourcedir())[1]) + "/mkspecs/hb_functions.prf"))
   859     config._lines.append("include(%s)\n" % ConfigFile.format_dir((os.path.splitdrive(BUILDENV.sourcedir())[1]) + "/mkspecs/hb_functions.prf"))
   836 
   860 
   837     if options.verbose:
   861     if options.verbose: