| OLD | NEW |
| 1 # Copyright 2011 Google Inc. | 1 # Copyright 2011 Google Inc. |
| 2 # | 2 # |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # "Makefile" replacement to build skia for Windows. | 6 # "Makefile" replacement to build skia for Windows. |
| 7 # More info at https://sites.google.com/site/skiadocs/ | 7 # More info at https://sites.google.com/site/skiadocs/ |
| 8 # | 8 # |
| 9 # Some usage examples: | 9 # Some usage examples: |
| 10 # make clean | 10 # make clean |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 print '> %s' % command | 46 print '> %s' % command |
| 47 if os.system(command): | 47 if os.system(command): |
| 48 sys.exit(1) | 48 sys.exit(1) |
| 49 | 49 |
| 50 def MakeClean(): | 50 def MakeClean(): |
| 51 """Cross-platform "make clean" operation.""" | 51 """Cross-platform "make clean" operation.""" |
| 52 cd(SCRIPT_DIR) | 52 cd(SCRIPT_DIR) |
| 53 rmtree(OUT_SUBDIR) | 53 rmtree(OUT_SUBDIR) |
| 54 | 54 |
| 55 | 55 |
| 56 def CheckWindowsEnvironment(): | |
| 57 """For Windows: check environment variables needed for command-line build. | |
| 58 | |
| 59 If those environment variables are missing, try to set them. | |
| 60 If environment variables can be set up, this function returns; otherwise, | |
| 61 it displays an error message and exits. | |
| 62 """ | |
| 63 # If we already have the proper environment variables, nothing to do here. | |
| 64 try: | |
| 65 env_DevEnvDir = os.environ['DevEnvDir'] | |
| 66 return # found it, so we are done | |
| 67 except KeyError: | |
| 68 pass # go on and run the rest of this function | |
| 69 | |
| 70 print ('\nCould not find Visual Studio environment variables.' | |
| 71 '\nPerhaps you have not yet run vcvars32.bat as described at' | |
| 72 '\nhttp://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx ?') | |
| 73 found_path = None | |
| 74 try: | |
| 75 possible_path = os.path.abspath(os.path.join( | |
| 76 os.environ['VS100COMNTOOLS'], os.path.pardir, os.path.pardir, | |
| 77 'VC', 'bin', 'vcvars32.bat')) | |
| 78 if os.path.exists(possible_path): | |
| 79 found_path = possible_path | |
| 80 except KeyError: | |
| 81 pass | |
| 82 if found_path: | |
| 83 print '\nIt looks like you can run that script at:\n%s' % found_path | |
| 84 else: | |
| 85 print '\nUnable to find vcvars32.bat on your system.' | |
| 86 sys.exit(1) | |
| 87 | |
| 88 | |
| 89 def MakeWindows(targets): | 56 def MakeWindows(targets): |
| 90 """For Windows: build as appropriate for the command line arguments. | 57 """For Windows: build as appropriate for the command line arguments. |
| 91 | 58 |
| 92 parameters: | 59 parameters: |
| 93 targets: build targets as a list of strings | 60 targets: build targets as a list of strings |
| 94 """ | 61 """ |
| 95 # TODO(epoger): I'm not sure if this is needed for ninja builds. | |
| 96 CheckWindowsEnvironment() | |
| 97 | |
| 98 # Run gyp_skia to prepare Visual Studio projects. | 62 # Run gyp_skia to prepare Visual Studio projects. |
| 99 cd(SCRIPT_DIR) | 63 cd(SCRIPT_DIR) |
| 100 runcommand('python gyp_skia') | 64 runcommand('python gyp_skia') |
| 101 | 65 |
| 102 # We already built the gypfiles... | 66 # We already built the gypfiles... |
| 103 while TARGET_GYP in targets: | 67 while TARGET_GYP in targets: |
| 104 targets.remove(TARGET_GYP) | 68 targets.remove(TARGET_GYP) |
| 105 | 69 |
| 106 # And call ninja to do the work! | 70 # And call ninja to do the work! |
| 107 if targets: | 71 if targets: |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 print 'unknown platform (os.name=%s, sys.platform=%s); see %s' % ( | 127 print 'unknown platform (os.name=%s, sys.platform=%s); see %s' % ( |
| 164 os.name, sys.platform, 'https://sites.google.com/site/skiadocs/') | 128 os.name, sys.platform, 'https://sites.google.com/site/skiadocs/') |
| 165 sys.exit(1) | 129 sys.exit(1) |
| 166 sys.exit(0) | 130 sys.exit(0) |
| 167 | 131 |
| 168 | 132 |
| 169 # main() | 133 # main() |
| 170 Make(sys.argv[1:]) | 134 Make(sys.argv[1:]) |
| 171 | 135 |
| 172 | 136 |
| OLD | NEW |