twister: make ninja the default
Using ninja is up to 50% faster, make it the default and add an option to build with Make. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
7149173627
commit
79d7d0188b
4 changed files with 19 additions and 20 deletions
|
@ -37,7 +37,13 @@ class TwisterEnv:
|
|||
self.version = None
|
||||
self.toolchain = None
|
||||
self.options = options
|
||||
|
||||
if self.options.ninja:
|
||||
self.generator_cmd = "ninja"
|
||||
self.generator = "Ninja"
|
||||
else:
|
||||
self.generator_cmd = "make"
|
||||
self.generator = "Unix Makefiles"
|
||||
logger.info(f"Using {self.generator}..")
|
||||
|
||||
def discover(self):
|
||||
self.check_zephyr_version()
|
||||
|
|
|
@ -167,8 +167,6 @@ class CMake:
|
|||
self.source_dir = source_dir
|
||||
self.build_dir = build_dir
|
||||
self.log = "build.log"
|
||||
self.generator = None
|
||||
self.generator_cmd = None
|
||||
|
||||
self.default_encoding = sys.getdefaultencoding()
|
||||
|
||||
|
@ -258,7 +256,7 @@ class CMake:
|
|||
f'-DEXTRA_AFLAGS={aflags}',
|
||||
f'-DEXTRA_LDFLAGS={ldflags}',
|
||||
f'-DEXTRA_GEN_DEFINES_ARGS={gen_defines_args}',
|
||||
f'-G{self.generator}'
|
||||
f'-G{self.env.generator}'
|
||||
]
|
||||
|
||||
args = ["-D{}".format(a.replace('"', '')) for a in args]
|
||||
|
@ -389,13 +387,6 @@ class ProjectBuilder(FilterBuilder):
|
|||
self.env = env
|
||||
self.duts = None
|
||||
|
||||
if self.options.ninja:
|
||||
self.generator_cmd = "ninja"
|
||||
self.generator = "Ninja"
|
||||
else:
|
||||
self.generator_cmd = "make"
|
||||
self.generator = "Unix Makefiles"
|
||||
|
||||
@staticmethod
|
||||
def log_info(filename, inline_logs):
|
||||
filename = os.path.abspath(os.path.realpath(filename))
|
||||
|
|
|
@ -171,13 +171,9 @@ class TestInstance:
|
|||
if handler:
|
||||
handler.args = args
|
||||
handler.options = options
|
||||
handler.generator_cmd = env.generator_cmd
|
||||
handler.generator = env.generator
|
||||
handler.suite_name_check = not options.disable_suite_name_check
|
||||
if options.ninja:
|
||||
handler.generator_cmd = "ninja"
|
||||
handler.generator = "Ninja"
|
||||
else:
|
||||
handler.generator_cmd = "make"
|
||||
handler.generator = "Unix Makefiles"
|
||||
self.handler = handler
|
||||
|
||||
# Global testsuite parameters
|
||||
|
|
|
@ -239,6 +239,8 @@ Artificially long but functional example:
|
|||
|
||||
test_xor_subtest = case_select.add_mutually_exclusive_group()
|
||||
|
||||
test_xor_generator = case_select.add_mutually_exclusive_group()
|
||||
|
||||
valgrind_asan_group = parser.add_mutually_exclusive_group()
|
||||
|
||||
case_select.add_argument(
|
||||
|
@ -529,11 +531,15 @@ structure in the main Zephyr tree: boards/<arch>/<board_name>/""")
|
|||
"-M", "--runtime-artifact-cleanup", action="store_true",
|
||||
help="Delete artifacts of passing tests.")
|
||||
|
||||
parser.add_argument(
|
||||
"-N", "--ninja", action="store_true",
|
||||
help="Use the Ninja generator with CMake.",
|
||||
test_xor_generator.add_argument(
|
||||
"-N", "--ninja", action="store_true", default="--make" not in sys.argv,
|
||||
help="Use the Ninja generator with CMake. (This is the default)",
|
||||
required="--short-build-path" in sys.argv)
|
||||
|
||||
test_xor_generator.add_argument(
|
||||
"-k", "--make", action="store_true",
|
||||
help="Use the unix Makefile generator with CMake.")
|
||||
|
||||
parser.add_argument(
|
||||
"-n", "--no-clean", action="store_true",
|
||||
help="Re-use the outdir before building. Will result in "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue