def main(argv): if len(argv) < 4: print( f"Usage: {argv[0]} <solution file> <bin directory> <lib directory>" ) sys.exit(2) solution_path = argv[1] bin_dir = argv[2] lib_dir = argv[3] solution_path = Path(solution_path) solution_dir = solution_path.parent solution = vcproj.solution.parse(solution_path) for project_file in solution.project_files(): project = vcproj.project.parse(solution_dir / project_file) if project.configuration_type() == 'StaticLibrary': project.set_output_directory('All Configurations', 'All Configurations', lib_dir) else: project.set_output_directory('All Configurations', 'All Configurations', bin_dir) # use default value for pdb file, should end up in OutDir project.set_program_database_file('All Configurations', 'All Configurations', None) # set output file to got to OutDir project.set_output_file('All Configurations', 'All Configurations', '$(OutDir)$(TargetName)$(TargetExt)') project.write()
def main(argv): if len(argv) < 3: print("Usage: " + argv[0] + " <solution file> <bin directory> <lib directory>") sys.exit(2) solution_path = argv[1] solution_dir = os.path.dirname(solution_path) bin_dir = argv[2] lib_dir = argv[3] solution = vcproj.solution.parse(solution_path) for project_file in solution.project_files(): project = vcproj.project.parse(os.path.join(solution_dir, project_file)) if project.configuration_type() == "StaticLibrary": project.set_output_directory("All Configurations", "All Configurations", lib_dir) else: project.set_output_directory("All Configurations", "All Configurations", bin_dir) # use default value for pdb file, should end up in OutDir project.set_program_database_file("All Configurations", "All Configurations", None) # set output file to got to OutDir project.set_output_file("All Configurations", "All Configurations", "$(OutDir)$(TargetName)$(TargetExt)") project.write()
def main(argv): if len(argv) < 2: print(f"Usage: {argv[0]} <solution file>") sys.exit(2) solution_path = Path(argv[1]) solution_dir = solution_path.parent solution = vcproj.solution.parse(solution_path) for project_file in solution.project_files(): printed_name = False project_path = solution_dir / project_file project_dir = project_path.parent project = vcproj.project.parse(project_path) files = [ *project.source_files(), *project.include_files(), *project.generic_files('None'), *project.generic_files('Text'), *project.generic_files('Image'), *project.generic_files('CustomBuild'), *project.generic_files('ResourceCompile'), *project.generic_files('ProjectReference'), ] for file in files: filepath = project_dir / file if not filepath.exists(): if not printed_name: printed_name = True print(project_file) print(f"\t{file}")
def main(argv): if len(argv) < 2: print(f"Usage: {argv[0]} <solution file>") sys.exit(2) solution_path = argv[1] solution_path = Path(solution_path) solution_dir = solution_path.parent solution = vcproj.solution.parse(solution_path) for project_file in solution.project_files(): print(project_file) project = vcproj.project.parse(solution_dir / project_file) for source_file in project.source_files(): print(f"\t{source_file}") for include_file in project.include_files(): print(f"\t{include_file}")
def main(argv): if len(argv) < 2: print("Usage: " + argv[0] + " <solution file>") sys.exit(2) solution_path = argv[1] solution_dir = os.path.dirname(solution_path) solution = vcproj.solution.parse(solution_path) for project_file in solution.project_files(): project = vcproj.project.parse(os.path.join(solution_dir, project_file)) if project.configuration_type() != "StaticLibrary": # Check for mismatched incr linking and debug format, debug format of None means default which is EditAndContinue if project.enable_incremental_linking( 'Debug', 'Win32') == False and project.debug_information_format( 'Debug', 'Win32') in ['EditAndContinue', None]: print("Set enable incremental to false for " + project_file) project.set_enable_incremental_linking('Debug', 'Win32', None) project.write()
#!/usr/bin/python # List all source and include files for each project in a solution. import vcproj.solution import vcproj.project import os solution_file = '../vcproj/tests/test_solution/test.sln' solution = vcproj.solution.parse(solution_file) for project_file in solution.project_files(): print(project_file) project = vcproj.project.parse(os.path.join(os.path.dirname(solution_file), project_file)) for source_file in project.source_files(): print("\t" + source_file) for include_file in project.include_files(): print("\t" + include_file)