| 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 hammer_bat = '$(ProjectDir)/%s/hammer.bat' % project_to_main | 108 |
| 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) |
| 109 | 111 |
| 110 # Project header | 112 # Project header |
| 111 xml_impl = xml.dom.getDOMImplementation() | 113 xml_impl = xml.dom.getDOMImplementation() |
| 112 doc = xml_impl.createDocument(None, 'VisualStudioProject', None) | 114 doc = xml_impl.createDocument(None, 'VisualStudioProject', None) |
| 113 | 115 |
| 114 n_root = doc.documentElement | 116 n_root = doc.documentElement |
| 115 n_root.setAttribute('ProjectType', 'Visual C++') | 117 n_root.setAttribute('ProjectType', 'Visual C++') |
| 116 n_root.setAttribute('Version', '8.00') | 118 n_root.setAttribute('Version', '8.00') |
| 117 n_root.setAttribute('Name', target_name) | 119 n_root.setAttribute('Name', target_name) |
| 118 n_root.setAttribute('ProjectGUID', MakeGuid(target_name)) | 120 n_root.setAttribute('ProjectGUID', MakeGuid(target_name)) |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 return | 428 return |
| 427 | 429 |
| 428 # Include tools we need | 430 # Include tools we need |
| 429 env.Tool('gather_inputs') | 431 env.Tool('gather_inputs') |
| 430 | 432 |
| 431 env.SetDefault( | 433 env.SetDefault( |
| 432 COMPONENT_VS_SOLUTION_DIR='$DESTINATION_ROOT/solution', | 434 COMPONENT_VS_SOLUTION_DIR='$DESTINATION_ROOT/solution', |
| 433 COMPONENT_VS_PROJECT_DIR='$COMPONENT_VS_SOLUTION_DIR/projects', | 435 COMPONENT_VS_PROJECT_DIR='$COMPONENT_VS_SOLUTION_DIR/projects', |
| 434 COMPONENT_VS_SOLUTION_SUFFIX='.sln', | 436 COMPONENT_VS_SOLUTION_SUFFIX='.sln', |
| 435 COMPONENT_VS_PROJECT_SUFFIX='.vcproj', | 437 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'), |
| 436 ) | 442 ) |
| 437 | 443 |
| 438 AddTargetGroup('all_solutions', 'solutions can be built') | 444 AddTargetGroup('all_solutions', 'solutions can be built') |
| 439 | 445 |
| 440 # Add builders | 446 # Add builders |
| 441 vcprojaction = SCons.Script.Action(ComponentVSProjectBuilder, varlist=[ | 447 vcprojaction = SCons.Script.Action(ComponentVSProjectBuilder, varlist=[ |
| 442 'TARGET_NAME', | 448 'TARGET_NAME', |
| 443 'TARGET_PATH', | 449 'TARGET_PATH', |
| 450 'COMPONENT_VS_PROJECT_SCRIPT_PATH', |
| 444 ]) | 451 ]) |
| 445 vcprojbuilder = SCons.Script.Builder( | 452 vcprojbuilder = SCons.Script.Builder( |
| 446 action=vcprojaction, | 453 action=vcprojaction, |
| 447 suffix='$COMPONENT_VS_PROJECT_SUFFIX') | 454 suffix='$COMPONENT_VS_PROJECT_SUFFIX') |
| 448 | 455 |
| 449 slnaction = SCons.Script.Action(ComponentVSSolutionBuilder, varlist=[ | 456 slnaction = SCons.Script.Action(ComponentVSSolutionBuilder, varlist=[ |
| 450 'SOLUTION_TARGETS', | 457 'SOLUTION_TARGETS', |
| 451 'SOLUTION_FOLDERS', | 458 'SOLUTION_FOLDERS', |
| 452 'SOLUTION_PROJECTS', | 459 'SOLUTION_PROJECTS', |
| 453 ]) | 460 ]) |
| 454 slnbuilder = SCons.Script.Builder( | 461 slnbuilder = SCons.Script.Builder( |
| 455 action=slnaction, | 462 action=slnaction, |
| 456 suffix='$COMPONENT_VS_SOLUTION_SUFFIX') | 463 suffix='$COMPONENT_VS_SOLUTION_SUFFIX') |
| 457 | 464 |
| 458 env.Append(BUILDERS={ | 465 env.Append(BUILDERS={ |
| 459 'ComponentVSProjectBuilder': vcprojbuilder, | 466 'ComponentVSProjectBuilder': vcprojbuilder, |
| 460 'ComponentVSSolutionBuilder': slnbuilder, | 467 'ComponentVSSolutionBuilder': slnbuilder, |
| 461 }) | 468 }) |
| OLD | NEW |