diff options
author | gspencer@google.com <gspencer@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-24 01:46:45 +0000 |
---|---|---|
committer | gspencer@google.com <gspencer@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-24 01:46:45 +0000 |
commit | 746cd5788d57799fee1e327867ab9d4e9a76d6af (patch) | |
tree | dba40e195700f6f841c9c945b8fd2519128328f7 /o3d/build | |
parent | 015c1e689f04a11f07401394da0bf13018218fe1 (diff) | |
download | chromium_src-746cd5788d57799fee1e327867ab9d4e9a76d6af.zip chromium_src-746cd5788d57799fee1e327867ab9d4e9a76d6af.tar.gz chromium_src-746cd5788d57799fee1e327867ab9d4e9a76d6af.tar.bz2 |
This adds in the GYP files needed for our GYP build,
and modifies the DEPS file extensively to match.
Review URL: http://codereview.chromium.org/131116
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19091 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/build')
-rw-r--r-- | o3d/build/all.gyp | 33 | ||||
-rw-r--r-- | o3d/build/build_nacl.py | 169 | ||||
-rw-r--r-- | o3d/build/common.gypi | 80 | ||||
-rw-r--r-- | o3d/build/nacl.gyp | 57 |
4 files changed, 339 insertions, 0 deletions
diff --git a/o3d/build/all.gyp b/o3d/build/all.gyp new file mode 100644 index 0000000..6ca0803 --- /dev/null +++ b/o3d/build/all.gyp @@ -0,0 +1,33 @@ +# Copyright (c) 2009 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': [ + '../../build/common.gypi', + 'common.gypi', + ], + 'targets': [ + { + 'target_name': 'All', + 'type': 'none', + 'dependencies': [ + '../../<(antlrdir)/antlr.gyp:*', + '../../<(fcolladadir)/fcollada.gyp:*', + '../../<(jpegdir)/libjpeg.gyp:*', + '../../<(pngdir)/libpng.gyp:*', + '../../<(zlibdir)/zlib.gyp:*', + '../../base/base.gyp:base', + '../../breakpad/breakpad.gyp:*', + '../compiler/technique/technique.gyp:*', + '../converter/converter.gyp:*', + '../core/core.gyp:*', + '../import/import.gyp:*', + '../plugin/idl/idl.gyp:*', + '../plugin/plugin.gyp:*', + '../serializer/serializer.gyp:*', + '../utils/utils.gyp:*', + ], + }, + ], +} diff --git a/o3d/build/build_nacl.py b/o3d/build/build_nacl.py new file mode 100644 index 0000000..044e9a3 --- /dev/null +++ b/o3d/build/build_nacl.py @@ -0,0 +1,169 @@ +#!/usr/bin/python2.4 +# Copyright 2009 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This file is just here so that we can modify the python path before +# invoking nixysa. + +import os +import os.path +import shutil +import subprocess +import sys + +third_party = os.path.join('..', '..', 'third_party') +gflags_dir = os.path.join(third_party, 'gflags', 'python') +sys.path.append(gflags_dir) + +import gflags + +FLAGS = gflags.FLAGS +gflags.DEFINE_string('configuration', 'Debug', + 'Specify which configuration to build.') + +gflags.DEFINE_string('platform', 'win', + 'Specify which platform to build.') + +gflags.DEFINE_boolean('debug', False, + 'Whether or not to turn on debug output ' + 'when running scons.') + +gflags.DEFINE_string('output', '.', 'Sets the output directory.') + + +def CopyIfNewer(inputs, output_dir): + '''Copy the inputs to the output directory, but only if the files are + newer than the destination files.''' + for input in inputs: + output = os.path.join(output_dir, os.path.basename(input)) + if os.path.exists(input): + if (not os.path.exists(output) or + os.path.getmtime(input) > os.path.getmtime(output)): + try: + print 'Copying from %s to %s' % (input, output) + shutil.copy2(input, output) + except: + return False + else: + print '%s is up to date.' % output + return True + +def PrependToPath(path, item): + '''Prepend an item to an environment variable path.''' + orig_path = os.environ.get(path) + if orig_path: + new_path = os.pathsep.join([item, orig_path]) + else: + new_path = item + + os.environ[path] = new_path + +def AppendToPath(path, item): + '''Append an item to an environment variable path.''' + orig_path = os.environ.get(path) + if orig_path: + new_path = os.pathsep.join([orig_path, item]) + else: + new_path = item + + os.environ[path] = new_path + +def FindPlatformSDK(): + '''On Windows, find the installed location of the Platform SDK.''' + import _winreg + try: + winsdk_key = _winreg.OpenKey( + _winreg.HKEY_LOCAL_MACHINE, + 'SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.1\\WinSDKBuild') + except WindowsError: + try: + winsdk_key = _winreg.OpenKey( + _winreg.HKEY_LOCAL_MACHINE, + 'SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.0A\\WinSDKBuild') + except WindowsError: + print 'The Windows SDK version 6.0 or later needs to be installed' + sys.exit(1) + try: + winsdk_dir, value_type = _winreg.QueryValueEx(winsdk_key, + 'InstallationFolder') + except WindowsError: + print 'The Windows SDK version 6.0 or later needs to be installed' + sys.exit(1) + _winreg.CloseKey(winsdk_key) + + # Strip off trailing slashes + winsdk_dir = winsdk_dir.rstrip('\\/') + AppendToPath('PATH', os.path.join(winsdk_dir, 'Bin')) + AppendToPath('INCLUDE', os.path.join(winsdk_dir, 'Include')) + AppendToPath('LIB', os.path.join(winsdk_dir, 'Lib')) + +def main(args): + extra_args = FLAGS(args) + # strip off argv[0] + extra_args = extra_args[1:] + + pythonpath = os.path.join(third_party, 'scons', 'scons-local') + PrependToPath('PYTHONPATH', pythonpath) + + binutils_path = os.path.join(third_party, 'gnu_binutils', 'files') + AppendToPath('PATH', binutils_path) + + config = 'opt' + if FLAGS.configuration == 'Debug': + config = 'dbg' + elif FLAGS.configuration == 'Release': + config = 'opt' + + mode = '%s-%s' % (config, FLAGS.platform) + + native_client_dir = os.path.join(third_party, 'native_client', + 'googleclient', 'native_client') + + args = [ + 'MODE=%s' % mode, + 'naclsdk_validate=0', + 'sdl=none', + '--verbose', + '--file=SConstruct', + '-C', + native_client_dir, + ] + scons = os.path.join(third_party, 'scons', 'scons.py') + args = [sys.executable, scons] + args + extra_args + + # Add the platform SDK to INCLUDE and LIB + if FLAGS.platform == 'win': + FindPlatformSDK() + + print 'Executing %s' % ' '.join(args) + status = subprocess.call(args) + + # Calculate what the output files should be. + outputs = [] + for arg in extra_args: + file_path = os.path.join(native_client_dir, + 'scons-out', mode, 'lib', arg) + if FLAGS.platform == 'win': + file_path = file_path + '.lib' + else: + file_path = file_path + '.a' + outputs.append(file_path) + + if status == 0 and not CopyIfNewer(outputs, FLAGS.output): + sys.exit(-1) + else: + sys.exit(status) + +if __name__ == '__main__': + main(sys.argv) diff --git a/o3d/build/common.gypi b/o3d/build/common.gypi new file mode 100644 index 0000000..471700c --- /dev/null +++ b/o3d/build/common.gypi @@ -0,0 +1,80 @@ +# Copyright (c) 2009 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': [ + '../../build/common.gypi', + ], + 'variables': { + 'antlrdir': 'third_party/antlr3', + 'breakpaddir': 'breakpad/src', + 'fcolladadir': 'third_party/fcollada/files', + 'gtestdir': 'testing/gtest/include', + 'jpegdir': 'third_party/libjpeg', + 'nacldir': 'third_party/native_client/googleclient', + 'nixysadir': 'third_party/nixysa/files', + 'npapidir': 'third_party/npapi/files', + 'pngdir': 'third_party/libpng', + 'skiadir': 'third_party/skia/include', + 'zlibdir': 'third_party/zlib', + }, + 'conditions' : [ + ['OS == "win"', + { + 'variables': { + 'renderer': 'd3d9', + 'cgdir': 'third_party/cg/files/win', + 'LIBRARY_SUFFIX': '.lib', + 'CONFIGURATION': '$(ConfigurationName)', + }, + 'target_defaults': { + 'defines': [ + '_CRT_SECURE_NO_WARNINGS', + 'RENDERER_D3D9', + 'OS_WIN', + 'NACL_WINDOWS', + ], + 'msvs_disabled_warnings': [4355], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'AdditionalOptions': '/MP', + }, + }, + }, + }, + ], + ['OS == "mac"', + { + 'variables': { + 'renderer': 'gl', + 'cgdir': 'third_party/cg/files/mac', + 'LIBRARY_SUFFIX': '.a', + 'CONFIGURATION': '$(CONFIGURATION)', + }, + 'target_defaults': { + 'defines': [ + 'RENDERER_GL', + 'OS_MACOSX', + ], + }, + }, + ], + ['OS == "linux"', + { + 'variables': { + 'renderer': 'gl', + 'cgdir': 'third_party/cg/files/linux', + 'LIBRARY_SUFFIX': '.a', + 'CONFIGURATION': '$(CONFIGURATION)', + }, + 'target_defaults': { + 'defines': [ + 'RENDERER_GL', + 'OS_LINUX', + ], + }, + }, + ], + ], +} diff --git a/o3d/build/nacl.gyp b/o3d/build/nacl.gyp new file mode 100644 index 0000000..99ed5ec --- /dev/null +++ b/o3d/build/nacl.gyp @@ -0,0 +1,57 @@ +# Copyright (c) 2009 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'variables': { + 'chromium_code': 1, + 'nacl_scons_dir': '../../third_party/native_client/googleclient/native_client/scons-out', + }, + 'includes': [ + 'common.gypi', + ], + 'targets': [ + { + 'target_name': 'build_nacl', + 'type': 'none', + 'variables': { + 'nacl_libs': [ + 'google_nacl_imc', + 'google_nacl_imc_c', + ], + 'nacl_lib_dir': '<(nacl_scons_dir)/<(CONFIGURATION)-<(OS)/lib', + 'nacl_output_dir': '<(SHARED_INTERMEDIATE_DIR)/nacl_libs', + }, + 'actions': [ + { + 'action_name': 'build_nacl', + 'inputs' : [ + 'build_nacl.py', + ], + 'outputs': [ + '<(nacl_output_dir)/google_nacl_imc<(LIBRARY_SUFFIX)', + '<(nacl_output_dir)/google_nacl_imc_c<(LIBRARY_SUFFIX)', + 'dummy_file_that_never_gets_built_so_scons_always_runs', + ], + 'action': [ + 'python', + '<@(_inputs)', + '--output="<(nacl_output_dir)"', + '--configuration="<(CONFIGURATION)"', + '--platform=<(OS)', + '<@(nacl_libs)', + ], + }, + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '<(nacldir)', + ], + 'libraries': [ + '-l<(nacl_output_dir)/google_nacl_imc<(LIBRARY_SUFFIX)', + '-l<(nacl_output_dir)/google_nacl_imc_c<(LIBRARY_SUFFIX)', + ], + }, + }, + ], +} |