Ticket #234: msvc.jam.patch
File msvc.jam.patch, 3.0 KB (added by , 10 years ago) |
---|
-
msvc.jam
32 32 import pch ; 33 33 import property ; 34 34 import rc ; 35 import set ; 35 36 import toolset ; 36 37 import type ; 37 38 … … 677 678 } 678 679 679 680 681 # Helper rule to get the environment side-effects of a batch file. 682 # We used to call MSVC setup scripts directly in every action, however in 683 # newer MSVC versions (10.0+) they make long-lasting registry queries 684 # which have a significant impact on build time. 685 # Note that this requires 'cmd.exe' based SHELL, it will not work with 686 # Cygwin built b2. 687 local rule batch-file-environment ( batch-file ) 688 { 689 local original-vars = [ SPLIT_BY_CHARACTERS [ SHELL set ] : "\n" ] ; 690 local new-vars = [ SPLIT_BY_CHARACTERS [ SHELL "$(batch-file)>nul && set" ] : "\n" ] ; 691 local diff-vars = [ set.difference $(new-vars) : $(original-vars) ] ; 692 diff-vars = "SET "$(diff-vars) ; 693 return $(diff-vars:J="\n")\n ; 694 } 695 696 680 697 # Worker rule for toolset version configuration. Takes an explicit version id or 681 698 # nothing in case it should configure the default toolset version (the first 682 699 # registered one or a new 'default' one in case no toolset versions have been … … 887 904 default-global-setup-options-ia64 = ia64 ; 888 905 } 889 906 890 local setup-prefix = "call " ;891 local setup-suffix = " >nul"$(.nl) ;892 if ! [ os.name ] in NT893 {894 setup-prefix = "cmd.exe /S /C call " ;895 setup-suffix = " \">nul\" \"&&\" " ;896 }897 898 907 for local c in $(cpu) 899 908 { 900 909 local setup-options ; … … 927 936 # Append setup options to the setup name and add the final setup 928 937 # prefix & suffix. 929 938 setup-options ?= "" ; 930 setup-$(c) = $(setup-prefix)$(setup-$(c):J=" ")" "$(setup-options:J=" ")$(setup-suffix) ; 939 940 setup-$(c) = $(setup-$(c):J=" ") $(setup-options:J=" ") ; 931 941 } 932 942 } 933 943 … … 981 991 local cpu-assembler = $(assembler) ; 982 992 cpu-assembler ?= $(default-assembler-$(c)) ; 983 993 994 if $(setup-$(c)) 995 { 996 if ! [ os.name ] in NT 997 { 998 local prefix = "cmd.exe /S /C call " ; 999 local suffix = " \">nul\" \"&&\" " ; 1000 setup-$(c) = $(prefix)$(setup-$(c):J=" ")$(suffix) ; 1001 } 1002 else 1003 { 1004 setup-$(c) = [ batch-file-environment $(setup-$(c):J=" ") ] ; 1005 } 1006 } 1007 984 1008 toolset.flags msvc.compile .CC $(cpu-conditions) : $(setup-$(c))$(compiler) /Zm800 -nologo ; 985 1009 toolset.flags msvc.compile .RC $(cpu-conditions) : $(setup-$(c))$(resource-compiler) ; 986 1010 toolset.flags msvc.compile .ASM $(cpu-conditions) : $(setup-$(c))$(cpu-assembler) -nologo ;