~raskolnikov/mixxx/round-bpm

« back to all changes in this revision

Viewing changes to mixxx/build/features.py

  • Committer: Juan Pedro BolĂ­var Puente
  • Date: 2012-01-07 15:16:52 UTC
  • mfrom: (2592.1.391 mixxx-trunk)
  • Revision ID: raskolnikov@gnu.org-20120107151652-rpbwukn0xpikdn7e
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
1
2
 
2
3
import os
3
4
import util
36
37
#            if not conf.CheckHeader('HSS1394/HSS1394.h'):  # WTF this gives tons of cmath errors on MSVC
37
38
#                raise Exception('Did not find HSS1394 development headers, exiting!')
38
39
#            elif not conf.CheckLib(['libHSS1394', 'HSS1394']):
39
 
            if not conf.CheckLib(['libHSS1394', 'HSS1394']):
 
40
            if not conf.CheckLib(['libhss1394', 'hss1394']):
40
41
                raise Exception('Did not find HSS1394 development library, exiting!')
41
42
                return
42
43
 
733
734
 
734
735
        if build.toolchain_is_msvs:
735
736
            if int(build.flags['msvcdebug']):
736
 
                self.status = "Disabled (due to mscvdebug mode)"
 
737
                self.status = "Disabled (due to msvcdebug mode)"
737
738
                return
738
739
            # Valid values of /MACHINE are:
739
740
            # {AM33|ARM|EBC|IA64|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16|MIPSR41XX|SH3|SH3DSP|SH4|SH5|THUMB|X86}
781
782
            #    build.env.Append(CCFLAGS = '/Ox')
782
783
 
783
784
            # SSE and SSE2 are core instructions on x64
784
 
            if not build.machine_is_64bit:
 
785
            if build.machine_is_64bit:
 
786
                build.env.Append(CPPDEFINES = ['__SSE__','__SSE2__'])
 
787
            else:
785
788
                if optimize_level == 3:
786
789
                    self.status += ", SSE Instructions Enabled"
787
790
                    build.env.Append(CCFLAGS = '/arch:SSE')
 
791
                    build.env.Append(CPPDEFINES = '__SSE__')
788
792
                elif optimize_level == 4:
789
793
                    self.status += ", SSE2 Instructions Enabled"
790
794
                    build.env.Append(CCFLAGS = '/arch:SSE2')
 
795
                    build.env.Append(CPPDEFINES = ['__SSE__','__SSE2__'])
791
796
        elif build.toolchain_is_gnu:
792
797
            if int(build.flags.get('tuned',0)):
793
798
                self.status = "Disabled (Overriden by tuned=1)"
805
810
            elif optimize_level == 2:
806
811
                self.status = "Enabled (P4 MMX/SSE)"
807
812
                build.env.Append(CCFLAGS = '-march=pentium4 -mmmx -msse2 -mfpmath=sse')
 
813
                build.env.Append(CPPDEFINES = ['__SSE__','__SSE2__'])
808
814
            elif optimize_level == 3:
809
815
                self.status = "Enabled (Intel Core Solo/Duo)"
810
816
                build.env.Append(CCFLAGS = '-march=prescott -mmmx -msse3 -mfpmath=sse')
 
817
                build.env.Append(CPPDEFINES = ['__SSE__','__SSE2__','__SSE3__'])
811
818
            elif optimize_level == 4:
812
819
                self.status = "Enabled (Intel Core 2)"
813
820
                build.env.Append(CCFLAGS = '-march=nocona -mmmx -msse -msse2 -msse3 -mfpmath=sse -ffast-math -funroll-loops')
 
821
                build.env.Append(CPPDEFINES = ['__SSE__','__SSE2__','__SSE3__'])
814
822
            elif optimize_level == 5:
815
823
                self.status = "Enabled (Athlon Athlon-4/XP/MP)"
816
824
                build.env.Append(CCFLAGS = '-march=athlon-4 -mmmx -msse -m3dnow -mfpmath=sse')
 
825
                build.env.Append(CPPDEFINES = '__SSE__')
817
826
            elif optimize_level == 6:
818
827
                self.status = "Enabled (Athlon K8/Opteron/AMD64)"
819
828
                build.env.Append(CCFLAGS = '-march=k8 -mmmx -msse2 -m3dnow -mfpmath=sse')
 
829
                build.env.Append(CPPDEFINES = ['__SSE__','__SSE2__'])
820
830
            elif optimize_level == 7:
821
831
                self.status = "Enabled (Athlon K8/Opteron/AMD64 + SSE3)"
822
832
                build.env.Append(CCFLAGS = '-march=k8-sse3 -mmmx -msse2 -msse3 -m3dnow -mfpmath=sse')
 
833
                build.env.Append(CPPDEFINES = ['__SSE__','__SSE2__','__SSE3__'])
823
834
            elif optimize_level == 8:
824
835
                self.status = "Enabled (Generic SSE/SSE2/SSE3)"
825
836
                build.env.Append(CCFLAGS = '-mmmx -msse2 -msse3 -mfpmath=sse')
 
837
                build.env.Append(CPPDEFINES = ['__SSE__','__SSE2__','__SSE3__'])
826
838
            elif optimize_level == 9:
827
839
                self.status = "Enabled (Tuned Generic)"
828
840
                # This option is for release builds packaged for 64-bit. We
839
851
 
840
852
                # TODO(XXX) check the soundtouch package in Ubuntu to see what they do about this.
841
853
                build.env.Append(CCFLAGS = '-mtune=generic -mmmx -msse -mfpmath=sse')
 
854
                build.env.Append(CPPDEFINES = '__SSE__')
842
855
 
843
856
                # Enable SSE2 on 64-bit machines. SSE3 is not a sure thing on 64-bit
844
857
                if build.machine_is_64bit:
845
858
                    build.env.Append(CCFLAGS = '-msse2')
 
859
                    build.env.Append(CPPDEFINES = '__SSE2__')
846
860
 
847
861
 
848
862
class Tuned(Feature):
869
883
                build.env.Append(CCFLAGS = '/favor:blend')
870
884
            return
871
885
 
 
886
        # SSE and SSE2 are core instructions on x64
 
887
        if build.machine_is_64bit:
 
888
            build.env.Append(CPPDEFINES = ['__SSE__','__SSE2__'])
 
889
 
872
890
        if build.toolchain_is_gnu:
873
891
            ccv = build.env['CCVERSION'].split('.')
874
892
            if int(ccv[0]) >= 4 and int(ccv[1]) >= 2:
875
 
                # Should we use -mtune as well?
 
893
                # -march=native takes care of mtune
 
894
                #   http://en.chys.info/2010/04/what-exactly-marchnative-means/
876
895
                build.env.Append(CCFLAGS = '-march=native')
877
896
                # Doesn't make sense as a linkflag
878
897
                build.env.Append(LINKFLAGS = '-march=native')
 
898
                # TODO(pegasus): Ask GCC if the CPU supports SSE, SSE2, SSE3, etc.
 
899
                #   so we can add the appropriate CPPDEFINES for Mixxx code paths
879
900
            else:
880
901
                self.status = "Disabled (requires gcc >= 4.2.0)"
881
902
        elif build.toolchain_is_msvs: