def enabled(self, build): build.flags['perftools'] = util.get_flags(build.env, 'perftools', 0) build.flags['perftools_profiler'] = util.get_flags( build.env, 'perftools_profiler', 0) if int(build.flags['perftools']): return True return False
def enabled(self, build): # Meh, repeating this can't hurt, and we require knowing the status of msvcdebug. build.flags['msvcdebug'] = util.get_flags(build.env, 'msvcdebug', 0) build.flags['optimize'] = util.get_flags(build.env, 'optimize', 1) if int(build.flags['optimize']): return True else: return False
def enabled(self, build): if build.platform_is_windows or build.platform_is_osx: build.flags['hss1394'] = util.get_flags(build.env, 'hss1394', 1) else: build.flags['hss1394'] = util.get_flags(build.env, 'hss1394', 0) if int(build.flags['hss1394']): return True return False
def enabled(self, build): # Meh, repeating this can't hurt, and we require knowing the status of msvcdebug. build.flags['msvcdebug'] = util.get_flags(build.env, 'msvcdebug', 0) build.flags['qdebug'] = util.get_flags(build.env, 'qdebug', 0) if build.platform_is_windows: if int(build.flags['msvcdebug']): # Turn general debugging flag on too if msvcdebug is specified build.flags['qdebug'] = 1 if int(build.flags['qdebug']): return True return False
def enabled(self, build): if build.build_is_debug: return False build.flags['asmlib'] = util.get_flags(build.env, 'asmlib', 0) if int(build.flags['asmlib']): return True return False
def sse_enabled(self, build): optimize = int(util.get_flags(build.env, "optimize", 1)) return ( build.machine_is_64bit or (build.toolchain_is_msvs and optimize > 2) or (build.toolchain_is_gnu and optimize > 1) )
def enabled(self, build): # For now only make Bulk default on Linux only. Turn on for all # platforms after the 1.11.0 release. is_default = 1 if build.platform_is_linux else 0 build.flags['bulk'] = util.get_flags(build.env, 'bulk', is_default) if int(build.flags['bulk']): return True return False
def configure(self, build, conf): if not self.enabled(build): return if int(util.get_flags(build.env, 'qt_sqlite_plugin', 0)): raise Exception('WARNING: localecompare is not compatible with the Qt SQLite plugin') if not conf.CheckLib(['sqlite3']): raise Exception('Missing libsqlite3 -- exiting!') build.env.Append(CPPDEFINES='__SQLITE3__')
def enabled(self, build): # Default Opus to on but only throw an error if it was explicitly # requested. if 'opus' in build.flags: return int(build.flags['opus']) > 0 build.flags['opus'] = util.get_flags(build.env, 'opus', 1) if int(build.flags['opus']): return True return False
def enabled(self, build): build.flags['qdebug'] = util.get_flags(build.env, 'qdebug', 0) if build.platform_is_windows: if build.build_is_debug: # Turn general debugging flag on too if debug build is specified build.flags['qdebug'] = 1 if int(build.flags['qdebug']): return True return False
def enabled(self, build): build.flags['macappstore'] = util.get_flags(build.env, 'macappstore', 0) if int(build.flags['macappstore']): # Existence of the macappstore option forces vinylcontrol off due to # licensing issues. build.flags['vinylcontrol'] = 0 return True return False
def enabled(self, build): build.flags['vinylcontrol'] = util.get_flags(build.env, 'vinylcontrol', 0) # Existence of the macappstore option forces vinylcontrol off due to # licensing issues. if build.flags.has_key('macappstore') and int(build.flags['macappstore']): return False if int(build.flags['vinylcontrol']): return True return False
def configure(self, build, conf): if build.platform_is_windows: build.env.Append(CPPDEFINES = 'WIN%s' % build.bitwidth) build.env.Append(CPPPATH=['#lib/%s' % self.SOUNDTOUCH_PATH]) # TODO(XXX) when we figure out a better way to represent features, fix # this. optimize = int(util.get_flags(build.env, 'optimize', 1)) if build.machine_is_64bit or \ (build.toolchain_is_msvs and optimize > 1) or \ (build.toolchain_is_gnu and optimize > 2): build.env.Append(CPPDEFINES='ALLOW_X86_OPTIMIZATIONS')
def configure(self, build, conf): if build.platform_is_windows: build.env.Append(CPPDEFINES='WIN%s' % build.bitwidth) build.env.Append(CPPPATH=['#lib/%s' % self.SOUNDTOUCH_PATH]) # TODO(XXX) when we figure out a better way to represent features, fix # this. optimize = int(util.get_flags(build.env, 'optimize', 1)) if build.machine_is_64bit or \ (build.toolchain_is_msvs and optimize > 1) or \ (build.toolchain_is_gnu and optimize > 2): build.env.Append(CPPDEFINES='ALLOW_X86_OPTIMIZATIONS')
def configure(self, build, conf, env=None): if env is None: env = build.env if build.platform_is_windows: # Regardless of the bitwidth, ST checks for WIN32 env.Append(CPPDEFINES="WIN32") env.Append(CPPPATH=["#lib/%s" % self.SOUNDTOUCH_PATH]) # Check if the compiler has SSE extention enabled # Allways the case on x64 (core instructions) optimize = int(util.get_flags(env, "optimize", 1)) if self.sse_enabled(build): env.Append(CPPDEFINES="SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS")
def configure(self, build, conf, env=None): if env is None: env = build.env if build.platform_is_windows: # Regardless of the bitwidth, ST checks for WIN32 env.Append(CPPDEFINES='WIN32') env.Append(CPPPATH=['#lib/%s' % self.SOUNDTOUCH_PATH]) # Check if the compiler has SSE extention enabled # Allways the case on x64 (core instructions) optimize = int(util.get_flags(env, 'optimize', 1)) if self.sse_enabled(build): env.Append(CPPDEFINES='SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS')
def sources(self, build): sources = [ 'engine/enginebufferscalest.cpp', '#lib/%s/SoundTouch.cpp' % self.SOUNDTOUCH_PATH, '#lib/%s/TDStretch.cpp' % self.SOUNDTOUCH_PATH, '#lib/%s/RateTransposer.cpp' % self.SOUNDTOUCH_PATH, '#lib/%s/AAFilter.cpp' % self.SOUNDTOUCH_PATH, '#lib/%s/FIFOSampleBuffer.cpp' % self.SOUNDTOUCH_PATH, '#lib/%s/FIRFilter.cpp' % self.SOUNDTOUCH_PATH, '#lib/%s/PeakFinder.cpp' % self.SOUNDTOUCH_PATH, '#lib/%s/BPMDetect.cpp' % self.SOUNDTOUCH_PATH ] if build.platform_is_windows and build.toolchain_is_msvs: if build.machine_is_64bit: sources.append('#lib/%s/cpu_detect_x64_win.cpp' % self.SOUNDTOUCH_PATH) elif build.machine == 'x86': sources.append('#lib/%s/cpu_detect_x86_win.cpp' % self.SOUNDTOUCH_PATH) else: raise Exception("Unhandled CPU configuration for SoundTouch") elif build.toolchain_is_gnu: if build.machine == 'x86_64': sources.append('#lib/%s/cpu_detect_x64_gcc.cpp' % self.SOUNDTOUCH_PATH) else: sources.append('#lib/%s/cpu_detect_x86_gcc.cpp' % self.SOUNDTOUCH_PATH) else: raise Exception("Unhandled CPU configuration for SoundTouch") # TODO(XXX) when we figure out a better way to represent features, fix # this. optimize = int(util.get_flags(build.env, 'optimize', 1)) if build.machine_is_64bit or \ (build.toolchain_is_msvs and optimize > 1) or \ (build.toolchain_is_gnu and optimize > 2): sources.extend([ '#lib/%s/mmx_optimized.cpp' % self.SOUNDTOUCH_PATH, '#lib/%s/sse_optimized.cpp' % self.SOUNDTOUCH_PATH, ]) if build.toolchain_is_msvs and not build.machine_is_64bit: sources.append('#lib/%s/3dnow_win.cpp' % self.SOUNDTOUCH_PATH) else: # TODO(XXX) the docs refer to a 3dnow_gcc, but we don't seem to have # it. pass return sources
def sources(self, build): sources = ['engine/enginebufferscalest.cpp', '#lib/%s/SoundTouch.cpp' % self.SOUNDTOUCH_PATH, '#lib/%s/TDStretch.cpp' % self.SOUNDTOUCH_PATH, '#lib/%s/RateTransposer.cpp' % self.SOUNDTOUCH_PATH, '#lib/%s/AAFilter.cpp' % self.SOUNDTOUCH_PATH, '#lib/%s/FIFOSampleBuffer.cpp' % self.SOUNDTOUCH_PATH, '#lib/%s/FIRFilter.cpp' % self.SOUNDTOUCH_PATH, '#lib/%s/PeakFinder.cpp' % self.SOUNDTOUCH_PATH, '#lib/%s/BPMDetect.cpp' % self.SOUNDTOUCH_PATH] if build.platform_is_windows and build.toolchain_is_msvs: if build.machine_is_64bit: sources.append( '#lib/%s/cpu_detect_x64_win.cpp' % self.SOUNDTOUCH_PATH) elif build.machine == 'x86': sources.append( '#lib/%s/cpu_detect_x86_win.cpp' % self.SOUNDTOUCH_PATH) else: raise Exception("Unhandled CPU configuration for SoundTouch") elif build.toolchain_is_gnu: if build.machine == 'x86_64': sources.append( '#lib/%s/cpu_detect_x64_gcc.cpp' % self.SOUNDTOUCH_PATH) else: sources.append( '#lib/%s/cpu_detect_x86_gcc.cpp' % self.SOUNDTOUCH_PATH) else: raise Exception("Unhandled CPU configuration for SoundTouch") # TODO(XXX) when we figure out a better way to represent features, fix # this. optimize = int(util.get_flags(build.env, 'optimize', 1)) if build.machine_is_64bit or \ (build.toolchain_is_msvs and optimize > 1) or \ (build.toolchain_is_gnu and optimize > 2): sources.extend( ['#lib/%s/mmx_optimized.cpp' % self.SOUNDTOUCH_PATH, '#lib/%s/sse_optimized.cpp' % self.SOUNDTOUCH_PATH, ]) if build.toolchain_is_msvs and not build.machine_is_64bit: sources.append('#lib/%s/3dnow_win.cpp' % self.SOUNDTOUCH_PATH) else: # TODO(XXX) the docs refer to a 3dnow_gcc, but we don't seem to have # it. pass return sources
def enabled(self, build): build.flags['hid'] = util.get_flags(build.env, 'hid', 1) if int(build.flags['hid']): return True return False
def enabled(self, build): build.flags['test'] = util.get_flags(build.env, 'test', 0) or \ 'test' in SCons.BUILD_TARGETS if int(build.flags['test']): return True return False
def enabled(self, build): build.flags['asan'] = util.get_flags(build.env, 'asan', 0) return bool(int(build.flags['asan']))
def enabled(self, build): build.flags['vinylcontrol'] = util.get_flags(build.env, 'vinylcontrol', 0) if int(build.flags['vinylcontrol']): return True return False
def enabled(self, build): build.flags['coreaudio'] = util.get_flags( build.env, 'coreaudio', self.default(build)) if int(build.flags['coreaudio']): return True return False
def qt5_enabled(build): return int(util.get_flags(build.env, 'qt5', 0))
def enabled(self, build): build.flags['verbose'] = util.get_flags(build.env, 'verbose', 1) if int(build.flags['verbose']): return True return False
def sse_enabled(self, build): optimize = int(util.get_flags(build.env, 'optimize', 1)) return (build.machine_is_64bit or (build.toolchain_is_msvs and optimize > 2) or (build.toolchain_is_gnu and optimize > 1))
def enabled(self, build): build.flags['opengles'] = util.get_flags(build.env, 'opengles', 0) return int(build.flags['opengles'])
def enabled(self, build): build.flags['msvshacks'] = util.get_flags(build.env, 'msvshacks', 0) if int(build.flags['msvshacks']): return True return False
def enabled(self, build): build.flags[self.FLAG] = util.get_flags(build.env, self.FLAG, 0) if int(build.flags[self.FLAG]): return True return False
def enabled(self, build): build.flags['battery'] = util.get_flags(build.env, 'battery', 1) if int(build.flags['battery']): return True return False
def enabled(self, build): build.flags['profiling'] = util.get_flags(build.env, 'profiling', 0) if int(build.flags['profiling']): if build.platform_is_linux or build.platform_is_osx or build.platform_is_bsd: return True return False
def enabled(self, build): build.flags['localecompare'] = util.get_flags(build.env, 'localecompare', self.default(build)) if int(build.flags['localecompare']): return True return False
def configure(self, build, conf): qt_modules = Qt.enabled_modules(build) qt5 = Qt.qt5_enabled(build) # Emit various Qt defines build.env.Append(CPPDEFINES=['QT_SHARED', 'QT_TABLET_SUPPORT']) if qt5: # Enable qt4 support. build.env.Append(CPPDEFINES='QT_DISABLE_DEPRECATED_BEFORE') # Enable Qt include paths if build.platform_is_linux: if qt5 and not conf.CheckForPKG('Qt5Core', '5.0'): raise Exception('Qt >= 5.0 not found') elif not qt5 and not conf.CheckForPKG('QtCore', '4.6'): raise Exception('QT >= 4.6 not found') # This automatically converts QtXXX to Qt5XXX where appropriate. if qt5: build.env.EnableQt5Modules(qt_modules, debug=False) else: build.env.EnableQt4Modules(qt_modules, debug=False) if qt5: # Note that -reduce-relocations is enabled by default in Qt5. # So we must build the code with position independent code build.env.Append(CCFLAGS='-fPIE') elif build.platform_is_bsd: build.env.Append(LIBS=qt_modules) include_paths = [ '$QTDIR/include/%s' % module for module in qt_modules ] build.env.Append(CPPPATH=include_paths) elif build.platform_is_osx: qtdir = build.env['QTDIR'] build.env.Append(LINKFLAGS=' '.join('-framework %s' % m for m in qt_modules)) framework_path = Qt.find_framework_path(qtdir) if not framework_path: raise Exception( 'Could not find frameworks in Qt directory: %s' % qtdir) # Necessary for raw includes of headers like #include <qobject.h> build.env.Append(CPPPATH=[ os.path.join(framework_path, '%s.framework' % m, 'Headers') for m in qt_modules ]) # Framework path needs to be altered for CCFLAGS as well since a # header include of QtCore/QObject.h looks for a QtCore.framework on # the search path and a QObject.h in QtCore.framework/Headers. build.env.Append(CCFLAGS=['-F%s' % os.path.join(framework_path)]) build.env.Append(LINKFLAGS=['-F%s' % os.path.join(framework_path)]) # Copied verbatim from qt4.py and qt5.py. # TODO(rryan): Get our fixes merged upstream so we can use qt4.py # and qt5.py for OS X. qt4_module_defines = { 'QtScript': ['QT_SCRIPT_LIB'], 'QtSvg': ['QT_SVG_LIB'], 'Qt3Support': ['QT_QT3SUPPORT_LIB', 'QT3_SUPPORT'], 'QtSql': ['QT_SQL_LIB'], 'QtXml': ['QT_XML_LIB'], 'QtOpenGL': ['QT_OPENGL_LIB'], 'QtGui': ['QT_GUI_LIB'], 'QtNetwork': ['QT_NETWORK_LIB'], 'QtCore': ['QT_CORE_LIB'], } qt5_module_defines = { 'QtScript': ['QT_SCRIPT_LIB'], 'QtSvg': ['QT_SVG_LIB'], 'QtSql': ['QT_SQL_LIB'], 'QtXml': ['QT_XML_LIB'], 'QtOpenGL': ['QT_OPENGL_LIB'], 'QtGui': ['QT_GUI_LIB'], 'QtNetwork': ['QT_NETWORK_LIB'], 'QtCore': ['QT_CORE_LIB'], 'QtWidgets': ['QT_WIDGETS_LIB'], } module_defines = qt5_module_defines if qt5 else qt4_module_defines for module in qt_modules: build.env.AppendUnique( CPPDEFINES=module_defines.get(module, [])) if qt5: build.env["QT5_MOCCPPPATH"] = build.env["CPPPATH"] else: build.env["QT4_MOCCPPPATH"] = build.env["CPPPATH"] elif build.platform_is_windows: # This automatically converts QtCore to QtCore[45][d] where # appropriate. if qt5: build.env.EnableQt5Modules(qt_modules, debug=build.msvcdebug) else: build.env.EnableQt4Modules(qt_modules, debug=build.msvcdebug) # if build.static_dependencies: # # Pulled from qt-4.8.2-source\mkspecs\win32-msvc2010\qmake.conf # # QtCore # build.env.Append(LIBS = 'kernel32') # build.env.Append(LIBS = 'user32') # QtGui, QtOpenGL, libHSS1394 # build.env.Append(LIBS = 'shell32') # build.env.Append(LIBS = 'uuid') # build.env.Append(LIBS = 'ole32') # QtGui, # build.env.Append(LIBS = 'advapi32') # QtGui, portaudio, portmidi # build.env.Append(LIBS = 'ws2_32') # QtGui, QtNetwork, libshout # # QtGui # build.env.Append(LIBS = 'gdi32') #QtOpenGL # build.env.Append(LIBS = 'comdlg32') # build.env.Append(LIBS = 'oleaut32') # build.env.Append(LIBS = 'imm32') # build.env.Append(LIBS = 'winmm') # build.env.Append(LIBS = 'winspool') # # QtOpenGL # build.env.Append(LIBS = 'glu32') # build.env.Append(LIBS = 'opengl32') # Set the rpath for linux/bsd/osx. # This is not supported on OS X before the 10.5 SDK. using_104_sdk = (str(build.env["CCFLAGS"]).find("10.4") >= 0) compiling_on_104 = False if build.platform_is_osx: compiling_on_104 = (os.popen('sw_vers').readlines()[1].find('10.4') >= 0) if not build.platform_is_windows and not (using_104_sdk or compiling_on_104): qtdir = build.env['QTDIR'] # TODO(XXX) should we use find_framework_path here or keep lib # hardcoded? framework_path = os.path.join(qtdir, 'lib') if os.path.isdir(framework_path): build.env.Append(LINKFLAGS="-Wl,-rpath," + framework_path) build.env.Append(LINKFLAGS="-L" + framework_path) # QtSQLite DLL if build.platform_is_windows: build.flags['sqlitedll'] = util.get_flags(build.env, 'sqlitedll', 1)
def enabled(self, build): build.flags['shoutcast'] = util.get_flags(build.env, 'shoutcast', 1) if int(build.flags['shoutcast']): return True return False
def enabled(self, build): build.flags['ffmpeg'] = util.get_flags(build.env, 'ffmpeg', 0) if int(build.flags['ffmpeg']): return True return False
def configure(self, build, conf): # Emit various Qt defines build.env.Append(CPPDEFINES=['QT_SHARED', 'QT_TABLET_SUPPORT']) # Promo tracks is the only thing that uses webkit currently. use_qtwebkit = int(util.get_flags(build.env, 'promo', 0)) > 0 # TODO(XXX) what is with the slightly differing modules used for each # platform here? Document the differences and make them all # programmatically driven from one list instead of hard-coded multiple # times. qt_modules = [ 'QtCore', 'QtGui', 'QtOpenGL', 'QtXml', 'QtSvg', 'QtSql', 'QtScript', 'QtXmlPatterns', 'QtNetwork' #'QtUiTools', #'QtDesigner', ] if use_qtwebkit: qt_modules.append('QtWebKit') # Enable Qt include paths if build.platform_is_linux: if not conf.CheckForPKG('QtCore', '4.6'): raise Exception('QT >= 4.6 not found') #(This hopefully respects our qtdir=blah flag while linking now.) build.env.EnableQt4Modules(qt_modules, debug=False) elif build.platform_is_osx: qtdir = build.env['QTDIR'] build.env.Append(LINKFLAGS=' '.join('-framework %s' % m for m in qt_modules)) framework_path = Qt.find_framework_path(qtdir) if not framework_path: raise Exception( 'Could not find frameworks in Qt directory: %s' % qtdir) # Necessary for raw includes of headers like #include <qobject.h> build.env.Append(CPPPATH=[ os.path.join(framework_path, '%s.framework' % m, 'Headers') for m in qt_modules ]) # Framework path needs to be altered for CCFLAGS as well since a # header include of QtCore/QObject.h looks for a QtCore.framework on # the search path and a QObject.h in QtCore.framework/Headers. build.env.Append(CCFLAGS=['-F%s' % os.path.join(framework_path)]) build.env.Append(LINKFLAGS=['-F%s' % os.path.join(framework_path)]) # Setup Qt library includes for non-OSX if build.platform_is_linux or build.platform_is_bsd: build.env.Append(LIBS='QtCore') build.env.Append(LIBS='QtGui') build.env.Append(LIBS='QtOpenGL') build.env.Append(LIBS='QtXml') build.env.Append(LIBS='QtNetwork') build.env.Append(LIBS='QtScript') if use_qtwebkit: build.env.Append(LIBS='QtWebKit') elif build.platform_is_windows: build.env.Append(LIBPATH=['$QTDIR/lib']) # Since we use WebKit, that's only available dynamically qt_libs = [ 'QtCore4', 'QtGui4', 'QtOpenGL4', 'QtXml4', 'QtNetwork4', 'QtXmlPatterns4', 'QtSql4', 'QtScript4', ] if use_qtwebkit: qt_libs.append('QtWebKit4') # Use the debug versions of the libs if we are building in debug mode. if build.msvcdebug: qt_libs = [lib.replace('4', 'd4') for lib in qt_libs] build.env.Append(LIBS=qt_libs) # if build.static_dependencies: # # Pulled from qt-4.8.2-source\mkspecs\win32-msvc2010\qmake.conf # # QtCore # build.env.Append(LIBS = 'kernel32') # build.env.Append(LIBS = 'user32') # QtGui, QtOpenGL, libHSS1394 # build.env.Append(LIBS = 'shell32') # build.env.Append(LIBS = 'uuid') # build.env.Append(LIBS = 'ole32') # QtGui, # build.env.Append(LIBS = 'advapi32') # QtGui, portaudio, portmidi # build.env.Append(LIBS = 'ws2_32') # QtGui, QtNetwork, libshout # # QtGui # build.env.Append(LIBS = 'gdi32') #QtOpenGL # build.env.Append(LIBS = 'comdlg32') # build.env.Append(LIBS = 'oleaut32') # build.env.Append(LIBS = 'imm32') # build.env.Append(LIBS = 'winmm') # build.env.Append(LIBS = 'winspool') # # QtOpenGL # build.env.Append(LIBS = 'glu32') # build.env.Append(LIBS = 'opengl32') # Set Qt include paths for non-OSX if not build.platform_is_osx: include_paths = [ '$QTDIR/include/QtCore', '$QTDIR/include/QtGui', '$QTDIR/include/QtOpenGL', '$QTDIR/include/QtXml', '$QTDIR/include/QtNetwork', '$QTDIR/include/QtSql', '$QTDIR/include/QtScript', '$QTDIR/include/Qt' ] if use_qtwebkit: include_paths.append('$QTDIR/include/QtWebKit') build.env.Append(CPPPATH=include_paths) # Set the rpath for linux/bsd/osx. # This is not supported on OS X before the 10.5 SDK. using_104_sdk = (str(build.env["CCFLAGS"]).find("10.4") >= 0) compiling_on_104 = False if build.platform_is_osx: compiling_on_104 = (os.popen('sw_vers').readlines()[1].find('10.4') >= 0) if not build.platform_is_windows and not (using_104_sdk or compiling_on_104): qtdir = build.env['QTDIR'] # TODO(XXX) should we use find_framework_path here or keep lib # hardcoded? framework_path = os.path.join(qtdir, 'lib') if os.path.isdir(framework_path): build.env.Append(LINKFLAGS="-Wl,-rpath," + framework_path) build.env.Append(LINKFLAGS="-L" + framework_path) #QtSQLite DLL if build.platform_is_windows: build.flags['sqlitedll'] = util.get_flags(build.env, 'sqlitedll', 1)
def enabled(self, build): build.flags['optimize'] = util.get_flags(build.env, 'optimize', 1) if int(build.flags['optimize']): return True else: return False
def enabled(self, build): build.flags['autodjcrates'] = \ util.get_flags(build.env, 'autodjcrates', 1) if int(build.flags['autodjcrates']): return True return False
def enabled(self, build): any_enabled = False for keyword, _, _ in Sanitizers.SANITIZERS: build.flags[keyword] = util.get_flags(build.env, keyword, 0) any_enabled = any_enabled or bool(int(build.flags[keyword])) return any_enabled
def configure(self, build, conf): # Emit various Qt defines build.env.Append(CPPDEFINES=['QT_SHARED', 'QT_TABLET_SUPPORT']) # Enable Qt include paths if build.platform_is_linux: if not conf.CheckForPKG('QtCore', '4.6'): raise Exception('QT >= 4.6 not found') #Try using David's qt4.py's Qt4-module finding thingy instead of pkg-config. #(This hopefully respects our qtdir=blah flag while linking now.) build.env.EnableQt4Modules( [ 'QtCore', 'QtGui', 'QtOpenGL', 'QtXml', 'QtSvg', 'QtSql', 'QtScript', 'QtXmlPatterns', 'QtWebKit' #'QtUiTools', #'QtDesigner', ], debug=False) elif build.platform_is_osx: build.env.Append( LINKFLAGS= '-framework QtCore -framework QtOpenGL -framework QtGui -framework QtSql -framework QtXml -framework QtXmlPatterns -framework QtNetwork -framework QtSql -framework QtScript -framework QtWebKit' ) build.env.Append(CPPPATH=[ '/Library/Frameworks/QtCore.framework/Headers/', '/Library/Frameworks/QtOpenGL.framework/Headers/', '/Library/Frameworks/QtGui.framework/Headers/', '/Library/Frameworks/QtXml.framework/Headers/', '/Library/Frameworks/QtNetwork.framework/Headers/', '/Library/Frameworks/QtSql.framework/Headers/', '/Library/Frameworks/QtWebKit.framework/Headers/', '/Library/Frameworks/QtScript.framework/Headers/' ]) # Setup Qt library includes for non-OSX if build.platform_is_linux or build.platform_is_bsd: build.env.Append(LIBS='QtXml') build.env.Append(LIBS='QtGui') build.env.Append(LIBS='QtCore') build.env.Append(LIBS='QtNetwork') build.env.Append(LIBS='QtOpenGL') build.env.Append(LIBS='QtWebKit') build.env.Append(LIBS='QtScript') elif build.platform_is_windows: build.env.Append(LIBPATH=['$QTDIR/lib']) build.env.Append(LIBS='QtXml4') build.env.Append(LIBS='QtXmlPatterns4') build.env.Append(LIBS='QtSql4') build.env.Append(LIBS='QtGui4') build.env.Append(LIBS='QtCore4') build.env.Append(LIBS='QtWebKit4') build.env.Append(LIBS='QtNetwork4') build.env.Append(LIBS='QtOpenGL4') # Set Qt include paths for non-OSX if not build.platform_is_osx: build.env.Append(CPPPATH=[ '$QTDIR/include/QtCore', '$QTDIR/include/QtGui', '$QTDIR/include/QtXml', '$QTDIR/include/QtNetwork', '$QTDIR/include/QtSql', '$QTDIR/include/QtOpenGL', '$QTDIR/include/QtWebKit', '$QTDIR/include/Qt' ]) # Set the rpath for linux/bsd/osx. # This is not support on OS X before the 10.5 SDK. using_104_sdk = (str(build.env["CCFLAGS"]).find("10.4") >= 0) compiling_on_104 = False if build.platform_is_osx: compiling_on_104 = (os.popen('sw_vers').readlines()[1].find('10.4') >= 0) if not build.platform_is_windows and not (using_104_sdk or compiling_on_104): build.env.Append(LINKFLAGS="-Wl,-rpath,$QTDIR/lib") #QtSQLite DLL if build.platform_is_windows: build.flags['sqlitedll'] = util.get_flags(build.env, 'sqlitedll', 1)
def configure(self, build, conf): qt_modules = Qt.enabled_modules(build) qt5 = Qt.qt5_enabled(build) # Emit various Qt defines build.env.Append(CPPDEFINES=['QT_SHARED', 'QT_TABLET_SUPPORT']) if qt5: # Enable qt4 support. build.env.Append(CPPDEFINES='QT_DISABLE_DEPRECATED_BEFORE') # Set qt_sqlite_plugin flag if we should package the Qt SQLite plugin. build.flags['qt_sqlite_plugin'] = util.get_flags( build.env, 'qt_sqlite_plugin', 0) # Enable Qt include paths if build.platform_is_linux: if qt5 and not conf.CheckForPKG('Qt5Core', '5.0'): raise Exception('Qt >= 5.0 not found') elif not qt5 and not conf.CheckForPKG('QtCore', '4.6'): raise Exception('QT >= 4.6 not found') # This automatically converts QtXXX to Qt5XXX where appropriate. if qt5: build.env.EnableQt5Modules(qt_modules, debug=False) else: build.env.EnableQt4Modules(qt_modules, debug=False) if qt5: # Note that -reduce-relocations is enabled by default in Qt5. # So we must build the code with position independent code build.env.Append(CCFLAGS='-fPIE') elif build.platform_is_bsd: build.env.Append(LIBS=qt_modules) include_paths = ['$QTDIR/include/%s' % module for module in qt_modules] build.env.Append(CPPPATH=include_paths) elif build.platform_is_osx: qtdir = build.env['QTDIR'] build.env.Append( LINKFLAGS=' '.join('-framework %s' % m for m in qt_modules) ) framework_path = Qt.find_framework_path(qtdir) if not framework_path: raise Exception( 'Could not find frameworks in Qt directory: %s' % qtdir) # Necessary for raw includes of headers like #include <qobject.h> build.env.Append(CPPPATH=[os.path.join(framework_path, '%s.framework' % m, 'Headers') for m in qt_modules]) # Framework path needs to be altered for CCFLAGS as well since a # header include of QtCore/QObject.h looks for a QtCore.framework on # the search path and a QObject.h in QtCore.framework/Headers. build.env.Append(CCFLAGS=['-F%s' % os.path.join(framework_path)]) build.env.Append(LINKFLAGS=['-F%s' % os.path.join(framework_path)]) # Copied verbatim from qt4.py and qt5.py. # TODO(rryan): Get our fixes merged upstream so we can use qt4.py # and qt5.py for OS X. qt4_module_defines = { 'QtScript' : ['QT_SCRIPT_LIB'], 'QtSvg' : ['QT_SVG_LIB'], 'Qt3Support' : ['QT_QT3SUPPORT_LIB','QT3_SUPPORT'], 'QtSql' : ['QT_SQL_LIB'], 'QtXml' : ['QT_XML_LIB'], 'QtOpenGL' : ['QT_OPENGL_LIB'], 'QtGui' : ['QT_GUI_LIB'], 'QtNetwork' : ['QT_NETWORK_LIB'], 'QtCore' : ['QT_CORE_LIB'], } qt5_module_defines = { 'QtScript' : ['QT_SCRIPT_LIB'], 'QtSvg' : ['QT_SVG_LIB'], 'QtSql' : ['QT_SQL_LIB'], 'QtXml' : ['QT_XML_LIB'], 'QtOpenGL' : ['QT_OPENGL_LIB'], 'QtGui' : ['QT_GUI_LIB'], 'QtNetwork' : ['QT_NETWORK_LIB'], 'QtCore' : ['QT_CORE_LIB'], 'QtWidgets' : ['QT_WIDGETS_LIB'], } module_defines = qt5_module_defines if qt5 else qt4_module_defines for module in qt_modules: build.env.AppendUnique(CPPDEFINES=module_defines.get(module, [])) if qt5: build.env["QT5_MOCCPPPATH"] = build.env["CPPPATH"] else: build.env["QT4_MOCCPPPATH"] = build.env["CPPPATH"] elif build.platform_is_windows: # This automatically converts QtCore to QtCore[45][d] where # appropriate. if qt5: build.env.EnableQt5Modules(qt_modules, debug=build.build_is_debug) else: build.env.EnableQt4Modules(qt_modules, debug=build.build_is_debug) # if build.static_dependencies: # # Pulled from qt-4.8.2-source\mkspecs\win32-msvc2010\qmake.conf # # QtCore # build.env.Append(LIBS = 'kernel32') # build.env.Append(LIBS = 'user32') # QtGui, QtOpenGL, libHSS1394 # build.env.Append(LIBS = 'shell32') # build.env.Append(LIBS = 'uuid') # build.env.Append(LIBS = 'ole32') # QtGui, # build.env.Append(LIBS = 'advapi32') # QtGui, portaudio, portmidi # build.env.Append(LIBS = 'ws2_32') # QtGui, QtNetwork, libshout # # QtGui # build.env.Append(LIBS = 'gdi32') #QtOpenGL # build.env.Append(LIBS = 'comdlg32') # build.env.Append(LIBS = 'oleaut32') # build.env.Append(LIBS = 'imm32') # build.env.Append(LIBS = 'winmm') # build.env.Append(LIBS = 'winspool') # # QtOpenGL # build.env.Append(LIBS = 'glu32') # build.env.Append(LIBS = 'opengl32') # Set the rpath for linux/bsd/osx. # This is not supported on OS X before the 10.5 SDK. using_104_sdk = (str(build.env["CCFLAGS"]).find("10.4") >= 0) compiling_on_104 = False if build.platform_is_osx: compiling_on_104 = ( os.popen('sw_vers').readlines()[1].find('10.4') >= 0) if not build.platform_is_windows and not (using_104_sdk or compiling_on_104): qtdir = build.env['QTDIR'] # TODO(XXX) should we use find_framework_path here or keep lib # hardcoded? framework_path = os.path.join(qtdir, 'lib') if os.path.isdir(framework_path): build.env.Append(LINKFLAGS="-Wl,-rpath," + framework_path) build.env.Append(LINKFLAGS="-L" + framework_path)