async def _install(self, args, env): self.progress('install') if CMAKE_EXECUTABLE is None: raise RuntimeError("Could not find 'cmake' executable") cmd = [CMAKE_EXECUTABLE] cmake_ver = get_cmake_version() allow_job_args = True if cmake_ver and cmake_ver >= parse_version('3.15.0'): # CMake 3.15+ supports invoking `cmake --install` cmd += ['--install', args.build_base] # Job args not compatible with --install directive allow_job_args = False else: # fallback to the install target which implicitly runs a build if not cmake_ver: logger.warning( 'Unable to determine CMake version, building the install' "target instead of invoking 'cmake --install'") cmd += ['--build', args.build_base, '--target', 'install'] multi_configuration_generator = is_multi_configuration_generator( args.build_base, args.cmake_args) if multi_configuration_generator: cmd += ['--config', self._get_configuration(args)] elif allow_job_args: job_args = self._get_make_arguments(env) if job_args: cmd += ['--'] + job_args return await run(self.context, cmd, cwd=args.build_base, env=env)
async def _build(self, args, env): self.progress('build') # invoke build step if CMAKE_EXECUTABLE is None: raise RuntimeError("Could not find 'cmake' executable") cmd = [CMAKE_EXECUTABLE, '--build', args.build_base] if args.cmake_target: if args.cmake_target_skip_unavailable: if not await has_target(args.build_base, args.cmake_target): return cmd += ['--target', args.cmake_target] if args.cmake_clean_first: cmd += ['--clean-first'] if is_multi_configuration_generator(args.build_base, args.cmake_args): cmd += ['--config', self._get_configuration(args)] generator = get_generator(args.build_base) if 'Visual Studio' in generator: env = self._get_msbuild_environment(args, env) else: job_args = self._get_make_arguments() if job_args: cmd += ['--'] + job_args return await check_call(self.context, cmd, cwd=args.build_base, env=env)
async def _build(self, args, env, *, additional_targets=None): self.progress('build') # invoke build step if CMAKE_EXECUTABLE is None: raise RuntimeError("Could not find 'cmake' executable") targets = [] if args.cmake_target: targets.append(args.cmake_target) else: targets.append('') if additional_targets: targets += additional_targets multi_configuration_generator = is_multi_configuration_generator( args.build_base, args.cmake_args) if multi_configuration_generator: generator = get_generator(args.build_base) if 'Visual Studio' in generator: env = self._get_msbuild_environment(args, env) for i, target in enumerate(targets): cmd = [CMAKE_EXECUTABLE, '--build', args.build_base] if target: if args.cmake_target_skip_unavailable: if not await has_target(args.build_base, target): continue self.progress("build target '{target}'".format_map(locals())) cmd += ['--target', target] if i == 0 and args.cmake_clean_first: cmd += ['--clean-first'] if multi_configuration_generator: cmd += ['--config', self._get_configuration(args)] else: job_args = self._get_make_arguments(env) if job_args: cmd += ['--'] + job_args completed = await run(self.context, cmd, cwd=args.build_base, env=env) if completed.returncode: return completed.returncode