diff options
Diffstat (limited to 'indra/develop.py')
-rwxr-xr-x | indra/develop.py | 114 |
1 files changed, 77 insertions, 37 deletions
diff --git a/indra/develop.py b/indra/develop.py index 0a2d3c5e52..36c947327a 100755 --- a/indra/develop.py +++ b/indra/develop.py @@ -4,31 +4,25 @@ # @authors Bryan O'Sullivan, Mark Palange, Aaron Brashears # @brief Fire and forget script to appropriately configure cmake for SL. # -# $LicenseInfo:firstyear=2007&license=viewergpl$ -# -# Copyright (c) 2007-2009, Linden Research, Inc. -# +# $LicenseInfo:firstyear=2007&license=viewerlgpl$ # Second Life Viewer Source Code -# The source code in this file ("Source Code") is provided by Linden Lab -# to you under the terms of the GNU General Public License, version 2.0 -# ("GPL"), unless you have obtained a separate licensing agreement -# ("Other License"), formally executed by you and Linden Lab. Terms of -# the GPL can be found in doc/GPL-license.txt in this distribution, or -# online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 +# Copyright (C) 2010, Linden Research, Inc. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License only. # -# There are special exceptions to the terms and conditions of the GPL as -# it is applied to this Source Code. View the full text of the exception -# in the file doc/FLOSS-exception.txt in this software distribution, or -# online at -# http://secondlifegrid.net/programs/open_source/licensing/flossexception +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. # -# By copying, modifying or distributing this software, you acknowledge -# that you have read and understood your obligations described above, -# and agree to abide by those obligations. +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # -# ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO -# WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, -# COMPLETENESS OR PERFORMANCE. +# Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA # $/LicenseInfo$ @@ -82,6 +76,7 @@ class PlatformSetup(object): distcc = True cmake_opts = [] word_size = 32 + using_express = False def __init__(self): self.script_dir = os.path.realpath( @@ -503,9 +498,17 @@ class WindowsSetup(PlatformSetup): self._generator = version print 'Building with ', self.gens[version]['gen'] break - else: - print >> sys.stderr, 'Cannot find a Visual Studio installation!' - sys.exit(1) + else: + print >> sys.stderr, 'Cannot find a Visual Studio installation, testing for express editions' + for version in 'vc80 vc90 vc71'.split(): + if self.find_visual_studio_express(version): + self._generator = version + self.using_express = True + print 'Building with ', self.gens[version]['gen'] , "Express edition" + break + else: + print >> sys.stderr, 'Cannot find any Visual Studio installation' + sys.exit(1) return self._generator def _set_generator(self, gen): @@ -568,6 +571,28 @@ class WindowsSetup(PlatformSetup): return '' + def find_visual_studio_express(self, gen=None): + if gen is None: + gen = self._generator + gen = gen.lower() + try: + import _winreg + key_str = (r'SOFTWARE\Microsoft\VCEXpress\%s\Setup\VC' % + self.gens[gen]['ver']) + value_str = (r'ProductDir') + print ('Reading VS environment from HKEY_LOCAL_MACHINE\%s\%s' % + (key_str, value_str)) + print key_str + + reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) + key = _winreg.OpenKey(reg, key_str) + value = _winreg.QueryValueEx(key, value_str)[0]+"IDE" + print 'Found: %s' % value + return value + except WindowsError, err: + print >> sys.stderr, "Didn't find ", self.gens[gen]['gen'] + return '' + def get_build_cmd(self): if self.incredibuild: config = self.build_type @@ -578,6 +603,17 @@ class WindowsSetup(PlatformSetup): cmd = "%(bin)s %(prj)s.sln /build /cfg=%(cfg)s" % {'prj': self.project_name, 'cfg': config, 'bin': executable} return (executable, cmd) + environment = self.find_visual_studio() + if environment == '': + environment = self.find_visual_studio_express() + if environment == '': + print >> sys.stderr, "Something went very wrong during build stage, could not find a Visual Studio installation." + else: + build_dirs=self.build_dirs(); + print >> sys.stderr, "\nSolution generation complete, it can can now be found in:", build_dirs[0] + print >> sys.stderr, "\nPlease see https://wiki.secondlife.com/wiki/Microsoft_Visual_Studio#Extra_steps_for_Visual_Studio_Express_editions for express specific information" + exit(0) + # devenv.com is CLI friendly, devenv.exe... not so much. executable = '%sdevenv.com' % (self.find_visual_studio(),) cmd = ('"%s" %s.sln /build %s' % @@ -609,7 +645,8 @@ class WindowsSetup(PlatformSetup): '''Override to add the vstool.exe call after running cmake.''' PlatformSetup.run_cmake(self, args) if self.unattended == 'OFF': - self.run_vstool() + if self.using_express == False: + self.run_vstool() def run_vstool(self): for build_dir in self.build_dirs(): @@ -705,9 +742,10 @@ Options: -p | --project=NAME set the root project name. (Doesn't effect makefiles) Commands: - build configure and build default target - clean delete all build directories, does not affect sources - configure configure project by running cmake (default command if none given) + build configure and build default target + clean delete all build directories, does not affect sources + configure configure project by running cmake (default if none given) + printbuilddirs print the build directory that will be used Command-options for "configure": We use cmake variables to change the build configuration. @@ -725,15 +763,6 @@ Examples: ''' def main(arguments): - if os.getenv('DISTCC_DIR') is None: - distcc_dir = os.path.join(getcwd(), '.distcc') - if not os.path.exists(distcc_dir): - os.mkdir(distcc_dir) - print "setting DISTCC_DIR to %s" % distcc_dir - os.environ['DISTCC_DIR'] = distcc_dir - else: - print "DISTCC_DIR is set to %s" % os.getenv('DISTCC_DIR') - setup = setup_platform[sys.platform]() try: opts, args = getopt.getopt( @@ -795,6 +824,14 @@ For example: develop.py configure -DSERVER:BOOL=OFF""" if cmd in ('cmake', 'configure'): setup.run_cmake(args) elif cmd == 'build': + if os.getenv('DISTCC_DIR') is None: + distcc_dir = os.path.join(getcwd(), '.distcc') + if not os.path.exists(distcc_dir): + os.mkdir(distcc_dir) + print "setting DISTCC_DIR to %s" % distcc_dir + os.environ['DISTCC_DIR'] = distcc_dir + else: + print "DISTCC_DIR is set to %s" % os.getenv('DISTCC_DIR') for d in setup.build_dirs(): if not os.path.exists(d): raise CommandError('run "develop.py cmake" first') @@ -805,6 +842,9 @@ For example: develop.py configure -DSERVER:BOOL=OFF""" if args: raise CommandError('clean takes no arguments') setup.cleanup() + elif cmd == 'printbuilddirs': + for d in setup.build_dirs(): + print >> sys.stdout, d else: print >> sys.stderr, 'Error: unknown subcommand', repr(cmd) print >> sys.stderr, "(run 'develop.py --help' for help)" |