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