def build(args, paths): if not os.path.exists(paths.build): os.makedirs(paths.build) if not os.path.exists(paths.result): os.makedirs(paths.result) prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt_creator, paths.qt] prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths] cmake_args = ['cmake', '-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths), '-DCMAKE_BUILD_TYPE=' + args.build_type, '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.install), '-G', 'Ninja'] # force MSVC on Windows, because it looks for GCC in the PATH first, # even if MSVC is first mentioned in the PATH... # TODO would be nicer if we only did this if cl.exe is indeed first in the PATH if common.is_windows_platform(): cmake_args += ['-DCMAKE_C_COMPILER=cl', '-DCMAKE_CXX_COMPILER=cl'] # TODO this works around a CMake bug https://gitlab.kitware.com/cmake/cmake/issues/20119 cmake_args += ['-DBUILD_WITH_PCH=OFF'] if args.with_docs: cmake_args += ['-DWITH_DOCS=ON'] ide_revision = common.get_commit_SHA(paths.src) if ide_revision: cmake_args += ['-DQTC_PLUGIN_REVISION=' + ide_revision] with open(os.path.join(paths.result, args.name + '.7z.git_sha'), 'w') as f: f.write(ide_revision) cmake_args += args.config_args common.check_print_call(cmake_args + [paths.src], paths.build) build_args = ['cmake', '--build', '.'] if args.make_args: build_args += ['--'] + args.make_args common.check_print_call(build_args, paths.build) if args.with_docs: common.check_print_call(['cmake', '--build', '.', '--target', 'docs'], paths.build) common.check_print_call(['cmake', '--install', '.', '--prefix', paths.install, '--strip'], paths.build) if args.with_docs: common.check_print_call(['cmake', '--install', '.', '--prefix', paths.install, '--component', 'qch_docs'], paths.build) common.check_print_call(['cmake', '--install', '.', '--prefix', paths.install, '--component', 'html_docs'], paths.build) if args.deploy: common.check_print_call(['cmake', '--install', '.', '--prefix', paths.install, '--component', 'Dependencies'], paths.build) common.check_print_call(['cmake', '--install', '.', '--prefix', paths.dev_install, '--component', 'Devel'], paths.build)
def build_qtcreatorcdbext(args, paths): if args.no_cdb: return if not os.path.exists(paths.qtcreatorcdbext_build): os.makedirs(paths.qtcreatorcdbext_build) prefix_paths = [common.to_posix_path(os.path.abspath(fp)) for fp in args.prefix_paths] cmake_args = ['-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths), '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.qtcreatorcdbext_install)] cmake_args += common_cmake_arguments(args) common.check_print_call(['cmake'] + cmake_args + [os.path.join(paths.src, 'src', 'libs', 'qtcreatorcdbext')], paths.qtcreatorcdbext_build) common.check_print_call(['cmake', '--build', '.'], paths.qtcreatorcdbext_build) common.check_print_call(['cmake', '--install', '.', '--prefix', paths.qtcreatorcdbext_install, '--component', 'qtcreatorcdbext'], paths.qtcreatorcdbext_build)
def build_wininterrupt(args, paths): if not common.is_windows_platform(): return if not os.path.exists(paths.wininterrupt_build): os.makedirs(paths.wininterrupt_build) prefix_paths = [common.to_posix_path(os.path.abspath(fp)) for fp in args.prefix_paths] cmake_args = ['-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths), '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.wininterrupt_install)] cmake_args += common_cmake_arguments(args) common.check_print_call(['cmake'] + cmake_args + [os.path.join(paths.src, 'src', 'tools', 'wininterrupt')], paths.wininterrupt_build) common.check_print_call(['cmake', '--build', '.'], paths.wininterrupt_build) common.check_print_call(['cmake', '--install', '.', '--prefix', paths.wininterrupt_install, '--component', 'wininterrupt'], paths.wininterrupt_build)
def common_cmake_arguments(args): separate_debug_info_option = 'ON' if args.with_debug_info else 'OFF' cmake_args = ['-DCMAKE_BUILD_TYPE=' + args.build_type, '-DQTC_SEPARATE_DEBUG_INFO=' + separate_debug_info_option, '-G', 'Ninja'] if args.python3: cmake_args += ['-DPYTHON_EXECUTABLE=' + args.python3] cmake_args += ['-DPython3_EXECUTABLE=' + args.python3] if args.module_paths: module_paths = [common.to_posix_path(os.path.abspath(fp)) for fp in args.module_paths] cmake_args += ['-DCMAKE_MODULE_PATH=' + ';'.join(module_paths)] # force MSVC on Windows, because it looks for GCC in the PATH first, # even if MSVC is first mentioned in the PATH... # TODO would be nicer if we only did this if cl.exe is indeed first in the PATH if common.is_windows_platform(): if not os.environ.get('CC') and not os.environ.get('CXX'): cmake_args += ['-DCMAKE_C_COMPILER=cl', '-DCMAKE_CXX_COMPILER=cl'] if args.python_path: python_library = glob.glob(os.path.join(args.python_path, 'libs', 'python??.lib')) if python_library: cmake_args += ['-DPYTHON_LIBRARY=' + python_library[0], '-DPYTHON_INCLUDE_DIR=' + os.path.join(args.python_path, 'include')] return cmake_args
def common_cmake_arguments(args): separate_debug_info_option = 'ON' if args.with_debug_info else 'OFF' cmake_args = [ '-DCMAKE_BUILD_TYPE=' + args.build_type, '-DQTC_SEPARATE_DEBUG_INFO=' + separate_debug_info_option, '-G', 'Ninja' ] if args.python3: cmake_args += ['-DPython3_EXECUTABLE=' + args.python3] if args.python_path: cmake_args += ['-DPython3_ROOT_DIR=' + args.python_path] if args.module_paths: module_paths = [ common.to_posix_path(os.path.abspath(fp)) for fp in args.module_paths ] cmake_args += ['-DCMAKE_MODULE_PATH=' + ';'.join(module_paths)] # force MSVC on Windows, because it looks for GCC in the PATH first, # even if MSVC is first mentioned in the PATH... # TODO would be nicer if we only did this if cl.exe is indeed first in the PATH if common.is_windows_platform(): if not os.environ.get('CC') and not os.environ.get('CXX'): cmake_args += ['-DCMAKE_C_COMPILER=cl', '-DCMAKE_CXX_COMPILER=cl'] pch_option = 'ON' if args.with_pch else 'OFF' cmake_args += ['-DBUILD_WITH_PCH=' + pch_option] # work around QTBUG-89754 # Qt otherwise adds dependencies on libGLX and libOpenGL cmake_args += ['-DOpenGL_GL_PREFERENCE=LEGACY'] return cmake_args
def build_qtcreator(args, paths): if not os.path.exists(paths.build): os.makedirs(paths.build) prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt] if paths.llvm: prefix_paths += [paths.llvm] if paths.elfutils: prefix_paths += [paths.elfutils] prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths] with_docs_str = 'OFF' if args.no_docs else 'ON' build_date_option = 'OFF' if args.no_build_date else 'ON' test_option = 'ON' if args.with_tests else 'OFF' cmake_args = [ 'cmake', '-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths), '-DCMAKE_BUILD_TYPE=' + args.build_type, '-DSHOW_BUILD_DATE=' + build_date_option, '-DWITH_DOCS=' + with_docs_str, '-DBUILD_DEVELOPER_DOCS=' + with_docs_str, '-DBUILD_EXECUTABLE_SDKTOOL=OFF', '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.install), '-DWITH_TESTS=' + test_option, '-G', 'Ninja' ] if args.python3: cmake_args += ['-DPYTHON_EXECUTABLE=' + args.python3] if args.module_paths: module_paths = [ common.to_posix_path(os.path.abspath(fp)) for fp in args.module_paths ] cmake_args += ['-DCMAKE_MODULE_PATH=' + ';'.join(module_paths)] # force MSVC on Windows, because it looks for GCC in the PATH first, # even if MSVC is first mentioned in the PATH... # TODO would be nicer if we only did this if cl.exe is indeed first in the PATH if common.is_windows_platform(): if not os.environ.get('CC') and not os.environ.get('CXX'): cmake_args += ['-DCMAKE_C_COMPILER=cl', '-DCMAKE_CXX_COMPILER=cl'] cmake_args += [ '-DBUILD_EXECUTABLE_WIN32INTERRUPT=OFF', '-DBUILD_EXECUTABLE_WIN64INTERRUPT=OFF', '-DBUILD_LIBRARY_QTCREATORCDBEXT=OFF' ] if args.python_path: python_library = glob.glob( os.path.join(args.python_path, 'libs', 'python??.lib')) if python_library: cmake_args += [ '-DPYTHON_LIBRARY=' + python_library[0], '-DPYTHON_INCLUDE_DIR=' + os.path.join(args.python_path, 'include') ] # TODO this works around a CMake bug https://gitlab.kitware.com/cmake/cmake/issues/20119 cmake_args += ['-DBUILD_WITH_PCH=OFF'] ide_revision = common.get_commit_SHA(paths.src) if ide_revision: cmake_args += [ '-DIDE_REVISION=ON', '-DIDE_REVISION_STR=' + ide_revision, '-DIDE_REVISION_URL=https://code.qt.io/cgit/qt-creator/qt-creator.git/log/?id=' + ide_revision ] cmake_args += args.config_args common.check_print_call(cmake_args + [paths.src], paths.build) build_args = ['cmake', '--build', '.'] if args.make_args: build_args += ['--'] + args.make_args common.check_print_call(build_args, paths.build) if not args.no_docs: common.check_print_call(['cmake', '--build', '.', '--target', 'docs'], paths.build) common.check_print_call( ['cmake', '--install', '.', '--prefix', paths.install, '--strip'], paths.build) common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.install, '--component', 'Dependencies' ], paths.build) common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.dev_install, '--component', 'Devel' ], paths.build) if args.with_debug_info: common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.debug_install, '--component', 'DebugInfo' ], paths.build) if not args.no_docs: common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.install, '--component', 'qch_docs' ], paths.build) common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.install, '--component', 'html_docs' ], paths.build)
def build_qtcreator(args, paths): if args.no_qtcreator: return if not os.path.exists(paths.build): os.makedirs(paths.build) prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt] if paths.llvm: prefix_paths += [paths.llvm] if paths.elfutils: prefix_paths += [paths.elfutils] prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths] with_docs_str = 'OFF' if args.no_docs else 'ON' build_date_option = 'OFF' if args.no_build_date else 'ON' test_option = 'ON' if args.with_tests else 'OFF' cmake_args = [ 'cmake', '-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths), '-DSHOW_BUILD_DATE=' + build_date_option, '-DWITH_DOCS=' + with_docs_str, '-DBUILD_DEVELOPER_DOCS=' + with_docs_str, '-DBUILD_EXECUTABLE_SDKTOOL=OFF', '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.install), '-DWITH_TESTS=' + test_option ] cmake_args += common_cmake_arguments(args) if common.is_windows_platform(): cmake_args += [ '-DBUILD_EXECUTABLE_WIN32INTERRUPT=OFF', '-DBUILD_EXECUTABLE_WIN64INTERRUPT=OFF', '-DBUILD_LIBRARY_QTCREATORCDBEXT=OFF' ] ide_revision = common.get_commit_SHA(paths.src) if ide_revision: cmake_args += [ '-DIDE_REVISION=ON', '-DIDE_REVISION_STR=' + ide_revision, '-DIDE_REVISION_URL=https://code.qt.io/cgit/qt-creator/qt-creator.git/log/?id=' + ide_revision ] cmake_args += args.config_args common.check_print_call(cmake_args + [paths.src], paths.build) build_args = ['cmake', '--build', '.'] if args.make_args: build_args += ['--'] + args.make_args common.check_print_call(build_args, paths.build) if not args.no_docs: common.check_print_call(['cmake', '--build', '.', '--target', 'docs'], paths.build) common.check_print_call( ['cmake', '--install', '.', '--prefix', paths.install, '--strip'], paths.build) common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.install, '--component', 'Dependencies' ], paths.build) common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.dev_install, '--component', 'Devel' ], paths.build) if args.with_debug_info: common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.debug_install, '--component', 'DebugInfo' ], paths.build) if not args.no_docs: common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.install, '--component', 'qch_docs' ], paths.build) common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.install, '--component', 'html_docs' ], paths.build)
def build(args, paths): if not os.path.exists(paths.build): os.makedirs(paths.build) if not os.path.exists(paths.result): os.makedirs(paths.result) prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt] prefix_paths += qtcreator_prefix_path(paths.qt_creator) prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths] separate_debug_info_option = 'ON' if args.with_debug_info else 'OFF' cmake_args = [ 'cmake', '-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths), '-DCMAKE_BUILD_TYPE=' + args.build_type, '-DQTC_SEPARATE_DEBUG_INFO=' + separate_debug_info_option, '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.install), '-G', 'Ninja' ] if args.module_paths: module_paths = [ common.to_posix_path(os.path.abspath(fp)) for fp in args.module_paths ] cmake_args += ['-DCMAKE_MODULE_PATH=' + ';'.join(module_paths)] # force MSVC on Windows, because it looks for GCC in the PATH first, # even if MSVC is first mentioned in the PATH... # TODO would be nicer if we only did this if cl.exe is indeed first in the PATH if common.is_windows_platform(): cmake_args += ['-DCMAKE_C_COMPILER=cl', '-DCMAKE_CXX_COMPILER=cl'] # TODO this works around a CMake bug https://gitlab.kitware.com/cmake/cmake/issues/20119 cmake_args += ['-DBUILD_WITH_PCH=OFF'] # work around QTBUG-89754 # Qt otherwise adds dependencies on libGLX and libOpenGL cmake_args += ['-DOpenGL_GL_PREFERENCE=LEGACY'] if args.with_docs: cmake_args += ['-DWITH_DOCS=ON'] ide_revision = common.get_commit_SHA(paths.src) if ide_revision: cmake_args += ['-DQTC_PLUGIN_REVISION=' + ide_revision] with open(os.path.join(paths.result, args.name + '.7z.git_sha'), 'w') as f: f.write(ide_revision) if not args.build_type.lower() == 'release' and args.sanitize_flags: cmake_args += [ '-DWITH_SANITIZE=ON', '-DSANITIZE_FLAGS=' + ",".join(args.sanitize_flags) ] cmake_args += args.config_args common.check_print_call(cmake_args + [paths.src], paths.build) build_args = ['cmake', '--build', '.'] if args.make_args: build_args += ['--'] + args.make_args common.check_print_call(build_args, paths.build) if args.with_docs: common.check_print_call(['cmake', '--build', '.', '--target', 'docs'], paths.build) common.check_print_call( ['cmake', '--install', '.', '--prefix', paths.install, '--strip'], paths.build) if args.with_docs: common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.install, '--component', 'qch_docs' ], paths.build) common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.install, '--component', 'html_docs' ], paths.build) if args.deploy: common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.install, '--component', 'Dependencies' ], paths.build) common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.dev_install, '--component', 'Devel' ], paths.build) if args.with_debug_info: common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.debug_install, '--component', 'DebugInfo' ], paths.build)
def build_qtcreator(args, paths): def cmake_option(option): return 'ON' if option else 'OFF' if args.no_qtcreator: return if not os.path.exists(paths.build): os.makedirs(paths.build) build_qbs = (True if not args.no_qbs and os.path.exists( os.path.join(paths.src, 'src', 'shared', 'qbs', 'CMakeLists.txt')) else False) prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt] if paths.llvm: prefix_paths += [paths.llvm] if paths.elfutils: prefix_paths += [paths.elfutils] prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths] cmake_args = [ 'cmake', '-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths), '-DSHOW_BUILD_DATE=' + cmake_option(not args.no_build_date), '-DWITH_DOCS=' + cmake_option(not args.no_docs), '-DBUILD_QBS=' + cmake_option(build_qbs), '-DBUILD_DEVELOPER_DOCS=' + cmake_option(not args.no_docs), '-DBUILD_EXECUTABLE_SDKTOOL=OFF', '-DQTC_FORCE_XCB=ON', '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.install), '-DWITH_TESTS=' + cmake_option(args.with_tests) ] cmake_args += common_cmake_arguments(args) if common.is_windows_platform(): cmake_args += [ '-DBUILD_EXECUTABLE_WIN32INTERRUPT=OFF', '-DBUILD_EXECUTABLE_WIN64INTERRUPT=OFF', '-DBUILD_LIBRARY_QTCREATORCDBEXT=OFF' ] ide_revision = common.get_commit_SHA(paths.src) if ide_revision: cmake_args += [ '-DIDE_REVISION=ON', '-DIDE_REVISION_STR=' + ide_revision[:10], '-DIDE_REVISION_URL=https://code.qt.io/cgit/qt-creator/qt-creator.git/log/?id=' + ide_revision ] if not args.build_type.lower() == 'release' and args.sanitize_flags: cmake_args += [ '-DWITH_SANITIZE=ON', '-DSANITIZE_FLAGS=' + ",".join(args.sanitize_flags) ] cmake_args += args.config_args common.check_print_call(cmake_args + [paths.src], paths.build) build_args = ['cmake', '--build', '.'] if args.make_args: build_args += ['--'] + args.make_args common.check_print_call(build_args, paths.build) if not args.no_docs: common.check_print_call(['cmake', '--build', '.', '--target', 'docs'], paths.build) common.check_print_call( ['cmake', '--install', '.', '--prefix', paths.install, '--strip'], paths.build) common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.install, '--component', 'Dependencies' ], paths.build) common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.dev_install, '--component', 'Devel' ], paths.build) if args.with_debug_info: common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.debug_install, '--component', 'DebugInfo' ], paths.build) if not args.no_docs: common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.install, '--component', 'qch_docs' ], paths.build) common.check_print_call([ 'cmake', '--install', '.', '--prefix', paths.install, '--component', 'html_docs' ], paths.build)