| OLD | NEW |
| (Empty) |
| 1 # Copyright 2009, Google Inc. | |
| 2 # All rights reserved. | |
| 3 # | |
| 4 # Redistribution and use in source and binary forms, with or without | |
| 5 # modification, are permitted provided that the following conditions are | |
| 6 # met: | |
| 7 # | |
| 8 # * Redistributions of source code must retain the above copyright | |
| 9 # notice, this list of conditions and the following disclaimer. | |
| 10 # * Redistributions in binary form must reproduce the above | |
| 11 # copyright notice, this list of conditions and the following disclaimer | |
| 12 # in the documentation and/or other materials provided with the | |
| 13 # distribution. | |
| 14 # * Neither the name of Google Inc. nor the names of its | |
| 15 # contributors may be used to endorse or promote products derived from | |
| 16 # this software without specific prior written permission. | |
| 17 # | |
| 18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 | |
| 30 | |
| 31 | |
| 32 import os | |
| 33 import sys | |
| 34 | |
| 35 | |
| 36 # Underlay everything from the o3d directory. | |
| 37 Dir('tests').addRepository(Dir('#/')) | |
| 38 | |
| 39 def GetDotVersion(version): | |
| 40 return '%d.%d.%d.%d' % version | |
| 41 | |
| 42 def GetCommaVersion(version): | |
| 43 return '%d,%d,%d,%d' % version | |
| 44 | |
| 45 # This name is used by Javascript to find the plugin therefore it must | |
| 46 # not change. If you change this you must change the name in | |
| 47 # samples/o3djs/util.js but be aware, changing the name | |
| 48 # will break all apps that use o3d on the web. | |
| 49 plugin_name = 'O3D Plugin' | |
| 50 | |
| 51 # Get version string from o3d_version.py | |
| 52 o3d_version_vars = {} | |
| 53 if int(ARGUMENTS.get('MAC_KILLSWITCH', 0)): | |
| 54 execfile(str(File('installer/win/o3d_kill_version.py')), o3d_version_vars) | |
| 55 else: | |
| 56 execfile(str(File('installer/win/o3d_version.py')), o3d_version_vars) | |
| 57 plugin_version = o3d_version_vars['plugin_version'] | |
| 58 sdk_version = o3d_version_vars['sdk_version'] | |
| 59 | |
| 60 # -------------------------------------------------------------------- | |
| 61 | |
| 62 | |
| 63 # List of environment leaves | |
| 64 environment_list = [] | |
| 65 | |
| 66 base_env = Environment( | |
| 67 tools = ['component_setup'], | |
| 68 O3D_PLUGIN_NAME = plugin_name, | |
| 69 O3D_PLUGIN_VERSION = GetDotVersion(plugin_version), | |
| 70 O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version), | |
| 71 O3D_SDK_VERSION = GetDotVersion(sdk_version), | |
| 72 O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version), | |
| 73 | |
| 74 # TODO: this will be the default, but is set for now | |
| 75 COMPONENT_STATIC = True, | |
| 76 | |
| 77 COVERAGE_TARGETS = ['unit_tests', 'system_tests'], | |
| 78 MSVS_USE_MFC_DIRS=1, | |
| 79 ) | |
| 80 base_env.ApplySConscript(['svn_paths.scons']) | |
| 81 | |
| 82 base_env.Append( | |
| 83 # Some derived paths | |
| 84 NACL_NRD_XFER_SOURCE_DIR = '$NACL_DIR/src/trusted/desc', | |
| 85 NACL_PLUGIN_SOURCE_DIR = '$NACL_DIR/npapi_plugin', | |
| 86 DOCS_DIR = '$DESTINATION_ROOT/docs', | |
| 87 | |
| 88 CPPPATH = [ | |
| 89 # The internal dir is first so that headers in internal can replace | |
| 90 | |
| 91 # those in external. | |
| 92 | |
| 93 '$INTERNAL_DIR', | |
| 94 '$SCONSTRUCT_DIR/..', | |
| 95 '$SCONSTRUCT_DIR', | |
| 96 '$CHROME_SRC_DIR', | |
| 97 '$GTEST_DIR/include', | |
| 98 '$EXPERIMENTAL_O3D_DIR', | |
| 99 '$NACL_DIR/..', | |
| 100 ], | |
| 101 LIBPATH = '$LIBS_DIR', | |
| 102 RENDERER_INCLUDE_PATH = [ | |
| 103 '$ZLIB_DIR', | |
| 104 '$JPEG_DIR', | |
| 105 '$PNG_DIR', | |
| 106 ], | |
| 107 RENDERER_LIB_PATH = [ | |
| 108 ], | |
| 109 RENDERER_LIBS = [ | |
| 110 'libjpeg', | |
| 111 'libpng', | |
| 112 'zlib', | |
| 113 ], | |
| 114 | |
| 115 CPPDEFINES = [ | |
| 116 ['O3D_VERSION_NUMBER', '$O3D_PLUGIN_VERSION'], | |
| 117 'UNICODE', | |
| 118 ], | |
| 119 ICU_LIBS = ['icu'], | |
| 120 ) | |
| 121 | |
| 122 | |
| 123 # If you change this argument, you'll need to clean the whole project before | |
| 124 # rebuilding. | |
| 125 if ARGUMENTS.get('PROFILE_GLUE', ''): | |
| 126 base_env.Append( | |
| 127 CPPDEFINES = [ | |
| 128 'PROFILE_GLUE', | |
| 129 'PROFILE_CLIENT', | |
| 130 ]) | |
| 131 | |
| 132 # Define O3D_ENABLE_BREAKPAD if Pulse passes in: | |
| 133 # O3D_ENABLE_BREAKPAD=1 | |
| 134 if int(ARGUMENTS.get('O3D_ENABLE_BREAKPAD', 0)): | |
| 135 base_env.Append(CPPDEFINES = 'O3D_ENABLE_BREAKPAD') | |
| 136 | |
| 137 # Returns a list of objects built from a third-party directory. | |
| 138 def MakeObjects(env, stems, dir, extension): | |
| 139 return [env.ComponentObject(stem, '%s/%s.%s' % (dir, stem, extension)) | |
| 140 for stem in stems] | |
| 141 base_env.AddMethod(MakeObjects) | |
| 142 | |
| 143 def Python(env, args): | |
| 144 """Returns an action that executes python with the given args, specifying | |
| 145 PYTHONPATH from the scons environment""" | |
| 146 sep = ':' | |
| 147 if env.Bit('host_windows'): | |
| 148 sep = ';' | |
| 149 # Add PYTHONPATH from the scons environment to the OS environment. | |
| 150 # NOTE: Ideally that would be delay-evaluated, but I can't figure out | |
| 151 # how to do that in scons. | |
| 152 env['ENV']['PYTHONPATH'] = env.subst(sep.join(env['PYTHONPATH'])) | |
| 153 return Action(' '.join(['$PYTHON'] + args)) | |
| 154 | |
| 155 base_env.AddMethod(Python) | |
| 156 | |
| 157 # The base NaCl IMC lib. | |
| 158 nacl_imc_lib = 'google_nacl_imc' | |
| 159 | |
| 160 # All the libs required for IMC layer on the host. | |
| 161 nacl_imc_all_libs = [ | |
| 162 nacl_imc_lib, | |
| 163 'google_nacl_imc_c', | |
| 164 ] | |
| 165 | |
| 166 # All the libs required for HTP layer on the host. | |
| 167 nacl_htp_all_libs = [ | |
| 168 nacl_imc_lib, | |
| 169 'google_nacl_imc_c', | |
| 170 'nrd_xfer', | |
| 171 'gio', | |
| 172 'naclthread', | |
| 173 ] | |
| 174 | |
| 175 binaries_env = base_env.Clone() | |
| 176 binaries_env.Append( | |
| 177 BUILD_COMPONENTS = [ | |
| 178 'base', | |
| 179 'bitmap', | |
| 180 'compiler/antlr', | |
| 181 'compiler/technique', | |
| 182 'converter', | |
| 183 # 'converter_edge', | |
| 184 'core', | |
| 185 'import', | |
| 186 'ipc', | |
| 187 'plugin', | |
| 188 'samples', | |
| 189 'serializer', | |
| 190 'skia', | |
| 191 'tests', | |
| 192 'tests/common', | |
| 193 'utils', | |
| 194 'v8', | |
| 195 ], | |
| 196 # TODO: this is ugly, should all be rolling into builder. | |
| 197 NACL_OBJ_ROOT = '$NACL_DIR/scons-out/$NACL_VARIANT/obj', | |
| 198 NACL_LIB_DIR = '$NACL_DIR/scons-out/$NACL_VARIANT/lib', | |
| 199 NACL_HTP_LIBS = nacl_htp_all_libs, | |
| 200 ) | |
| 201 | |
| 202 # This function adds a path to a windows environment variable like PATH, | |
| 203 # INCLUDE, or LIB. | |
| 204 def AddPathToWindowsEnv(env_dict, var, path): | |
| 205 try: | |
| 206 src = env_dict[var] | |
| 207 except KeyError: | |
| 208 src = '' | |
| 209 if not src: | |
| 210 env_dict[var] = path | |
| 211 else: | |
| 212 env_dict[var] = '%s;%s' % (src, path) | |
| 213 | |
| 214 # This function builds the native client IMC or HTP libraries by | |
| 215 # calling scons to do a NaCl build. It should handle dependencies | |
| 216 # correctly and will not rebuild unless necessary. | |
| 217 def AddNaclBuildCommand(env, variant, platforms): | |
| 218 if sys.platform not in platforms: return | |
| 219 | |
| 220 nacl_os_env = dict(os.environ) | |
| 221 if sys.platform in ['win32', 'cygwin']: | |
| 222 script_suffix = '.bat' | |
| 223 # We want native client to use the same Platform SDK as ours. Pass it | |
| 224 # through INCLUDE and LIB. | |
| 225 AddPathToWindowsEnv(nacl_os_env, 'INCLUDE', | |
| 226 env.subst('$PLATFORM_SDK_VISTA_6_0_DIR/Include')) | |
| 227 AddPathToWindowsEnv(nacl_os_env, 'LIB', | |
| 228 env.subst('$PLATFORM_SDK_VISTA_6_0_DIR/Lib')) | |
| 229 else: | |
| 230 script_suffix = '.sh' | |
| 231 | |
| 232 build_libs = nacl_htp_all_libs | |
| 233 | |
| 234 targets = ['$NACL_LIB_DIR/${LIBPREFIX}' + f + '${LIBSUFFIX}' | |
| 235 for f in build_libs] | |
| 236 nacl_build_tool = '$PYTHON $SCONS_DIR/scons.py' | |
| 237 env.Command(targets, | |
| 238 ['$NACL_NRD_XFER_SOURCE_DIR', '$NACL_PLUGIN_SOURCE_DIR'], | |
| 239 nacl_build_tool + ' ' | |
| 240 'MODE=$NACL_VARIANT ' | |
| 241 'naclsdk_validate=0 ' | |
| 242 'sdl=none ' | |
| 243 '--verbose ' | |
| 244 '--file=SConstruct ' | |
| 245 '$DEBUG_OPTS ' | |
| 246 '-C $NACL_DIR ' | |
| 247 '$NACL_TARGETS', | |
| 248 source_scanner = DirScanner, | |
| 249 ENV = nacl_os_env, | |
| 250 # TODO: figure out why these can't be absolute paths | |
| 251 # when run on some flavors of linux. For now we can pass in the | |
| 252 # library name, which at least works everywhere. | |
| 253 NACL_TARGETS = build_libs, | |
| 254 NACL_VARIANT = variant, | |
| 255 DEBUG_OPTS = ['--debug=%s' % item for item in GetOption('debug')], | |
| 256 ) | |
| 257 | |
| 258 # TODO: This is really not the ideal way to do this -- for | |
| 259 # instance, the output goes into the NaCl scons-out directory instead | |
| 260 # of ours. | |
| 261 | |
| 262 # Add in the two variants of NACL. | |
| 263 win_platforms = ['win32', 'cygwin'] | |
| 264 mac_platforms = ['darwin'] | |
| 265 linux_platforms = ['linux', 'linux2'] | |
| 266 all_platforms = win_platforms + mac_platforms + linux_platforms | |
| 267 AddNaclBuildCommand(binaries_env, 'dbg-win', win_platforms) | |
| 268 AddNaclBuildCommand(binaries_env, 'opt-win', win_platforms) | |
| 269 AddNaclBuildCommand(binaries_env, 'dbg-mac', mac_platforms) | |
| 270 AddNaclBuildCommand(binaries_env, 'opt-mac', mac_platforms) | |
| 271 AddNaclBuildCommand(binaries_env, 'dbg-linux', linux_platforms) | |
| 272 AddNaclBuildCommand(binaries_env, 'opt-linux', linux_platforms) | |
| 273 AddNaclBuildCommand(binaries_env, 'nacl', all_platforms) | |
| 274 | |
| 275 def AddTestingFlags(env): | |
| 276 env.Append( | |
| 277 CPPDEFINES = ['TESTING'], | |
| 278 SELENIUM_EXTRA_FLAGS = [ | |
| 279 '--screenshots'] | |
| 280 ) | |
| 281 | |
| 282 # Windows ------------------------------------------------------------------ | |
| 283 | |
| 284 app_data_dir = "" | |
| 285 try: | |
| 286 app_data_dir = os.environ["APPDATA"] | |
| 287 except KeyError: | |
| 288 pass # This fails messily on mac + linux, so just ignore it. | |
| 289 | |
| 290 windows_env = binaries_env.Clone( | |
| 291 tools = [ | |
| 292 'target_platform_windows', | |
| 293 'directx_9_18_944_0_partial', | |
| 294 'atlmfc_vc80', | |
| 295 'midl', | |
| 296 ], | |
| 297 CG_DIR = '$CG_BASE_DIR/win', | |
| 298 FIREFOX_PLUGIN_DIR = os.path.join( | |
| 299 app_data_dir, 'Mozilla', 'plugins'), | |
| 300 IE_PLUGIN_DIR = os.path.join( | |
| 301 app_data_dir, 'Google', 'O3D'), | |
| 302 | |
| 303 # Turn off manifest generation, since we don't use that. | |
| 304 MANIFEST_FILE=False, | |
| 305 | |
| 306 # Use MIDL compiler from the platform sdk, since | |
| 307 # we're including headers from there. | |
| 308 MIDL = '"$PLATFORM_SDK_VISTA_6_0_DIR/Bin/Midl.exe"', | |
| 309 MIDLFLAGS=['"/I$PLATFORM_SDK_VISTA_6_0_DIR/Include"'], | |
| 310 ) | |
| 311 | |
| 312 windows_env.Append( | |
| 313 CPPPATH = [ | |
| 314 '$PLATFORM_SDK_VISTA_6_0_DIR/Include', | |
| 315 '$SWIFTSHADER_DIR', | |
| 316 ], | |
| 317 LIBPATH = [ | |
| 318 '$PLATFORM_SDK_VISTA_6_0_DIR/Lib', | |
| 319 ], | |
| 320 CPPDEFINES = [ | |
| 321 '_UNICODE', # turn on unicode | |
| 322 'WIN32', | |
| 323 '_WINDOWS', | |
| 324 'WIN32_LEAN_AND_MEAN', | |
| 325 'NOMINMAX', | |
| 326 '_WIN32_WINNT=0x0600', | |
| 327 '_CRT_SECURE_NO_WARNINGS', | |
| 328 'NACL_WINDOWS=1', | |
| 329 'SK_BUILD_FOR_WIN32', | |
| 330 ], | |
| 331 CCFLAGS = [ | |
| 332 '/Z7', # put debug info in obj files | |
| 333 '/EHsc', | |
| 334 '/wd4018', # comparison between signed and unsigned | |
| 335 '/wd4355', # using this in a constructor | |
| 336 '/wd4305', # truncating double to float | |
| 337 ], | |
| 338 LINKFLAGS = [ | |
| 339 '/DEBUG' # Always generate PDBs. | |
| 340 ], | |
| 341 LIBS = [ | |
| 342 'user32', | |
| 343 'gdi32', | |
| 344 'shell32', | |
| 345 'ws2_32', | |
| 346 'rpcrt4', | |
| 347 'kernel32', | |
| 348 'advapi32', | |
| 349 'psapi', | |
| 350 'winmm', # For V8 | |
| 351 'ws2_32', # For V8 | |
| 352 'Dbghelp', # For Chrome base | |
| 353 ], | |
| 354 BUILD_COMPONENTS = [ | |
| 355 'breakpad', | |
| 356 'installer/win', | |
| 357 'google_update', | |
| 358 'plugin/npapi_host_control', | |
| 359 'statsreport', | |
| 360 'statsreport/common', | |
| 361 'nbguidgen', | |
| 362 ], | |
| 363 COVERAGE_TARGETS = ['selenium'], | |
| 364 ) | |
| 365 windows_env.FilterOut(CPPDEFINES=['OS_WINDOWS=OS_WINDOWS']) | |
| 366 | |
| 367 windows_d3d_env = windows_env.Clone() | |
| 368 windows_d3d_env.Append( | |
| 369 CPPDEFINES = ['RENDERER_D3D9'], | |
| 370 RENDERER_INCLUDE_PATH = [], | |
| 371 RENDERER_LIB_PATH = [], | |
| 372 RENDERER_LIBS = ['d3d9', 'dxerr'], | |
| 373 ) | |
| 374 | |
| 375 windows_gl_env = windows_env.Clone() | |
| 376 windows_gl_env.Append( | |
| 377 RENDERER_INCLUDE_PATH = [ | |
| 378 '$GLEW_DIR/include', | |
| 379 '$CG_DIR/include', | |
| 380 ], | |
| 381 RENDERER_LIB_PATH = [ | |
| 382 '$CG_DIR/lib', | |
| 383 '$GLEW_DIR/lib', | |
| 384 ], | |
| 385 RENDERER_LIBS = [ | |
| 386 'OpenGL32', | |
| 387 'glew32', | |
| 388 'cg', | |
| 389 'cgGL', | |
| 390 ], | |
| 391 CPPDEFINES = [ | |
| 392 'RENDERER_GL' | |
| 393 ] | |
| 394 ) | |
| 395 | |
| 396 | |
| 397 def AddWindowsDebugSettings(env): | |
| 398 env.Append( | |
| 399 CCFLAGS = [ | |
| 400 '/Od', # no optimizations at all | |
| 401 '/MTd', # multi-threaded, staticly linked crt, with debugging | |
| 402 '/RTCsu', # complain about using un-inited (u), | |
| 403 # do more stack checks (s) | |
| 404 ], | |
| 405 CPPDEFINES = [ | |
| 406 '_DEBUG', # we are in debug mode | |
| 407 ], | |
| 408 LINKFLAGS = [ | |
| 409 '/FIXED:no' # Put in .reloc sections, to make Purify happy. | |
| 410 ], | |
| 411 ) | |
| 412 env.Replace( | |
| 413 DEBUG = True, | |
| 414 NACL_VARIANT = 'dbg-win', | |
| 415 ) | |
| 416 | |
| 417 | |
| 418 def AddWindowsOptimizedSettings(env): | |
| 419 env.Append( | |
| 420 CCFLAGS = [ | |
| 421 '/O1', # optimize for size | |
| 422 '/MT', # multi-threaded, staticly linked crt, release | |
| 423 ], | |
| 424 CPPDEFINES = [ | |
| 425 'NDEBUG', # we are in release mode | |
| 426 'ANTLR3_NODEBUGGER', # turn off remote ANTLR debugging | |
| 427 ], | |
| 428 ) | |
| 429 env.Replace( | |
| 430 DEBUG = False, | |
| 431 NACL_VARIANT = 'opt-win', | |
| 432 ) | |
| 433 | |
| 434 | |
| 435 windows_d3d_debug_env = windows_d3d_env.Clone( | |
| 436 BUILD_TYPE = 'dbg-d3d', | |
| 437 BUILD_TYPE_DESCRIPTION = 'Windows DirectX debug build', | |
| 438 ) | |
| 439 windows_d3d_debug_env.Append(BUILD_GROUPS = ['default', 'most']) | |
| 440 windows_d3d_debug_env.Append(CPPDEFINES = ['D3D_DEBUG_INFO']) | |
| 441 AddWindowsDebugSettings(windows_d3d_debug_env) | |
| 442 environment_list.append(windows_d3d_debug_env) | |
| 443 | |
| 444 | |
| 445 windows_d3d_optimized_env = windows_d3d_env.Clone( | |
| 446 BUILD_TYPE = 'opt-d3d', | |
| 447 BUILD_TYPE_DESCRIPTION = 'Windows DirectX optimized build', | |
| 448 ) | |
| 449 windows_d3d_optimized_env.Append(BUILD_GROUPS = ['most']) | |
| 450 AddWindowsOptimizedSettings(windows_d3d_optimized_env) | |
| 451 environment_list.append(windows_d3d_optimized_env) | |
| 452 | |
| 453 windows_d3d_test_debug_env = windows_d3d_env.Clone( | |
| 454 BUILD_TYPE = 'test-dbg-d3d', | |
| 455 BUILD_TYPE_DESCRIPTION = 'Windows DirectX debug build for testing', | |
| 456 ) | |
| 457 AddWindowsDebugSettings(windows_d3d_test_debug_env) | |
| 458 AddTestingFlags(windows_d3d_test_debug_env) | |
| 459 environment_list.append(windows_d3d_test_debug_env) | |
| 460 | |
| 461 windows_d3d_test_optimized_env = windows_d3d_env.Clone( | |
| 462 BUILD_TYPE = 'test-opt-d3d', | |
| 463 BUILD_TYPE_DESCRIPTION = 'Windows DirectX optimized build for testing', | |
| 464 ) | |
| 465 AddWindowsOptimizedSettings(windows_d3d_test_optimized_env) | |
| 466 AddTestingFlags(windows_d3d_test_optimized_env) | |
| 467 environment_list.append(windows_d3d_test_optimized_env) | |
| 468 | |
| 469 windows_gl_debug_env = windows_gl_env.Clone( | |
| 470 BUILD_TYPE = 'dbg-gl', | |
| 471 BUILD_TYPE_DESCRIPTION = 'Windows OpenGL debug build', | |
| 472 ) | |
| 473 windows_gl_debug_env.Append(BUILD_GROUPS = ['most']) | |
| 474 AddWindowsDebugSettings(windows_gl_debug_env) | |
| 475 environment_list.append(windows_gl_debug_env) | |
| 476 | |
| 477 windows_gl_optimized_env = windows_gl_env.Clone( | |
| 478 BUILD_TYPE = 'opt-gl', | |
| 479 BUILD_TYPE_DESCRIPTION = 'Windows OpenGL optimized build', | |
| 480 ) | |
| 481 windows_gl_optimized_env.Append(BUILD_GROUPS = ['most']) | |
| 482 AddWindowsOptimizedSettings(windows_gl_optimized_env) | |
| 483 environment_list.append(windows_gl_optimized_env) | |
| 484 | |
| 485 # MacOS ------------------------------------------------------------------ | |
| 486 | |
| 487 mac_env = binaries_env.Clone( | |
| 488 tools = ['target_platform_mac'], | |
| 489 FIREFOX_PLUGIN_DIR = '/Library/Internet Plug-Ins', | |
| 490 GL_DIR = '/System/Library/Frameworks/OpenGL.framework/Versions/A', | |
| 491 CG_DIR = '$CG_BASE_DIR/mac', | |
| 492 CCFLAGS = [ | |
| 493 '-Wstrict-aliasing', | |
| 494 '-gstabs+', | |
| 495 '-fno-eliminate-unused-debug-symbols', | |
| 496 ], | |
| 497 ) | |
| 498 mac_env.FilterOut(CPPDEFINES = ['OS_MACOSX=OS_MACOSX']) | |
| 499 | |
| 500 mac_env.Append(CPPDEFINES = ['RENDERER_GL', | |
| 501 'GTEST_NOT_MAC_FRAMEWORK_MODE', | |
| 502 ['NACL_OSX', '1'], | |
| 503 ['MAC_OS_X_VERSION_MIN_REQUIRED', | |
| 504 'MAC_OS_X_VERSION_10_4'], | |
| 505 'SK_BUILD_FOR_MAC' | |
| 506 ], | |
| 507 RENDERER_INCLUDE_PATH = [ | |
| 508 '$CG_DIR/include', | |
| 509 '$GLEW_DIR/include', | |
| 510 ], | |
| 511 RENDERER_LIB_PATH = [ | |
| 512 '$GLEW_DIR/lib', | |
| 513 ], | |
| 514 RENDERER_LIBS = [ | |
| 515 'MacStaticGLEW', | |
| 516 ], | |
| 517 CXXFLAGS = [ | |
| 518 '-Wno-deprecated', | |
| 519 ], | |
| 520 CCFLAGS = [ | |
| 521 '-mmacosx-version-min=10.4' | |
| 522 ], | |
| 523 BUILD_COMPONENTS = [ | |
| 524 'event', | |
| 525 'statsreport', | |
| 526 'statsreport/common', | |
| 527 ], | |
| 528 ) | |
| 529 | |
| 530 def AddMacDebugSettings(env): | |
| 531 env.Append( | |
| 532 CCFLAGS = ['-g'], | |
| 533 CPPDEFINES = ['_DEBUG'] | |
| 534 ) | |
| 535 env.Replace( | |
| 536 DEBUG = True, | |
| 537 NACL_VARIANT = 'dbg-mac', | |
| 538 ) | |
| 539 | |
| 540 def AddMacOptimizedSettings(env): | |
| 541 env.Append( | |
| 542 BUILD_GROUPS = ['most'], | |
| 543 CCFLAGS = ['-O3'], | |
| 544 CPPDEFINES = ['NDEBUG', 'ANTLR3_NO_DEBUGGER'] | |
| 545 ) | |
| 546 env.Replace( | |
| 547 DEBUG = False, | |
| 548 NACL_VARIANT = 'opt-mac', | |
| 549 ) | |
| 550 | |
| 551 | |
| 552 mac_debug_env = mac_env.Clone( | |
| 553 BUILD_TYPE = 'dbg-mac', | |
| 554 BUILD_TYPE_DESCRIPTION = 'MacOS debug build', | |
| 555 DEBUG = True, | |
| 556 NACL_VARIANT = 'dbg-mac', | |
| 557 ) | |
| 558 | |
| 559 AddMacDebugSettings(mac_debug_env) | |
| 560 environment_list.append(mac_debug_env) | |
| 561 | |
| 562 mac_optimized_env = mac_env.Clone( | |
| 563 BUILD_TYPE = 'opt-mac', | |
| 564 BUILD_TYPE_DESCRIPTION = 'MacOS optimized build', | |
| 565 ) | |
| 566 | |
| 567 AddMacOptimizedSettings(mac_optimized_env) | |
| 568 environment_list.append(mac_optimized_env) | |
| 569 | |
| 570 mac_test_optimized_env = mac_optimized_env.Clone( | |
| 571 BUILD_TYPE = 'test-opt-mac', | |
| 572 BUILD_TYPE_DESCRIPTION = 'MacOS optimized build for testing', | |
| 573 ) | |
| 574 AddTestingFlags(mac_test_optimized_env) | |
| 575 environment_list.append(mac_test_optimized_env) | |
| 576 | |
| 577 mac_debug_env.Append( | |
| 578 BUILD_GROUPS = ['default', 'most'], | |
| 579 ) | |
| 580 | |
| 581 | |
| 582 # Linux ------------------------------------------------------------------ | |
| 583 | |
| 584 linux_env = binaries_env.Clone( | |
| 585 tools = ['target_platform_linux'], | |
| 586 FIREFOX_PLUGIN_DIR = '/home/$USER/.mozilla/plugins', | |
| 587 CG_DIR = '$CG_BASE_DIR/linux', | |
| 588 ) | |
| 589 linux_env.FilterOut(CPPDEFINES = ['OS_LINUX=OS_LINUX']) | |
| 590 if base_env.Bit('host_linux'): | |
| 591 linux_env.ParseConfig('pkg-config --cflags --libs gtk+-2.0') | |
| 592 | |
| 593 linux_env.Append( | |
| 594 RENDERER_INCLUDE_PATH = [ | |
| 595 '$GLEW_DIR/include', | |
| 596 '$CG_DIR/include', | |
| 597 ], | |
| 598 RENDERER_LIB_PATH = [ | |
| 599 '$CG_DIR/lib', | |
| 600 '$GLEW_DIR/lib', | |
| 601 ], | |
| 602 RENDERER_LIBS = [ | |
| 603 'GL', | |
| 604 'GLEW', | |
| 605 'Cg', | |
| 606 'CgGL', | |
| 607 ], | |
| 608 CPPDEFINES = [ | |
| 609 'RENDERER_GL', | |
| 610 'LINUX', | |
| 611 ['NACL_LINUX', '1'], | |
| 612 'SK_BUILD_FOR_UNIX' | |
| 613 ], | |
| 614 CCFLAGS = ['-Wstrict-aliasing', '-fvisibility=hidden', '-m32'], | |
| 615 LINKFLAGS = ['-m32'], | |
| 616 LIBS = ['pthread', 'rt', 'dl'], | |
| 617 NACL_HTP_LIBS = ['ssl', 'crypto'], | |
| 618 BUILD_COMPONENTS = [ | |
| 619 'installer/linux', | |
| 620 'event', | |
| 621 ], | |
| 622 ) | |
| 623 | |
| 624 linux_cg_dir = ARGUMENTS.get('linux-cg-dir', 'hermetic') | |
| 625 if linux_cg_dir != 'hermetic': | |
| 626 linux_cg_dir = linux_cg_dir or '/usr' | |
| 627 linux_env['CG_DIR'] = linux_cg_dir | |
| 628 linux_glew_dir = ARGUMENTS.get('linux-glew-dir', 'hermetic') | |
| 629 if linux_glew_dir != 'hermetic': | |
| 630 linux_glew_dir = linux_glew_dir or '/usr' | |
| 631 linux_env['GLEW_DIR'] = linux_glew_dir | |
| 632 | |
| 633 | |
| 634 linux_debug_env = linux_env.Clone( | |
| 635 BUILD_TYPE = 'dbg-linux', | |
| 636 BUILD_TYPE_DESCRIPTION = 'Linux debug build', | |
| 637 DEBUG = True, | |
| 638 NACL_VARIANT = 'dbg-linux', | |
| 639 ) | |
| 640 linux_debug_env.Append( | |
| 641 CCFLAGS = ['-g'], | |
| 642 BUILD_GROUPS = ['default'] | |
| 643 ) | |
| 644 environment_list.append(linux_debug_env) | |
| 645 | |
| 646 | |
| 647 linux_optimized_env = linux_env.Clone( | |
| 648 BUILD_TYPE = 'opt-linux', | |
| 649 BUILD_TYPE_DESCRIPTION = 'Linux optimized build', | |
| 650 DEBUG = False, | |
| 651 NACL_VARIANT = 'opt-linux', | |
| 652 ) | |
| 653 linux_optimized_env.Append( | |
| 654 CCFLAGS = ['-O3'], | |
| 655 CPPDEFINES = ['-DNDEBUG', '-DANTLR3_NO_DEBUGGER'], | |
| 656 ) | |
| 657 environment_list.append(linux_optimized_env) | |
| 658 | |
| 659 # Documentation ------------------------------------------------------------- | |
| 660 | |
| 661 docs_env = base_env.Clone( | |
| 662 BUILD_TYPE = 'docs', | |
| 663 BUILD_TYPE_DESCRIPTION = 'Documentation for all platforms', | |
| 664 HOST_PLATFORMS = ['WINDOWS', 'LINUX', 'MAC'], | |
| 665 BUILD_COMPONENTS = ['documentation'], | |
| 666 ) | |
| 667 docs_env.Append(BUILD_GROUPS = ['default', 'most']) | |
| 668 environment_list.append(docs_env) | |
| 669 | |
| 670 # Code Coverage ------------------------------------------------------------- | |
| 671 | |
| 672 windows_d3d_coverage_env = windows_d3d_debug_env.Clone( | |
| 673 BUILD_TYPE = 'coverage-d3d', | |
| 674 BUILD_TYPE_DESCRIPTION = 'Windows DirectX code coverage build', | |
| 675 tools = ['code_coverage'], | |
| 676 ) | |
| 677 windows_d3d_coverage_env.FilterOut(BUILD_GROUPS = ['default', 'most']) | |
| 678 environment_list.append(windows_d3d_coverage_env) | |
| 679 | |
| 680 windows_gl_coverage_env = windows_gl_debug_env.Clone( | |
| 681 BUILD_TYPE = 'coverage-gl', | |
| 682 BUILD_TYPE_DESCRIPTION = 'Windows OpenGL code coverage build', | |
| 683 tools = ['code_coverage'], | |
| 684 ) | |
| 685 windows_gl_coverage_env.FilterOut(BUILD_GROUPS = ['default', 'most']) | |
| 686 environment_list.append(windows_gl_coverage_env) | |
| 687 | |
| 688 linux_coverage_env = linux_debug_env.Clone( | |
| 689 BUILD_TYPE = 'coverage-linux', | |
| 690 BUILD_TYPE_DESCRIPTION = 'Linux code coverage build', | |
| 691 tools = ['code_coverage'], | |
| 692 ) | |
| 693 linux_coverage_env.FilterOut(BUILD_GROUPS = ['default', 'most']) | |
| 694 environment_list.append(linux_coverage_env) | |
| 695 | |
| 696 mac_coverage_env = mac_debug_env.Clone( | |
| 697 BUILD_TYPE = 'coverage-mac', | |
| 698 BUILD_TYPE_DESCRIPTION = 'Mac code coverage build', | |
| 699 tools = ['code_coverage'], | |
| 700 ) | |
| 701 mac_coverage_env.FilterOut(BUILD_GROUPS = ['default', 'most']) | |
| 702 environment_list.append(mac_coverage_env) | |
| 703 | |
| 704 | |
| 705 # Build the world. | |
| 706 BuildComponents(environment_list) | |
| 707 | |
| 708 | |
| 709 # Generate a solution, defer to the end. | |
| 710 solution_env = base_env.Clone(tools = ['visual_studio_solution']) | |
| 711 solution = solution_env.Solution( | |
| 712 'o3d', environment_list, | |
| 713 exclude_pattern = '.*third_party.*', | |
| 714 extra_build_targets = { | |
| 715 'Firefox': 'c:/Program Files/Mozilla FireFox/firefox.exe', | |
| 716 'unit_tests': '$ARTIFACTS_DIR/unit_tests.exe', | |
| 717 'system_tests': '$ARTIFACTS_DIR/system_tests.exe', | |
| 718 'converter': '$ARTIFACTS_DIR/o3dConverter.exe', | |
| 719 }, | |
| 720 ) | |
| 721 solution_env.Alias('solution', solution) | |
| OLD | NEW |