| OLD | NEW |
| (Empty) |
| 1 # Copyright 2008-2009 Google Inc. | |
| 2 # | |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 # you may not use this file except in compliance with the License. | |
| 5 # You may obtain a copy of the License at | |
| 6 # | |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 # | |
| 9 # Unless required by applicable law or agreed to in writing, software | |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 # See the License for the specific language governing permissions and | |
| 13 # limitations under the License. | |
| 14 # ======================================================================== | |
| 15 | |
| 16 Import('env') | |
| 17 | |
| 18 # Build subdirectories before switching to use WDK | |
| 19 env.BuildSConscript('x86_encoder') | |
| 20 | |
| 21 # Build at warning level 4. | |
| 22 env.FilterOut(CCFLAGS=['/W3']) | |
| 23 env.Append( | |
| 24 CCFLAGS = [ | |
| 25 '/W4', | |
| 26 '/Wall', | |
| 27 ], | |
| 28 ) | |
| 29 | |
| 30 def _UseWdkCrt(env): | |
| 31 env.Prepend( | |
| 32 WDK_PATH = '$GOOGLECLIENT/third_party/windows_driver_kit_vc80/files', | |
| 33 CPPPATH = [ | |
| 34 '$WDK_PATH/inc/api/crt/stl70', | |
| 35 '$WDK_PATH/inc/crt', | |
| 36 '$WDK_PATH/inc/crt/atl71', | |
| 37 ], | |
| 38 LIBPATH = [ | |
| 39 '$WDK_PATH/lib/atl/i386', | |
| 40 '$WDK_PATH/lib/crt/i386', | |
| 41 ], | |
| 42 ) | |
| 43 # Magic for STL to work. Note that even though we're using ATL, a few things | |
| 44 # from STL are still required to correctly build, e.g. the iosfwd header. | |
| 45 env.Append( | |
| 46 CPPDEFINES = [ | |
| 47 '_CRT_SECURE_NO_WARNINGS', | |
| 48 '_STATIC_CPPLIB', # Taken from WDK makefile. | |
| 49 '_STL70_', # Taken from WDK makefile. | |
| 50 # Prefer ATL CRT replacements to system CRT. This makes a big | |
| 51 # difference on calls to CStringT::Format style functions--in testing, | |
| 52 # I measured a 5 KiB difference. | |
| 53 '_ATL_MIN_CRT', | |
| 54 '_ATL_CSTRING_NO_CRT', | |
| 55 ], | |
| 56 CCFLAGS = [ | |
| 57 '/D_SECURE_SCL=0', | |
| 58 '/EHsc', | |
| 59 '/FI$MAIN_DIR/mi_exe_stub/ptrdiff_t.h', | |
| 60 '/wd4068', # unknown pragma (ATL uses PreFAST pragmas) | |
| 61 ], | |
| 62 ) | |
| 63 env.FilterOut( | |
| 64 CPPDEFINES = [ | |
| 65 'NOMINMAX', | |
| 66 ], | |
| 67 CCFLAGS = [ | |
| 68 '/D_HAS_EXCEPTIONS=0', | |
| 69 '/RTC1', | |
| 70 ], | |
| 71 ) | |
| 72 | |
| 73 for omaha_version_info in env['omaha_versions_info']: | |
| 74 prefix = omaha_version_info.filename_prefix | |
| 75 temp_env = env.Clone() | |
| 76 | |
| 77 if prefix == 'TEST_': | |
| 78 temp_env['OBJPREFIX'] = temp_env.subst('test/$OBJPREFIX') | |
| 79 elif prefix: | |
| 80 raise Exception('ERROR: Unrecognized prefix "%s"' % prefix) | |
| 81 | |
| 82 temp_env.Append( | |
| 83 LIBS = [ | |
| 84 'lzma', | |
| 85 'mi_exe_stub_lib', | |
| 86 ('atls', 'atlsd')[temp_env.Bit('debug')], | |
| 87 ('msvcrt', 'libcmtd')[temp_env.Bit('debug')], | |
| 88 ('msvcprt', 'libcpmtd')[temp_env.Bit('debug')], | |
| 89 # 'msvcprt_btowc.lib', | |
| 90 # 'ntstc_msvcrt', # Only required if STL classes are used. | |
| 91 'shlwapi', | |
| 92 'version', | |
| 93 ], | |
| 94 RCFLAGS = [ | |
| 95 '/DVERSION_MAJOR=%d' % omaha_version_info.version_major, | |
| 96 '/DVERSION_MINOR=%d' % omaha_version_info.version_minor, | |
| 97 '/DVERSION_BUILD=%d' % omaha_version_info.version_build, | |
| 98 '/DVERSION_PATCH=%d' % omaha_version_info.version_patch, | |
| 99 '/DVERSION_NUMBER_STRING=\\"%s\\"' % ( | |
| 100 omaha_version_info.GetVersionString()), | |
| 101 '/DLANGUAGE_STRING=\\"%s\\"' % 'en' | |
| 102 ], | |
| 103 | |
| 104 # This avoids missing __load_config_used | |
| 105 LINKFLAGS = [ | |
| 106 '/SAFESEH:NO' | |
| 107 ], | |
| 108 ) | |
| 109 | |
| 110 | |
| 111 exe_inputs = temp_env.RES( | |
| 112 target=prefix + 'mi.res', | |
| 113 source=[ | |
| 114 'mi.rc', | |
| 115 ], | |
| 116 ) | |
| 117 | |
| 118 # Force a rebuild when the version changes. | |
| 119 temp_env.Depends(exe_inputs, '$MAIN_DIR/VERSION') | |
| 120 | |
| 121 for language in omaha_version_info.GetSupportedLanguages(): | |
| 122 base_name = 'mi_generated_resources_' + language | |
| 123 exe_inputs += temp_env.RES( | |
| 124 target=prefix + base_name + '.res', | |
| 125 source=base_name + '.rc', | |
| 126 ) | |
| 127 | |
| 128 if not temp_env.Bit('debug'): | |
| 129 # Stubs for W2k compatibility. | |
| 130 exe_inputs += '$WDK_PATH/lib/w2k/i386/msvcrt_win2000.obj', | |
| 131 | |
| 132 temp_env.ComponentProgram( | |
| 133 prog_name = prefix + 'mi_exe_stub', | |
| 134 source = exe_inputs, | |
| 135 ) | |
| 136 | |
| 137 | |
| 138 local_env = env.Clone() | |
| 139 | |
| 140 # Avoid target conflicts over extractor.obj | |
| 141 local_env['OBJSUFFIX'] = '_mi' + local_env['OBJSUFFIX'] | |
| 142 | |
| 143 local_inputs = [ | |
| 144 'mi.cc', | |
| 145 'process.cc', | |
| 146 'tar.cc', | |
| 147 '../base/extractor.cc', | |
| 148 ] | |
| 149 | |
| 150 # Precompiled headers cannot be used because debug builds must link against | |
| 151 # base.lib due to base/ inclusions in precompile.h. | |
| 152 local_env.ComponentStaticLibrary('mi_exe_stub_lib', | |
| 153 local_inputs, | |
| 154 use_pch_default=False) | |
| OLD | NEW |