diff options
Diffstat (limited to 'linden/indra/develop.py')
-rwxr-xr-x | linden/indra/develop.py | 209 |
1 files changed, 102 insertions, 107 deletions
diff --git a/linden/indra/develop.py b/linden/indra/develop.py index ffe8e61..100f719 100755 --- a/linden/indra/develop.py +++ b/linden/indra/develop.py | |||
@@ -416,7 +416,7 @@ class LinuxSetup(UnixSetup): | |||
416 | print 'Running %r' % cmd | 416 | print 'Running %r' % cmd |
417 | self.run(cmd) | 417 | self.run(cmd) |
418 | 418 | ||
419 | 419 | ||
420 | class DarwinSetup(UnixSetup): | 420 | class DarwinSetup(UnixSetup): |
421 | def __init__(self): | 421 | def __init__(self): |
422 | super(DarwinSetup, self).__init__() | 422 | super(DarwinSetup, self).__init__() |
@@ -443,7 +443,12 @@ class DarwinSetup(UnixSetup): | |||
443 | type=self.build_type | 443 | type=self.build_type |
444 | ) | 444 | ) |
445 | if self.universal == 'ON': | 445 | if self.universal == 'ON': |
446 | args['universal'] = '-DCMAKE_OSX_ARCHITECTURES:STRING=\'i386;ppc\'' | ||
447 | elif self.arch == 'ppc': | ||
448 | args['universal'] = '-DCMAKE_OSX_ARCHITECTURES:STRING=\'ppc\'' | ||
449 | else: | ||
446 | args['universal'] = '-DCMAKE_OSX_ARCHITECTURES:STRING=\'i386\'' | 450 | args['universal'] = '-DCMAKE_OSX_ARCHITECTURES:STRING=\'i386\'' |
451 | |||
447 | #if simple: | 452 | #if simple: |
448 | # return 'cmake %(opts)s %(dir)r' % args | 453 | # return 'cmake %(opts)s %(dir)r' % args |
449 | return ('cmake -G %(generator)r ' | 454 | return ('cmake -G %(generator)r ' |
@@ -488,6 +493,10 @@ class WindowsSetup(PlatformSetup): | |||
488 | 'vc100' : { | 493 | 'vc100' : { |
489 | 'gen' : r'Visual Studio 10', | 494 | 'gen' : r'Visual Studio 10', |
490 | 'ver' : r'10.0' | 495 | 'ver' : r'10.0' |
496 | }, | ||
497 | 'nmake' : { | ||
498 | 'gen' : r'NMake Makefiles', | ||
499 | 'ver' : r'' | ||
491 | } | 500 | } |
492 | } | 501 | } |
493 | gens['vs2003'] = gens['vc71'] | 502 | gens['vs2003'] = gens['vc71'] |
@@ -503,6 +512,41 @@ class WindowsSetup(PlatformSetup): | |||
503 | self._generator = None | 512 | self._generator = None |
504 | self.incredibuild = False | 513 | self.incredibuild = False |
505 | 514 | ||
515 | def find_visual_studio(self, gen=None): | ||
516 | if gen is None: | ||
517 | gen = self._generator | ||
518 | gen = gen.lower() | ||
519 | try: | ||
520 | import _winreg | ||
521 | key_str = (r'SOFTWARE\Microsoft\VisualStudio\%s\Setup\VS' % | ||
522 | self.gens[gen]['ver']) | ||
523 | value_str = (r'EnvironmentDirectory') | ||
524 | reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) | ||
525 | key = _winreg.OpenKey(reg, key_str) | ||
526 | value = _winreg.QueryValueEx(key, value_str)[0] | ||
527 | print 'Found: %s' % value | ||
528 | return value | ||
529 | except WindowsError, err: | ||
530 | return '' | ||
531 | |||
532 | def find_visual_studio_express(self, gen=None): | ||
533 | if gen is None: | ||
534 | gen = self._generator | ||
535 | gen = gen.lower() | ||
536 | try: | ||
537 | import _winreg | ||
538 | key_str = (r'SOFTWARE\Microsoft\VCExpress\%s\Setup\VC' % | ||
539 | self.gens[gen]['ver']) | ||
540 | value_str = (r'ProductDir') | ||
541 | reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) | ||
542 | key = _winreg.OpenKey(reg, key_str) | ||
543 | value = _winreg.QueryValueEx(key, value_str)[0]+"vcpackages" | ||
544 | print 'Found: %s' % value | ||
545 | self.using_express = True | ||
546 | return value | ||
547 | except WindowsError, err: | ||
548 | return '' | ||
549 | |||
506 | def _get_generator(self): | 550 | def _get_generator(self): |
507 | if self._generator is None: | 551 | if self._generator is None: |
508 | for version in 'vc80 vc90 vc100 vc71'.split(): | 552 | for version in 'vc80 vc90 vc100 vc71'.split(): |
@@ -511,9 +555,8 @@ class WindowsSetup(PlatformSetup): | |||
511 | print 'Building with ', self.gens[version]['gen'] | 555 | print 'Building with ', self.gens[version]['gen'] |
512 | break | 556 | break |
513 | else: | 557 | else: |
514 | print >> sys.stderr, 'Cannot find a Visual Studio installation, testing for express editions' | ||
515 | for version in 'vc80 vc90 vc100 vc71'.split(): | 558 | for version in 'vc80 vc90 vc100 vc71'.split(): |
516 | if self.find_visual_studio_express(version): | 559 | if self.find_visual_studio_express(version) != '': |
517 | self._generator = version | 560 | self._generator = version |
518 | self.using_express = True | 561 | self.using_express = True |
519 | print 'Building with ', self.gens[version]['gen'] , "Express edition" | 562 | print 'Building with ', self.gens[version]['gen'] , "Express edition" |
@@ -524,6 +567,8 @@ class WindowsSetup(PlatformSetup): | |||
524 | return self._generator | 567 | return self._generator |
525 | 568 | ||
526 | def _set_generator(self, gen): | 569 | def _set_generator(self, gen): |
570 | if gen == 'nmake': | ||
571 | self._get_generator() | ||
527 | self._generator = gen | 572 | self._generator = gen |
528 | 573 | ||
529 | generator = property(_get_generator, _set_generator) | 574 | generator = property(_get_generator, _set_generator) |
@@ -541,83 +586,58 @@ class WindowsSetup(PlatformSetup): | |||
541 | opts=quote(opts), | 586 | opts=quote(opts), |
542 | standalone=self.standalone, | 587 | standalone=self.standalone, |
543 | unattended=self.unattended, | 588 | unattended=self.unattended, |
544 | project_name=self.project_name | 589 | project_name=self.project_name, |
590 | type=self.build_type, | ||
591 | use_vstool='ON', | ||
592 | nmake='' | ||
545 | ) | 593 | ) |
594 | if self.generator == 'nmake': | ||
595 | args['use_vstool'] = 'OFF' | ||
596 | args['nmake'] = '-DNMAKE:BOOL=ON' | ||
597 | if self.using_express: | ||
598 | args['using_express'] = 'ON' | ||
599 | args['use_vstool'] = 'OFF' | ||
600 | else: | ||
601 | args['using_express'] = 'OFF' | ||
546 | # default to packaging disabled | 602 | # default to packaging disabled |
547 | # if simple: | 603 | # if simple: |
548 | # return 'cmake %(opts)s "%(dir)s"' % args | 604 | # return 'cmake %(opts)s "%(dir)s"' % args |
549 | return ('cmake -G "%(generator)s" ' | 605 | return ('cmake -G "%(generator)s" ' |
606 | '-DCMAKE_BUILD_TYPE:STRING=%(type)s ' | ||
550 | '-DSTANDALONE:BOOL=%(standalone)s ' | 607 | '-DSTANDALONE:BOOL=%(standalone)s ' |
551 | '-DUNATTENDED:BOOL=%(unattended)s ' | 608 | '-DUNATTENDED:BOOL=%(unattended)s ' |
552 | '-DROOT_PROJECT_NAME:STRING=%(project_name)s ' | 609 | '-DROOT_PROJECT_NAME:STRING=%(project_name)s ' |
553 | #'-DPACKAGE:BOOL=ON ' | 610 | '-DUSING_EXPRESS:BOOL=%(using_express)s ' |
611 | '-DUSE_VSTOOL:BOOL=%(use_vstool)s ' | ||
612 | '%(nmake)s ' | ||
554 | '%(opts)s "%(dir)s"' % args) | 613 | '%(opts)s "%(dir)s"' % args) |
555 | 614 | ||
556 | def find_visual_studio(self, gen=None): | ||
557 | if gen is None: | ||
558 | gen = self._generator | ||
559 | gen = gen.lower() | ||
560 | try: | ||
561 | import _winreg | ||
562 | key_str = (r'SOFTWARE\Microsoft\VisualStudio\%s\Setup\VS' % | ||
563 | self.gens[gen]['ver']) | ||
564 | value_str = (r'EnvironmentDirectory') | ||
565 | print ('Reading VS environment from HKEY_LOCAL_MACHINE\%s\%s' % | ||
566 | (key_str, value_str)) | ||
567 | print key_str | ||
568 | |||
569 | reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) | ||
570 | key = _winreg.OpenKey(reg, key_str) | ||
571 | value = _winreg.QueryValueEx(key, value_str)[0] | ||
572 | print 'Found: %s' % value | ||
573 | return value | ||
574 | except WindowsError, err: | ||
575 | print >> sys.stderr, "Didn't find ", self.gens[gen]['gen'] | ||
576 | return '' | ||
577 | |||
578 | def find_visual_studio_express(self, gen=None): | ||
579 | if gen is None: | ||
580 | gen = self._generator | ||
581 | gen = gen.lower() | ||
582 | try: | ||
583 | import _winreg | ||
584 | key_str = (r'SOFTWARE\Microsoft\VCExpress\%s\Setup\VC' % | ||
585 | self.gens[gen]['ver']) | ||
586 | value_str = (r'ProductDir') | ||
587 | print ('Reading VS environment from HKEY_LOCAL_MACHINE\%s\%s' % | ||
588 | (key_str, value_str)) | ||
589 | print key_str | ||
590 | |||
591 | reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) | ||
592 | key = _winreg.OpenKey(reg, key_str) | ||
593 | value = _winreg.QueryValueEx(key, value_str)[0]+"IDE" | ||
594 | print 'Found: %s' % value | ||
595 | self.using_express = True | ||
596 | return value | ||
597 | except WindowsError, err: | ||
598 | print >> sys.stderr, "Didn't find ", self.gens[gen]['gen'] | ||
599 | return '' | ||
600 | |||
601 | def get_build_cmd(self): | 615 | def get_build_cmd(self): |
602 | if self.incredibuild: | 616 | if self.incredibuild: |
603 | config = self.build_type | 617 | config = self.build_type |
604 | if self.gens[self.generator]['ver'] in [ r'8.0', r'9.0', r'10.0', r'7.1' ]: | 618 | if self.gens[self.generator]['ver'] in [ r'8.0', r'9.0', r'10.0', r'7.1' ]: |
605 | config = '\"%s|Win32\"' % config | 619 | config = '\"%s|Win32\"' % config |
606 | |||
607 | return "buildconsole %s.sln /build %s" % (self.project_name, config) | 620 | return "buildconsole %s.sln /build %s" % (self.project_name, config) |
608 | 621 | ||
609 | environment = self.find_visual_studio() | 622 | environment = self.find_visual_studio(self.generator) |
610 | if environment == '': | 623 | if environment == '': |
611 | environment = self.find_visual_studio_express() | 624 | environment = self.find_visual_studio_express(self.generator) |
612 | if environment == '': | 625 | if self.generator != 'nmake': |
613 | print >> sys.stderr, "Something went very wrong during build stage, could not find a Visual Studio?" | 626 | if environment == '': |
614 | else: | 627 | print >> sys.stderr, "Something went very wrong during build stage, could not find a Visual Studio?" |
615 | print >> sys.stderr, "\nSolution generation complete, as you are using an express edition the final\n stages will need to be completed by hand" | 628 | else: |
616 | build_dirs=self.build_dirs(); | 629 | build_dirs=self.build_dirs(); |
617 | print >> sys.stderr, "Solution can now be found in:", build_dirs[0] | 630 | return("\"\"%s\\vcbuild\" /useenv %s.sln \"%s|win32\"\"" % (environment, self.project_name, self.build_type)) |
618 | print >> sys.stderr, "Set %s as startup project" % self.project_name | 631 | |
619 | print >> sys.stderr, "Set build target is Release or RelWithDbgInfo" | 632 | if self.generator == 'nmake': |
620 | exit(0) | 633 | # Hack around a bug in cmake that I'm surprised did not hit GUI controlled builds. |
634 | self.run(r'sed -i "s|\(^RC_FLAGS .* \) /GS .*$|\1|" build-nmake/win_crash_logger/CMakeFiles/windows-crash-logger.dir/flags.make') | ||
635 | self.run(r'sed -i "s|\(^RC_FLAGS .* \) /GS .*$|\1|" build-nmake/newview/CMakeFiles/meta-impy-bin.dir/flags.make') | ||
636 | self.run(r'sed -i "s|\(^RC_FLAGS .* \) /EHsc .*/Zm1000 \($\)|\1\2|" build-nmake/win_crash_logger/CMakeFiles/windows-crash-logger.dir/flags.make') | ||
637 | self.run(r'sed -i "s|\(^RC_FLAGS .* \) /EHsc .*/Zm1000 \($\)|\1\2|" build-nmake/newview/CMakeFiles/meta-impy-bin.dir/flags.make') | ||
638 | # Evil hack. | ||
639 | self.run(r'touch newview/touched.bat') | ||
640 | return 'nmake' | ||
621 | 641 | ||
622 | # devenv.com is CLI friendly, devenv.exe... not so much. | 642 | # devenv.com is CLI friendly, devenv.exe... not so much. |
623 | return ('"%sdevenv.com" %s.sln /build %s' % | 643 | return ('"%sdevenv.com" %s.sln /build %s' % |
@@ -637,55 +657,29 @@ class WindowsSetup(PlatformSetup): | |||
637 | raise CommandError('the command %r %s' % | 657 | raise CommandError('the command %r %s' % |
638 | (name, ret)) | 658 | (name, ret)) |
639 | 659 | ||
640 | def run_cmake(self, args=[]): | ||
641 | '''Override to add the vstool.exe call after running cmake.''' | ||
642 | PlatformSetup.run_cmake(self, args) | ||
643 | if self.unattended == 'OFF': | ||
644 | if self.using_express == False: | ||
645 | self.run_vstool() | ||
646 | |||
647 | def run_vstool(self): | ||
648 | for build_dir in self.build_dirs(): | ||
649 | stamp = os.path.join(build_dir, 'vstool.txt') | ||
650 | try: | ||
651 | prev_build = open(stamp).read().strip() | ||
652 | except IOError: | ||
653 | prev_build = '' | ||
654 | if prev_build == self.build_type: | ||
655 | # Only run vstool if the build type has changed. | ||
656 | continue | ||
657 | vstool_cmd = (os.path.join('tools','vstool','VSTool.exe') + | ||
658 | ' --solution ' + | ||
659 | os.path.join(build_dir,'meta-impy.sln') + | ||
660 | ' --config ' + self.build_type + | ||
661 | ' --startup meta-impy-bin') | ||
662 | print 'Running %r in %r' % (vstool_cmd, getcwd()) | ||
663 | self.run(vstool_cmd) | ||
664 | print >> open(stamp, 'w'), self.build_type | ||
665 | |||
666 | def run_build(self, opts, targets): | 660 | def run_build(self, opts, targets): |
667 | cwd = getcwd() | 661 | cwd = getcwd() |
668 | build_cmd = self.get_build_cmd() | 662 | build_cmd = self.get_build_cmd() |
669 | 663 | if build_cmd != "": | |
670 | for d in self.build_dirs(): | 664 | for d in self.build_dirs(): |
671 | try: | 665 | try: |
672 | os.chdir(d) | 666 | os.chdir(d) |
673 | if targets: | 667 | if targets: |
674 | for t in targets: | 668 | for t in targets: |
675 | cmd = '%s /project %s %s' % (build_cmd, t, ' '.join(opts)) | 669 | cmd = '%s /project %s %s' % (build_cmd, t, ' '.join(opts)) |
670 | print 'Running %r in %r' % (cmd, d) | ||
671 | self.run(cmd) | ||
672 | else: | ||
673 | cmd = '%s %s' % (build_cmd, ' '.join(opts)) | ||
676 | print 'Running %r in %r' % (cmd, d) | 674 | print 'Running %r in %r' % (cmd, d) |
677 | self.run(cmd) | 675 | self.run(cmd) |
678 | else: | 676 | finally: |
679 | cmd = '%s %s' % (build_cmd, ' '.join(opts)) | 677 | os.chdir(cwd) |
680 | print 'Running %r in %r' % (cmd, d) | 678 | |
681 | self.run(cmd) | ||
682 | finally: | ||
683 | os.chdir(cwd) | ||
684 | |||
685 | class CygwinSetup(WindowsSetup): | 679 | class CygwinSetup(WindowsSetup): |
686 | def __init__(self): | 680 | def __init__(self): |
687 | super(CygwinSetup, self).__init__() | 681 | super(CygwinSetup, self).__init__() |
688 | self.generator = 'vc80' | 682 | self.generator = 'nmake' |
689 | 683 | ||
690 | def cmake_commandline(self, src_dir, build_dir, opts, simple): | 684 | def cmake_commandline(self, src_dir, build_dir, opts, simple): |
691 | dos_dir = commands.getoutput("cygpath -w %s" % src_dir) | 685 | dos_dir = commands.getoutput("cygpath -w %s" % src_dir) |
@@ -695,11 +689,13 @@ class CygwinSetup(WindowsSetup): | |||
695 | opts=quote(opts), | 689 | opts=quote(opts), |
696 | standalone=self.standalone, | 690 | standalone=self.standalone, |
697 | unattended=self.unattended, | 691 | unattended=self.unattended, |
698 | project_name=self.project_name | 692 | project_name=self.project_name, |
693 | type=self.build_type | ||
699 | ) | 694 | ) |
700 | #if simple: | 695 | #if simple: |
701 | # return 'cmake %(opts)s "%(dir)s"' % args | 696 | # return 'cmake %(opts)s "%(dir)s"' % args |
702 | return ('cmake -G "%(generator)s" ' | 697 | return ('cmake -G "%(generator)s" ' |
698 | '-DCMAKE_BUILD_TYPE:STRING=%(type)s ' | ||
703 | '-DUNATTENDED:BOOl=%(unattended)s ' | 699 | '-DUNATTENDED:BOOl=%(unattended)s ' |
704 | '-DSTANDALONE:BOOL=%(standalone)s ' | 700 | '-DSTANDALONE:BOOL=%(standalone)s ' |
705 | '-DROOT_PROJECT_NAME:STRING=%(project_name)s ' | 701 | '-DROOT_PROJECT_NAME:STRING=%(project_name)s ' |
@@ -726,7 +722,7 @@ Options: | |||
726 | -m32 | -m64 build architecture (32-bit or 64-bit) | 722 | -m32 | -m64 build architecture (32-bit or 64-bit) |
727 | -N | --no-distcc disable use of distcc | 723 | -N | --no-distcc disable use of distcc |
728 | -G | --generator=NAME generator name | 724 | -G | --generator=NAME generator name |
729 | Windows: VC80 (VS2005--default), VC71 (VS2003), | 725 | Windows: NMake, VC80 (VS2005--default), VC71 (VS2003), |
730 | VC90 (VS2008), or VC100 (VS2010) | 726 | VC90 (VS2008), or VC100 (VS2010) |
731 | Mac OS X: Xcode (default), Unix Makefiles | 727 | Mac OS X: Xcode (default), Unix Makefiles |
732 | Linux: Unix Makefiles (default), KDevelop3 | 728 | Linux: Unix Makefiles (default), KDevelop3 |
@@ -818,7 +814,6 @@ For example: develop.py configure -DSERVER:BOOL=OFF""" | |||
818 | for d in setup.build_dirs(): | 814 | for d in setup.build_dirs(): |
819 | if not os.path.exists(d): | 815 | if not os.path.exists(d): |
820 | raise CommandError('run "develop.py cmake" first') | 816 | raise CommandError('run "develop.py cmake" first') |
821 | setup.run_cmake() | ||
822 | opts, targets = setup.parse_build_opts(args) | 817 | opts, targets = setup.parse_build_opts(args) |
823 | setup.run_build(opts, targets) | 818 | setup.run_build(opts, targets) |
824 | elif cmd == 'clean': | 819 | elif cmd == 'clean': |