pro2cmake: Allow skipping subdirs projects via command line
Pass either --skip-subdirs-project to pro2cmake or --skip-subdirs-projects to run_pro2cmake. Change-Id: Ic444858f6fc6deb3c893782c0770993aa39d5579 Reviewed-by: Qt CMake Build Bot Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
c1e0e0adb2
commit
d7c4fa46ac
@ -155,6 +155,13 @@ def _parse_commandline():
|
||||
help="Don't use condition simplifier cache (conversion speed may decrease).",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--skip-subdirs-project",
|
||||
dest="skip_subdirs_project",
|
||||
action="store_true",
|
||||
help="Skip converting project if it ends up being a TEMPLATE=subdirs project.",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-i",
|
||||
"--ignore-skip-marker",
|
||||
@ -3485,6 +3492,15 @@ def should_convert_project(project_file_path: str = "", ignore_skip_marker: bool
|
||||
return True
|
||||
|
||||
|
||||
def should_convert_project_after_parsing(
|
||||
file_scope: Scope, skip_subdirs_project: bool = False
|
||||
) -> bool:
|
||||
template = file_scope.TEMPLATE
|
||||
if template == "subdirs" and skip_subdirs_project:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def main() -> None:
|
||||
# Be sure of proper Python version
|
||||
assert sys.version_info >= (3, 7)
|
||||
@ -3535,6 +3551,10 @@ def main() -> None:
|
||||
file_scope.dump()
|
||||
print("\n#### End of full .pro/.pri file structure.\n")
|
||||
|
||||
if not should_convert_project_after_parsing(file_scope, args.skip_subdirs_project):
|
||||
print(f'Skipping conversion of project: "{project_file_absolute_path}"')
|
||||
continue
|
||||
|
||||
generate_new_cmakelists(file_scope, is_example=args.is_example, debug=args.debug)
|
||||
|
||||
copy_generated_file = True
|
||||
|
@ -59,6 +59,12 @@ def parse_command_line():
|
||||
action="store_true",
|
||||
help="Run pro2cmake only on the main modules in qtbase.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--skip-subdirs-projects",
|
||||
dest="skip_subdirs_projects",
|
||||
action="store_true",
|
||||
help="Don't run pro2cmake on TEMPLATE=subdirs projects.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--is-example",
|
||||
dest="is_example",
|
||||
@ -162,6 +168,8 @@ def run(all_files: typing.List[str], pro2cmake: str, args: argparse.Namespace) -
|
||||
pro2cmake_args.append(pro2cmake)
|
||||
if args.is_example:
|
||||
pro2cmake_args.append("--is-example")
|
||||
if args.skip_subdirs_projects:
|
||||
pro2cmake_args.append("--skip-subdirs-project")
|
||||
pro2cmake_args.append(os.path.basename(filename))
|
||||
result = subprocess.run(
|
||||
pro2cmake_args,
|
||||
|
Loading…
x
Reference in New Issue
Block a user