| OLD | NEW |
| 1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
| 2 # Copyright 2008, Google Inc. | 2 # Copyright 2008, Google Inc. |
| 3 # All rights reserved. | 3 # All rights reserved. |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 Returns: | 99 Returns: |
| 100 Zero if successful. | 100 Zero if successful. |
| 101 """ | 101 """ |
| 102 source = source # Silence gpylint | 102 source = source # Silence gpylint |
| 103 | 103 |
| 104 target_name = env['TARGET_NAME'] | 104 target_name = env['TARGET_NAME'] |
| 105 project_file = target[0].path | 105 project_file = target[0].path |
| 106 project_to_main = env.RelativePath(target[0].dir, env.Dir('$MAIN_DIR'), | 106 project_to_main = env.RelativePath(target[0].dir, env.Dir('$MAIN_DIR'), |
| 107 sep='/') | 107 sep='/') |
| 108 | 108 hammer_bat = '$(ProjectDir)/%s/hammer.bat' % project_to_main |
| 109 env_hammer_bat = env.Clone(VS_PROJECT_TO_MAIN_DIR=project_to_main) | |
| 110 hammer_bat = env_hammer_bat.subst('$COMPONENT_VS_PROJECT_SCRIPT_PATH', raw=1) | |
| 111 | 109 |
| 112 # Project header | 110 # Project header |
| 113 xml_impl = xml.dom.getDOMImplementation() | 111 xml_impl = xml.dom.getDOMImplementation() |
| 114 doc = xml_impl.createDocument(None, 'VisualStudioProject', None) | 112 doc = xml_impl.createDocument(None, 'VisualStudioProject', None) |
| 115 | 113 |
| 116 n_root = doc.documentElement | 114 n_root = doc.documentElement |
| 117 n_root.setAttribute('ProjectType', 'Visual C++') | 115 n_root.setAttribute('ProjectType', 'Visual C++') |
| 118 n_root.setAttribute('Version', '8.00') | 116 n_root.setAttribute('Version', '8.00') |
| 119 n_root.setAttribute('Name', target_name) | 117 n_root.setAttribute('Name', target_name) |
| 120 n_root.setAttribute('ProjectGUID', MakeGuid(target_name)) | 118 n_root.setAttribute('ProjectGUID', MakeGuid(target_name)) |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 return | 426 return |
| 429 | 427 |
| 430 # Include tools we need | 428 # Include tools we need |
| 431 env.Tool('gather_inputs') | 429 env.Tool('gather_inputs') |
| 432 | 430 |
| 433 env.SetDefault( | 431 env.SetDefault( |
| 434 COMPONENT_VS_SOLUTION_DIR='$DESTINATION_ROOT/solution', | 432 COMPONENT_VS_SOLUTION_DIR='$DESTINATION_ROOT/solution', |
| 435 COMPONENT_VS_PROJECT_DIR='$COMPONENT_VS_SOLUTION_DIR/projects', | 433 COMPONENT_VS_PROJECT_DIR='$COMPONENT_VS_SOLUTION_DIR/projects', |
| 436 COMPONENT_VS_SOLUTION_SUFFIX='.sln', | 434 COMPONENT_VS_SOLUTION_SUFFIX='.sln', |
| 437 COMPONENT_VS_PROJECT_SUFFIX='.vcproj', | 435 COMPONENT_VS_PROJECT_SUFFIX='.vcproj', |
| 438 COMPONENT_VS_PROJECT_SCRIPT_NAME = 'hammer.bat', | |
| 439 COMPONENT_VS_PROJECT_SCRIPT_PATH = ( | |
| 440 '$$(ProjectDir)/$VS_PROJECT_TO_MAIN_DIR/' | |
| 441 '$COMPONENT_VS_PROJECT_SCRIPT_NAME'), | |
| 442 ) | 436 ) |
| 443 | 437 |
| 444 AddTargetGroup('all_solutions', 'solutions can be built') | 438 AddTargetGroup('all_solutions', 'solutions can be built') |
| 445 | 439 |
| 446 # Add builders | 440 # Add builders |
| 447 vcprojaction = SCons.Script.Action(ComponentVSProjectBuilder, varlist=[ | 441 vcprojaction = SCons.Script.Action(ComponentVSProjectBuilder, varlist=[ |
| 448 'TARGET_NAME', | 442 'TARGET_NAME', |
| 449 'TARGET_PATH', | 443 'TARGET_PATH', |
| 450 'COMPONENT_VS_PROJECT_SCRIPT_PATH', | |
| 451 ]) | 444 ]) |
| 452 vcprojbuilder = SCons.Script.Builder( | 445 vcprojbuilder = SCons.Script.Builder( |
| 453 action=vcprojaction, | 446 action=vcprojaction, |
| 454 suffix='$COMPONENT_VS_PROJECT_SUFFIX') | 447 suffix='$COMPONENT_VS_PROJECT_SUFFIX') |
| 455 | 448 |
| 456 slnaction = SCons.Script.Action(ComponentVSSolutionBuilder, varlist=[ | 449 slnaction = SCons.Script.Action(ComponentVSSolutionBuilder, varlist=[ |
| 457 'SOLUTION_TARGETS', | 450 'SOLUTION_TARGETS', |
| 458 'SOLUTION_FOLDERS', | 451 'SOLUTION_FOLDERS', |
| 459 'SOLUTION_PROJECTS', | 452 'SOLUTION_PROJECTS', |
| 460 ]) | 453 ]) |
| 461 slnbuilder = SCons.Script.Builder( | 454 slnbuilder = SCons.Script.Builder( |
| 462 action=slnaction, | 455 action=slnaction, |
| 463 suffix='$COMPONENT_VS_SOLUTION_SUFFIX') | 456 suffix='$COMPONENT_VS_SOLUTION_SUFFIX') |
| 464 | 457 |
| 465 env.Append(BUILDERS={ | 458 env.Append(BUILDERS={ |
| 466 'ComponentVSProjectBuilder': vcprojbuilder, | 459 'ComponentVSProjectBuilder': vcprojbuilder, |
| 467 'ComponentVSSolutionBuilder': slnbuilder, | 460 'ComponentVSSolutionBuilder': slnbuilder, |
| 468 }) | 461 }) |
| OLD | NEW |