summaryrefslogtreecommitdiffstats
path: root/o3d/build
diff options
context:
space:
mode:
Diffstat (limited to 'o3d/build')
-rw-r--r--o3d/build/build_nacl.py174
-rw-r--r--o3d/build/common.gypi13
-rw-r--r--o3d/build/o3d.gyp15
-rw-r--r--o3d/build/o3d_all.gyp (renamed from o3d/build/all.gyp)10
-rw-r--r--o3d/build/o3d_minimal.gyp36
-rw-r--r--o3d/build/select_dependencies.py34
6 files changed, 97 insertions, 185 deletions
diff --git a/o3d/build/build_nacl.py b/o3d/build/build_nacl.py
deleted file mode 100644
index af4c5cf..0000000
--- a/o3d/build/build_nacl.py
+++ /dev/null
@@ -1,174 +0,0 @@
-#!/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:
- try:
- winsdk_key = _winreg.OpenKey(
- _winreg.HKEY_LOCAL_MACHINE,
- 'SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.0A\\VistaClientHeadersLibs')
- 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
index 64613e7..31697fd 100644
--- a/o3d/build/common.gypi
+++ b/o3d/build/common.gypi
@@ -12,15 +12,21 @@
'gtestdir': 'testing/gtest/include',
'jpegdir': 'third_party/libjpeg',
'nacldir': 'third_party/native_client/googleclient',
- 'nixysadir': 'third_party/nixysa',
- 'npapidir': 'third_party/npapi',
+ 'nixysadir': 'o3d/third_party/nixysa',
+ 'npapidir': 'o3d/third_party/npapi',
'pdiffdir': 'third_party/pdiff/files',
'pngdir': 'third_party/libpng',
'screenshotsdir': 'o3d_assets/tests/screenshots',
'seleniumdir': 'third_party/selenium_rc/files',
'skiadir': 'third_party/skia/include',
'zlibdir': 'third_party/zlib',
- 'o3d_in_chrome%': 0,
+ # If the DEPS file exists two levels up, then we're in a Chrome tree.
+ 'o3d_in_chrome%': '<!(python <(DEPTH)/o3d/build/file_exists.py ../../DEPS)',
+ # We default to building everything only if the assets exist.
+ # (and the teapot is the least likely asset to change).
+ # This is so that chrome developers get a much reduced dependency set.
+ 'o3d_developer%': '<!(python <(DEPTH)/o3d/build/file_exists.py '
+ '../o3d_assets/samples/convert_assets/teapot.zip)',
'selenium_screenshots%': 0,
},
'target_defaults': {
@@ -66,6 +72,7 @@
'OS_WIN',
'UNICODE',
'NACL_WINDOWS',
+ '_X86_',
],
# Disable warning: "'this' : used in base member initialization list."
'msvs_disabled_warnings': [4355],
diff --git a/o3d/build/o3d.gyp b/o3d/build/o3d.gyp
new file mode 100644
index 0000000..14832d1
--- /dev/null
+++ b/o3d/build/o3d.gyp
@@ -0,0 +1,15 @@
+# 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.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'O3D',
+ 'type': 'none',
+ 'dependencies': [
+ '<!(python select_dependencies.py):*',
+ ],
+ },
+ ],
+}
diff --git a/o3d/build/all.gyp b/o3d/build/o3d_all.gyp
index 00e02ae..9901e71 100644
--- a/o3d/build/all.gyp
+++ b/o3d/build/o3d_all.gyp
@@ -8,7 +8,7 @@
],
'targets': [
{
- 'target_name': 'All',
+ 'target_name': 'O3D_All',
'type': 'none',
'dependencies': [
'../../<(antlrdir)/antlr.gyp:*',
@@ -25,10 +25,10 @@
'../import/import.gyp:o3dImport',
'../installer/installer.gyp:installer',
'../plugin/idl/idl.gyp:o3dPluginIdl',
+ '../plugin/idl/idl.gyp:o3dNpnApi',
'../plugin/plugin.gyp:npo3dautoplugin',
'../samples/samples.gyp:*',
'../tests/selenium/selenium.gyp:*',
- '../serializer/serializer.gyp:o3dSerializer',
'../tests/tests.gyp:unit_tests',
'../utils/utils.gyp:o3dUtils',
],
@@ -51,9 +51,3 @@
},
],
}
-
-# Local Variables:
-# tab-width:2
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/o3d/build/o3d_minimal.gyp b/o3d/build/o3d_minimal.gyp
new file mode 100644
index 0000000..399638b
--- /dev/null
+++ b/o3d/build/o3d_minimal.gyp
@@ -0,0 +1,36 @@
+# 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': [
+ 'common.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'O3D_Minimal',
+ 'type': 'none',
+ 'dependencies': [
+ '../plugin/plugin.gyp:o3dPlugin_gen',
+ ],
+ },
+ ],
+}
+# 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': [
+ 'common.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'O3D_Minimal',
+ 'type': 'none',
+ 'dependencies': [
+ '../plugin/plugin.gyp:o3dPlugin_gen',
+ ],
+ },
+ ],
+}
diff --git a/o3d/build/select_dependencies.py b/o3d/build/select_dependencies.py
new file mode 100644
index 0000000..a69afe2
--- /dev/null
+++ b/o3d/build/select_dependencies.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# 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.
+
+"""This file selects which of the sets of dependencies are used
+ when Chrome includes o3d.gyp"""
+
+import os.path
+import sys
+
+has_assets = os.path.exists(os.path.join("..", "o3d_assets"))
+if has_assets:
+ print "o3d_all.gyp"
+else:
+ print "o3d_minimal.gyp"
+sys.exit(0)
+#!/usr/bin/env python
+# 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.
+
+"""This file selects which of the sets of dependencies are used
+ when Chrome includes o3d.gyp"""
+
+import os.path
+import sys
+
+has_assets = os.path.exists(os.path.join("..", "o3d_assets"))
+if has_assets:
+ print "o3d_all.gyp"
+else:
+ print "o3d_minimal.gyp"
+sys.exit(0)