def configure(): """Configures the cmake project.""" # Clear out the existing directory. if FLAGS.clean: if os.path.exists(FLAGS.out): logging.info('Clearing out %s', FLAGS.out) shutil.rmtree(FLAGS.out) if not os.path.exists(FLAGS.out): os.makedirs(FLAGS.out) # Configure.. cmake_cmd = [get_cmake(), '-B%s' % FLAGS.out] # Setup the right toolchain/compiler configuration. cmake_cmd += Toolchain.from_string(FLAGS.target).to_cmd() cmake_cmd += Crash.from_string(FLAGS.crash).to_cmd() cmake_cmd += BuildConfig.from_string(FLAGS.config).to_cmd() # Make darwin and msvc builds have QtWebEngine support for the default # build. if FLAGS.target == "darwin" or FLAGS.target == "windows": FLAGS.qtwebengine = True cmake_cmd += ['-DQTWEBENGINE=%s' % FLAGS.qtwebengine] if FLAGS.cmake_option: flags = ['-D%s' % x for x in FLAGS.cmake_option] logging.warn('Dangerously adding the following flags to cmake: %s', flags) cmake_cmd += flags if FLAGS.sdk_revision: sdk_revision = FLAGS.sdk_revision else: sdk_revision = read_simple_properties( os.path.join(get_aosp_root(), 'external', 'qemu', 'source.properties'))['Pkg.Revision'] cmake_cmd += ['-DOPTION_SDK_TOOLS_REVISION=%s' % sdk_revision] if FLAGS.sdk_build_number: cmake_cmd += [ '-DOPTION_SDK_TOOLS_BUILD_NUMBER=%s' % FLAGS.sdk_build_number ] if FLAGS.sanitizer: cmake_cmd += ['-DOPTION_ASAN=%s' % (','.join(FLAGS.sanitizer))] if FLAGS.minbuild: cmake_cmd += ['-DOPTION_MINBUILD=%s' % FLAGS.minbuild] if FLAGS.gfxstream: cmake_cmd += ['-DGFXSTREAM=%s' % FLAGS.gfxstream] cmake_cmd += Generator.from_string(FLAGS.generator).to_cmd() cmake_cmd += [get_qemu_root()] # Make sure we fixup clang in windows builds if platform.system() == 'Windows': fixup_windows_clang() run(cmake_cmd, FLAGS.out)
flags.DEFINE_string('sdk_build_number', None, 'The emulator sdk build number.') flags.DEFINE_enum('config', 'release', BuildConfig.values(), 'Whether we are building a release or debug configuration.') flags.DEFINE_enum('crash', 'none', Crash.values(), 'Which crash server to use or none if you do not want crash uploads.' 'enabling this will result in symbol processing and uploading during install.') flags.DEFINE_string('out', os.path.abspath('objs'), 'Use specific output directory.') flags.DEFINE_string('dist', None, 'Create distribution in directory') flags.DEFINE_boolean('qtwebengine', False, 'Build with QtWebEngine support') flags.DEFINE_boolean('tests', True, 'Run all the tests') flags.DEFINE_list( 'sanitizer', [], 'List of sanitizers ([address, thread]) to enable in the built binaries.') flags.DEFINE_enum('generator', 'ninja', Generator.values(), 'CMake generator to use.') flags.DEFINE_enum('target', platform.system().lower(), Toolchain.values(), 'Which platform to target. ' 'This will attempt to cross compile ' 'if the target does not match the current platform (%s)' % platform.system().lower()) flags.DEFINE_enum('build', 'check', Make.values(), 'Target that should be build after configuration. ' 'The config target will only configure the build, ' 'no symbol processing or testing will take place.') flags.DEFINE_boolean( 'clean', True, 'Clean the destination build directory before configuring. ' 'Setting this to false will attempt an incremental build. ' 'Note that this can introduce cmake caching issues.') flags.DEFINE_multi_string('cmake_option', [], 'Options that should be passed ' 'on directly to cmake. These will be passed on directly ' 'to the underlying cmake project. For example: ' '--cmake_option QEMU_UPSTREAM=FALSE')
) flags.DEFINE_string('out', os.path.abspath('objs'), 'Use specific output directory.') flags.DEFINE_string('dist', None, 'Create distribution in directory') flags.DEFINE_boolean('qtwebengine', False, 'Build with QtWebEngine support') flags.DEFINE_boolean('tests', True, 'Run all the tests') flags.DEFINE_integer('test_jobs', multiprocessing.cpu_count(), 'Specifies the number of tests to run simultaneously') flags.DEFINE_list( 'sanitizer', [], 'List of sanitizers ([address, thread]) to enable in the built binaries.') flags.DEFINE_enum('generator', 'ninja', Generator.values(), 'CMake generator to use.') flags.DEFINE_enum( 'target', platform.system().lower(), Toolchain.values(), 'Which platform to target. ' 'This will attempt to cross compile ' 'if the target does not match the current platform (%s)' % platform.system().lower()) flags.DEFINE_enum( 'build', 'check', Make.values(), 'Target that should be build after configuration. ' 'The config target will only configure the build, ' 'no symbol processing or testing will take place.') flags.DEFINE_boolean( 'clean', True, 'Clean the destination build directory before configuring. ' 'Setting this to false will attempt an incremental build. ' 'Note that this can introduce cmake caching issues.') flags.DEFINE_multi_string( 'cmake_option', [], 'Options that should be passed ' 'on directly to cmake. These will be passed on directly '
flags.DEFINE_integer( "test_jobs", multiprocessing.cpu_count(), "Specifies the number of tests to run simultaneously", ) flags.DEFINE_list( "sanitizer", [], "List of sanitizers ([address, thread]) to enable in the built binaries.", ) flags.DEFINE_enum("generator", "ninja", list(Generator.values()), "CMake generator to use.") flags.DEFINE_enum( "target", platform.system().lower(), list(Toolchain.values()), "Which platform to target. " "This will attempt to cross compile " "if the target does not match the current platform (%s)" % platform.system().lower(), ) flags.DEFINE_enum( "build", "check", list(Make.values()), "Target that should be build after configuration. " "The config target will only configure the build, " "no symbol processing or testing will take place.", ) flags.DEFINE_boolean( "clean",