Changeset 85824 in vbox
- Timestamp:
- Aug 18, 2020 9:24:38 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.vbs
r85823 r85824 53 53 54 54 ' kBuild stuff. 55 dim g_strPathkBuild, g_strPathkBuildBin, g_strPathDev 55 dim g_strPathkBuild, g_strPathkBuildBin, g_strPathDev, g_arrPathDev 56 56 g_strPathkBuild = "" 57 57 g_strPathkBuildBin = "" 58 58 g_strPathDev = "" 59 g_arrPathDev = Array(":placeholder:") 59 60 60 61 dim g_strTargetArch, g_StrTargetArchWin … … 411 412 end function 412 413 413 '' Search under g_strPathDev for a tool, target arch first.414 '' Search under g_strPathDev for a tool, target arch only. 414 415 function SearchTargetTools(strTool, strVerPrefix, ByRef fnCallback, ByRef varUser) 415 SearchTargetTools = SearchToolsEx(strTool, strVerPrefix, fnCallback, varUser, _ 416 Array(g_strPathDev & "/win." & g_strTargetArch & "/" & strTool, _ 417 g_strPathDev & "/win.x86/" & strTool, _ 418 g_strPathDev & "/win.amd64/" & strTool)) 416 dim i 417 redim arrToolsDirs(ArraySize(g_arrPathDev) - 1) 418 for i = 0 to UBound(g_arrPathDev) 419 arrToolsDirs(i) = g_arrPathDev(i) & "/win." & g_strTargetArch & "/" & strTool 420 next 421 SearchTargetTools = SearchToolsEx(strTool, strVerPrefix, fnCallback, varUser, arrToolsDirs) 422 end function 423 424 '' Search under g_strPathDev for a tool, target arch and alternative arches. 425 function SearchTargetPlusTools(strTool, strVerPrefix, ByRef fnCallback, ByRef varUser) 426 dim i 427 redim arrToolsDirs(ArraySize(g_arrPathDev)*3 - 1) 428 for i = 0 to UBound(g_arrPathDev) 429 arrToolsDirs(i*3 + 0) = g_arrPathDev(i) & "/win." & g_strTargetArch & "/" & strTool 430 arrToolsDirs(i*3 + 1) = g_arrPathDev(i) & "/win.x86/" & strTool 431 arrToolsDirs(i*3 + 2) = g_arrPathDev(i) & "/win.amd64/" & strTool 432 next 433 SearchTargetPlusTools = SearchToolsEx(strTool, strVerPrefix, fnCallback, varUser, arrToolsDirs) 419 434 end function 420 435 421 436 '' Search under g_strPathDev for a tool, host arch first. 422 437 function SearchHostTools(strTool, strVerPrefix, ByRef fnCallback, ByRef varUser) 423 SearchHostTools = SearchToolsEx(strTool, strVerPrefix, fnCallback, varUser, _ 424 Array(g_strPathDev & "/win." & g_strHostArch & "/" & strTool, _ 425 g_strPathDev & "/win.x86/" & strTool, _ 426 g_strPathDev & "/win.amd64/" & strTool)) 438 dim i 439 redim arrToolsDirs(ArraySize(g_arrPathDev) * 3 - 1) 440 for i = 0 to UBound(g_arrPathDev) 441 arrToolsDirs(i*3 + 0) = g_arrPathDev(i) & "/win." & g_strHostArch & "/" & strTool 442 arrToolsDirs(i*3 + 1) = g_arrPathDev(i) & "/win.x86/" & strTool 443 arrToolsDirs(i*3 + 2) = g_arrPathDev(i) & "/win.amd64/" & strTool 444 next 445 SearchHostTools = SearchToolsEx(strTool, strVerPrefix, fnCallback, varUser, arrToolsDirs) 427 446 end function 428 447 429 448 '' Search under g_strPathDev for a tool, common dir first. 430 449 function SearchCommonTools(strTool, strVerPrefix, ByRef fnCallback, ByRef varUser) 431 SearchCommonTools = SearchToolsEx(strTool, strVerPrefix, fnCallback, varUser, _ 432 Array(g_strPathDev & "/common/" & strTool, _ 433 g_strPathDev & "/win." & g_strHostArch & "/" & strTool, _ 434 g_strPathDev & "/win.x86/" & strTool, _ 435 g_strPathDev & "/win.amd64/" & strTool)) 450 dim i 451 redim arrToolsDirs(ArraySize(g_arrPathDev) * 4 - 1) 452 for i = 0 to UBound(g_arrPathDev) 453 arrToolsDirs(i*4 + 0) = g_arrPathDev(i) & "/win.common/" & strTool 454 arrToolsDirs(i*4 + 1) = g_arrPathDev(i) & "/win." & g_strTargetArch & "/" & strTool 455 arrToolsDirs(i*4 + 2) = g_arrPathDev(i) & "/win.x86/" & strTool 456 arrToolsDirs(i*4 + 3) = g_arrPathDev(i) & "/win.amd64/" & strTool 457 next 458 SearchCommonTools = SearchToolsEx(strTool, strVerPrefix, fnCallback, varUser, arrToolsDirs) 436 459 end function 437 460 … … 661 684 end if 662 685 end if 686 g_arrPathDev(ArrayFindString(g_arrPathDev, ":placeholder:")) = g_strPathDev 663 687 664 688 ' … … 950 974 951 975 public function checkInternal 952 check g_strPathDev & "/win.amd64/vcc/v14.2", "" 953 check g_strPathDev & "/win.amd64/vcc/v14.1", "" 954 check g_strPathDev & "/win.amd64/vcc/v14.0", "" 955 check g_strPathDev & "/win.amd64/vcc/v10sp1", "" 956 check g_strPathDev & "/win.x86/vcc/v10sp1", "" 976 dim strPathDev 977 for each strPathDev in g_arrPathDev : check strPathDev & "/win.amd64/vcc/v14.2", "" : next 978 for each strPathDev in g_arrPathDev : check strPathDev & "/win.amd64/vcc/v14.2", "" : next 979 for each strPathDev in g_arrPathDev : check strPathDev & "/win.amd64/vcc/v14.1", "" : next 980 for each strPathDev in g_arrPathDev : check strPathDev & "/win.amd64/vcc/v14.0", "" : next 981 for each strPathDev in g_arrPathDev : check strPathDev & "/win.amd64/vcc/v10sp1", "" : next 982 for each strPathDev in g_arrPathDev : check strPathDev & "/win.x86/vcc/v10sp1", "" : next 957 983 checkInternal = m_blnFound 958 984 end function … … 985 1011 ' 986 1012 sub CheckForPlatformSDK(strOptSDK) 987 dim strPathPSDK, str 1013 dim strPathPSDK, strVersion, strSubKey, str, strHkey 988 1014 PrintHdr "Windows Platform SDK (recent)" 989 1015 990 strPathPSDK = "" 1016 ' 1017 ' Search for it. 1018 ' 991 1019 992 1020 ' Check the supplied argument first. 993 str = strOptSDK 994 if str <> "" then 995 if CheckForPlatformSDKSub(str) then strPathPSDK = str 996 end if 1021 strPathPSDK = CheckForPlatformSDKSub(strOptSDK, strVersion) 997 1022 998 1023 ' The tools location (first). 999 if strPathPSDK = "" And g_blnInternalFirst then 1000 str = g_strPathDev & "/win.x86/sdk/v7.1" 1001 if CheckForPlatformSDKSub(str) then strPathPSDK = str 1002 end if 1003 1004 if strPathPSDK = "" And g_blnInternalFirst then 1005 str = g_strPathDev & "/win.x86/sdk/v8.0" 1006 if CheckForPlatformSDKSub(str) then strPathPSDK = str 1007 end if 1024 if strPathPSDK = "" and g_blnInternalFirst = true then strPathPSDK = SearchTargetPlusTools("sdk", "v7.1", GetRef("CheckForPlatformSDKSub"), strVersion) 1025 if strPathPSDK = "" and g_blnInternalFirst = true then strPathPSDK = SearchTargetPlusTools("sdk", "v8.0", GetRef("CheckForPlatformSDKSub"), strVersion) 1008 1026 1009 1027 ' Look for it in the environment 1010 str = EnvGet("MSSdk") 1011 if strPathPSDK = "" And str <> "" then 1012 if CheckForPlatformSDKSub(str) then strPathPSDK = str 1013 end if 1014 1015 str = EnvGet("Mstools") 1016 if strPathPSDK = "" And str <> "" then 1017 if CheckForPlatformSDKSub(str) then strPathPSDK = str 1018 end if 1028 if strPathPSDK = "" then strPathPSDK = CheckForPlatformSDKSub(EnvGet("MSSdk"), strVersion) 1029 if strPathPSDK = "" then strPathPSDK = CheckForPlatformSDKSub(EnvGet("Mstools"), strVersion) 1019 1030 1020 1031 ' Check if there is one installed with the compiler. 1021 if strPathPSDK = "" And str <> "" then 1022 str = g_strPathVCC & "/PlatformSDK" 1023 if CheckForPlatformSDKSub(str) then strPathPSDK = str 1024 end if 1032 if strPathPSDK = "" then strPathPSDK = CheckForPlatformSDKSub(g_strPathVCC & "/PlatformSDK", strVersion) 1025 1033 1026 1034 ' Check the registry next (ASSUMES sorting). 1027 arrSubKeys = RegEnumSubKeysRVerSorted("HKLM", "SOFTWARE\Microsoft\Microsoft SDKs\Windows") 1028 for each strSubKey in arrSubKeys 1029 str = LogRegGetString("HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder") 1030 if strPathPSDK = "" And str <> "" then 1031 if CheckForPlatformSDKSub(str) then strPathPSDK = str 1032 end if 1033 Next 1034 arrSubKeys = RegEnumSubKeysRVerSorted("HKCU", "SOFTWARE\Microsoft\Microsoft SDKs\Windows") 1035 for each strSubKey in arrSubKeys 1036 str = LogRegGetString("HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder") 1037 if strPathPSDK = "" And str <> "" then 1038 if CheckForPlatformSDKSub(str) then strPathPSDK = str 1039 end if 1040 Next 1035 if strPathPSDK = "" then 1036 for each strHkey in Array("HKLM", "HKCU") 1037 for each strSubKey in RegEnumSubKeysRVerSorted(strHkey, "SOFTWARE\Microsoft\Microsoft SDKs\Windows") 1038 str = LogRegGetString(strHkey & "\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" & strSubKey & "\InstallationFolder") 1039 strPathPSDK = CheckForPlatformSDKSub(str, strVersion) 1040 if strPathPSDK <> "" then exit for 1041 next 1042 if strPathPSDK <> "" then exit for 1043 next 1044 end if 1041 1045 1042 1046 ' The tools location (post). 1043 if (strPathPSDK = "") And (g_blnInternalFirst = False) then 1044 str = g_strPathDev & "/win.x86/sdk/v7.1" 1045 if CheckForPlatformSDKSub(str) then strPathPSDK = str 1046 end if 1047 1048 if (strPathPSDK = "") And (g_blnInternalFirst = False) then 1049 str = g_strPathDev & "/win.x86/sdk/v8.0" 1050 if CheckForPlatformSDKSub(str) then strPathPSDK = str 1051 end if 1047 if strPathPSDK = "" and g_blnInternalFirst = false then strPathPSDK = SearchTargetPlusTools("sdk", "v7.1", GetRef("CheckForPlatformSDKSub"), strVersion) 1048 if strPathPSDK = "" and g_blnInternalFirst = false then strPathPSDK = SearchTargetPlusTools("sdk", "v8.0", GetRef("CheckForPlatformSDKSub"), strVersion) 1052 1049 1053 1050 ' Give up. … … 1061 1058 ' 1062 1059 strPathPSDK = UnixSlashes(PathAbs(strPathPSDK)) 1063 CfgPrintAssign "PATH_SDK_WINPSDK" & g_strVerPSDK, strPathPSDK1064 CfgPrintAssign "VBOX_WINPSDK", "WINPSDK" & g_strVerPSDK1060 CfgPrintAssign "PATH_SDK_WINPSDK" & strVersion, strPathPSDK 1061 CfgPrintAssign "VBOX_WINPSDK", "WINPSDK" & strVersion 1065 1062 1066 1063 PrintResult "Windows Platform SDK", strPathPSDK 1067 PrintResultMsg "Windows Platform SDK version", g_strVerPSDK 1064 PrintResultMsg "Windows Platform SDK version", strVersion 1065 g_strVerPSDK = strVersion 1068 1066 g_strPathPSDK = strPathPSDK 1069 1067 end sub 1070 1068 1071 1069 '' Checks if the specified path points to a usable PSDK. 1072 function CheckForPlatformSDKSub(strPathPSDK )1070 function CheckForPlatformSDKSub(strPathPSDK, ByRef strVersion) 1073 1071 dim strOutput 1074 CheckForPlatformSDKSub = False 1075 LogPrint "trying: strPathPSDK=" & strPathPSDK 1076 if LogFileExists(strPathPSDK, "include/Windows.h") _ 1077 And LogFileExists(strPathPSDK, "lib/Kernel32.Lib") _ 1078 And LogFileExists(strPathPSDK, "lib/User32.Lib") _ 1079 And LogFileExists(strPathPSDK, "bin/rc.exe") _ 1080 And Shell("""" & DosSlashes(strPathPSDK & "/bin/rc.exe") & """" , True, strOutput) <> 0 _ 1072 CheckForPlatformSDKSub = "" 1073 if strPathPSDK <> "" then 1074 LogPrint "Trying: strPathPSDK=" & strPathPSDK 1075 if LogFileExists(strPathPSDK, "include/Windows.h") _ 1076 and LogFileExists(strPathPSDK, "lib/Kernel32.Lib") _ 1077 and LogFileExists(strPathPSDK, "lib/User32.Lib") _ 1078 and LogFileExists(strPathPSDK, "bin/rc.exe") _ 1079 and Shell("""" & DosSlashes(strPathPSDK & "/bin/rc.exe") & """" , True, strOutput) <> 0 _ 1081 1080 then 1082 if InStr(1, strOutput, "Resource Compiler Version 6.2.") > 0 then 1083 g_strVerPSDK = "80" 1084 CheckForPlatformSDKSub = True 1085 elseif InStr(1, strOutput, "Resource Compiler Version 6.1.") > 0 then 1086 g_strVerPSDK = "71" 1087 CheckForPlatformSDKSub = True 1081 if InStr(1, strOutput, "Resource Compiler Version 6.2.") > 0 then 1082 strVersion = "80" 1083 CheckForPlatformSDKSub = UnixSlashes(PathAbs(strPathPSDK)) 1084 elseif InStr(1, strOutput, "Resource Compiler Version 6.1.") > 0 then 1085 strVersion = "71" 1086 CheckForPlatformSDKSub = UnixSlashes(PathAbs(strPathPSDK)) 1087 end if 1088 1088 end if 1089 1089 end if … … 1104 1104 strSDK10Version = "" 1105 1105 strPathSDK10 = CheckForSDK10Sub(strOptSDK10, strSDK10Version) 1106 if strPathSDK10 = "" and g_blnInternalFirst = True then strPathSDK10 = CheckForSDK10ToolsSub(strSDK10Version) 1106 if strPathSDK10 = "" and g_blnInternalFirst = true then 1107 strPathSDK10 = SearchTargetPlusTools("sdk", "v10.", GetRef("CheckForSDK10Sub"), strSDK10Version) 1108 end if 1109 1107 1110 if strPathSDK10 = "" then 1108 1111 str = LogRegGetString("HKLM\SOFTWARE\Microsoft\Windows Kits\Installed Roots\KitsRoot10") … … 1115 1118 next 1116 1119 end if 1117 if strPathSDK10 = "" and g_blnInternalFirst = False then strPathSDK10 = CheckForSDK10ToolsSub() 1120 if strPathSDK10 = "" and g_blnInternalFirst = true then 1121 strPathSDK10 = SearchTargetPlusTools("sdk", "v10.", GetRef("CheckForSDK10Sub"), strSDK10Version) 1122 end if 1118 1123 1119 1124 if strPathSDK10 = "" then … … 1133 1138 g_strPathSDK10 = strPathSDK10 1134 1139 end sub 1135 1136 '' Checks the tools directory.1137 function CheckForSDK10ToolsSub(ByRef strSDK10Version)1138 dim arrToolsDirs, strToolsDir, arrDirs, strDir1139 CheckForSDK10ToolSub = ""1140 arrToolsDirs = Array(g_strPathDev & "/win." & g_strTargetArch & "/sdk", _1141 g_strPathDev & "/win.x86/sdk", g_strPathDev & "/win.amd64/sdk")1142 for each strToolsDir in arrToolsDirs1143 arrDirs = GetSubdirsStartingWithRVerSorted(strToolsDir, "v10.")1144 for each strDir in arrDirs1145 CheckForSDK10ToolsSub = CheckForSDK10Sub(strToolsDir & "/" & strDir, strSDK10Version)1146 if CheckForSDK10ToolsSub <> "" then1147 exit function1148 end if1149 next1150 next1151 end function1152 1140 1153 1141 '' Checks if the specified path points to a usable Windows 10 SDK/WDK. … … 1205 1193 ' Find the DDK. 1206 1194 ' 1207 strPathDDK = "" 1208 ' The specified path. 1209 if strPathDDK = "" And strOptDDK <> "" then 1210 if CheckForWinDDKSub(strOptDDK, True) then strPathDDK = strOptDDK 1211 end if 1195 strPathDDK = CheckForWinDDKSub(strOptDDK, True) 1212 1196 1213 1197 ' The tools location (first). 1214 if strPathDDK = "" And g_blnInternalFirst then 1215 str = g_strPathDev & "/win.x86/ddk/7600.16385.1" 1216 if CheckForWinDDKSub(str, False) then strPathDDK = str 1198 if strPathDDK = "" and g_blnInternalFirst = true then 1199 for each str in g_arrPathDev 1200 strPathDDK = CheckForWinDDKSub(str & "/win.x86/ddk/7600.16385.1", False) 1201 if strPathDDK <> "" then exit for 1202 next 1217 1203 end if 1218 1204 1219 1205 ' Check the environment 1220 str = EnvGet("DDK_INC_PATH") 1221 if strPathDDK = "" And str <> "" then 1222 str = PathParent(PathParent(str)) 1223 if CheckForWinDDKSub(str, True) then strPathDDK = str 1224 end if 1225 1226 str = EnvGet("BASEDIR") 1227 if strPathDDK = "" And str <> "" then 1228 if CheckForWinDDKSub(str, True) then strPathDDK = str 1229 end if 1206 if strPathDDK = "" then strPathDDK = CheckForWinDDKSub(PathParent(PathParent(EnvGet("DDK_INC_PATH"))), True) 1207 if strPathDDK = "" then strPathDDK = CheckForWinDDKSub(EnvGet("BASEDIR"), True) 1230 1208 1231 1209 ' Some array constants to ease the work. … … 1234 1212 1235 1213 ' Windows 7 WDK. 1236 arrLocations = array() 1237 for each strSoftwareKey in arrSoftwareKeys 1238 for each strSubKey in RegEnumSubKeysFull("HKLM", strSoftwareKey & "\Microsoft\KitSetup\configured-kits") 1239 for each strSubKey2 in RegEnumSubKeysFull("HKLM", strSubKey) 1240 str = LogRegGetString("HKLM\" & strSubKey2 & "\setup-install-location") 1241 if str <> "" then 1242 arrLocations = ArrayAppend(arrLocations, PathAbsLong(str)) 1243 end if 1214 if strPathDDK = "" then 1215 arrLocations = array() 1216 for each strSoftwareKey in arrSoftwareKeys 1217 for each strSubKey in RegEnumSubKeysFull("HKLM", strSoftwareKey & "\Microsoft\KitSetup\configured-kits") 1218 for each strSubKey2 in RegEnumSubKeysFull("HKLM", strSubKey) 1219 str = LogRegGetString("HKLM\" & strSubKey2 & "\setup-install-location") 1220 if str <> "" then 1221 arrLocations = ArrayAppend(arrLocations, PathAbsLong(str)) 1222 end if 1223 next 1244 1224 next 1245 1225 next 1246 next 1247 arrLocations = ArrayRVerSortStrings(arrLocations) 1248 1249 ' Check the locations we've gathered. 1250 for each str in arrLocations 1251 if strPathDDK = "" then 1252 if CheckForWinDDKSub(str, True) then strPathDDK = str 1253 end if 1254 next 1226 arrLocations = ArrayRVerSortStrings(arrLocations) 1227 1228 ' Check the locations we've gathered. 1229 for each str in arrLocations 1230 strPathDDK = CheckForWinDDKSub(str, True) 1231 if strPathDDK <> "" then exit for 1232 next 1233 end if 1255 1234 1256 1235 ' The tools location (post). 1257 if (strPathDDK = "") And (g_blnInternalFirst = False) then 1258 str = g_strPathDev & "/win.x86/ddk/7600.16385.1" 1259 if CheckForWinDDKSub(str, False) then strPathDDK = str 1236 if strPathDDK = "" and g_blnInternalFirst = false then 1237 for each str in g_arrPathDev 1238 strPathDDK = CheckForWinDDKSub(str & "/win.x86/ddk/7600.16385.1", False) 1239 if strPathDDK <> "" then exit for 1240 next 1260 1241 end if 1261 1242 … … 1278 1259 '' Quick check if the DDK is in the specified directory or not. 1279 1260 function CheckForWinDDKSub(strPathDDK, blnCheckBuild) 1280 dim strOutput 1281 CheckForWinDDKSub = False 1282 LogPrint "trying: strPathDDK=" & strPathDDK & " blnCheckBuild=" & blnCheckBuild 1283 if LogFileExists(strPathDDK, "inc/api/ntdef.h") _ 1284 And LogFileExists(strPathDDK, "lib/win7/i386/int64.lib") _ 1285 And LogFileExists(strPathDDK, "lib/wlh/i386/int64.lib") _ 1286 And LogFileExists(strPathDDK, "lib/wnet/i386/int64.lib") _ 1287 And LogFileExists(strPathDDK, "lib/wxp/i386/int64.lib") _ 1288 And Not LogFileExists(strPathDDK, "lib/win8/i386/int64.lib") _ 1289 And LogFileExists(strPathDDK, "bin/x86/rc.exe") _ 1290 then 1291 if Not blnCheckBuild then 1292 CheckForWinDDKSub = True 1293 '' @todo Find better build check. 1294 elseif Shell("""" & DosSlashes(strPathDDK & "/bin/x86/rc.exe") & """" , True, strOutput) <> 0 _ 1295 And InStr(1, strOutput, "Resource Compiler Version 6.1.") > 0 then 1296 CheckForWinDDKSub = True 1261 CheckForWinDDKSub = "" 1262 if strPathDDK <> "" then 1263 dim strOutput 1264 LogPrint "Trying: strPathDDK=" & strPathDDK & " blnCheckBuild=" & blnCheckBuild 1265 if LogFileExists(strPathDDK, "inc/api/ntdef.h") _ 1266 And LogFileExists(strPathDDK, "lib/win7/i386/int64.lib") _ 1267 And LogFileExists(strPathDDK, "lib/wlh/i386/int64.lib") _ 1268 And LogFileExists(strPathDDK, "lib/wnet/i386/int64.lib") _ 1269 And LogFileExists(strPathDDK, "lib/wxp/i386/int64.lib") _ 1270 And Not LogFileExists(strPathDDK, "lib/win8/i386/int64.lib") _ 1271 And LogFileExists(strPathDDK, "bin/x86/rc.exe") _ 1272 then 1273 if Not blnCheckBuild then 1274 CheckForWinDDKSub = strPathDDK 1275 '' @todo Find better build check. 1276 elseif Shell("""" & DosSlashes(strPathDDK & "/bin/x86/rc.exe") & """" , True, strOutput) <> 0 _ 1277 and InStr(1, strOutput, "Resource Compiler Version 6.1.") > 0 _ 1278 then 1279 CheckForWinDDKSub = strPathDDK 1280 end if 1297 1281 end if 1298 1282 end if … … 1304 1288 ' 1305 1289 sub CheckForMidl(strOptMidl) 1306 dim strMidl 1290 dim strMidl, str 1307 1291 PrintHdr "Midl.exe" 1308 1292 … … 1321 1305 if strMidl = "" then strMidl = CheckForMidlSub(g_strPathDDK & "/bin/x86/Midl.exe") 1322 1306 if strMidl = "" then strMidl = CheckForMidlSub(g_strPathDDK & "/bin/Midl.exe") 1323 if strMidl = "" then strMidl = CheckForMidlSub(g_strPathDev & "/win.x86/bin/Midl.exe") 1307 if strMidl = "" then 1308 for each str in g_arrPathDev 1309 strMidl = CheckForMidlSub(str & "/win." & g_strHostArchWin & "/bin/Midl.exe") 1310 if strMidl <> "" then exit for 1311 strMidl = CheckForMidlSub(str & "/win.x86/bin/Midl.exe") 1312 if strMidl <> "" then exit for 1313 next 1314 end if 1324 1315 1325 1316 if strMidl = "" then … … 1554 1545 ' 1555 1546 sub CheckForlibSDL(strOptlibSDL) 1556 dim strPath libSDL, str1547 dim strPathLibSDL, strVersion 1557 1548 PrintHdr "libSDL" 1558 1549 … … 1560 1551 ' Try find some SDL library. 1561 1552 ' 1562 1563 ' First, the specific location. 1564 strPathlibSDL = "" 1565 if (strPathlibSDL = "") And (strOptlibSDL <> "") then 1566 if CheckForlibSDLSub(strOptlibSDL) then strPathlibSDL = strOptlibSDL 1567 end if 1568 1569 ' The tools location (first). 1570 if (strPathlibSDL = "") And (g_blnInternalFirst = True) then 1571 str = g_strPathDev & "/win." & g_strTargetArch & "/libsdl" 1572 if HasSubdirsStartingWith(str, "v") then 1573 PrintResult "libSDL", str & "/v* (auto)" 1574 exit sub 1575 end if 1576 end if 1577 1578 ' Poke about in the path. 1579 if strPathlibSDL = "" then 1580 str = WhichEx("LIB", "SDLmain.lib") 1581 if str = "" then str = Which("..\lib\SDLmain.lib") 1582 if str = "" then str = Which("SDLmain.lib") 1583 if str <> "" then 1584 str = PathParent(PathStripFilename(str)) 1585 if CheckForlibSDLSub(str) then strPathlibSDL = str 1586 end if 1587 end if 1588 1589 if strPathlibSDL = "" then 1590 str = Which("SDL.dll") 1591 if str <> "" then 1592 str = PathParent(PathStripFilename(str)) 1593 if CheckForlibSDLSub(str) then strPathlibSDL = str 1594 end if 1595 end if 1596 1597 ' The tools location (post). 1598 if (strPathlibSDL = "") And (g_blnInternalFirst = False) then 1599 str = g_strPathDev & "/win." & g_strTargetArch & "/libsdl" 1600 if HasSubdirsStartingWith(str, "v") then 1601 PrintResult "libSDL", str & "/v* (auto)" 1602 exit sub 1603 end if 1553 strPathLibSDL = CheckForLibSDLSub(strOptlibSDL, strVersion) 1554 if strPathlibSDL = "" and g_blnInternalFirst = true then 1555 strPathLibSDL = SearchTargetTools("libsdl", "v", GetRef("CheckForLibSDLSub"), strVersion) 1556 end if 1557 1558 ' Poke about in the LIB and PATH env.vars. 1559 if strPathlibSDL = "" then strPathLibSDL = CheckForlibSDLSub(PathParent(PathStripFilename(WhichEx("LIB", "SDLmain.lib"))), strVersion) 1560 if strPathlibSDL = "" then strPathLibSDL = CheckForlibSDLSub(PathParent(PathStripFilename(Which("..\lib\SDLmain.lib"))), strVersion) 1561 if strPathlibSDL = "" then strPathLibSDL = CheckForlibSDLSub(PathParent(PathStripFilename(Which("SDLmain.lib"))), strVersion) 1562 if strPathlibSDL = "" then strPathLibSDL = CheckForlibSDLSub(PathParent(PathStripFilename(Which("SDL.dll"))), strVersion) 1563 1564 ' The tools again. 1565 if strPathlibSDL = "" and g_blnInternalFirst = false then 1566 strPathLibSDL = SearchTargetTools("libsdl", "v", GetRef("CheckForLibSDLSub"), strVersion) 1604 1567 end if 1605 1568 … … 1622 1585 1623 1586 '' Checks if the specified path points to an usable libSDL or not. 1624 function CheckForlibSDLSub(strPathlibSDL) 1625 CheckForlibSDLSub = False 1626 LogPrint "trying: strPathlibSDL=" & strPathlibSDL 1627 if LogFileExists(strPathlibSDL, "lib/SDL.lib") _ 1628 And LogFileExists(strPathlibSDL, "lib/SDLmain.lib") _ 1629 And LogFileExists(strPathlibSDL, "lib/SDL.dll") _ 1630 And LogFileExists(strPathlibSDL, "include/SDL.h") _ 1631 And LogFileExists(strPathlibSDL, "include/SDL_syswm.h") _ 1632 And LogFileExists(strPathlibSDL, "include/SDL_version.h") _ 1587 function CheckForLibSDLSub(strPathlibSDL, strVersion) 1588 CheckForlibSDLSub = "" 1589 if strPathLibSDL <> "" then 1590 LogPrint "Trying: strPathLibSDL=" & strPathLibSDL 1591 if LogFileExists(strPathLibSDL, "lib/SDL.lib") _ 1592 and LogFileExists(strPathLibSDL, "lib/SDLmain.lib") _ 1593 and LogFileExists(strPathLibSDL, "lib/SDL.dll") _ 1633 1594 then 1634 CheckForlibSDLSub = True 1595 dim strIncSub : strIncSub = "include" 1596 if DirExists(strPathlibSDL & "/include/SDL") then strIncSub = "include/SDL" 1597 if LogFileExists(strPathLibSDL, strIncSub & "/SDL.h") _ 1598 and LogFileExists(strPathLibSDL, strIncSub & "/SDL_syswm.h") _ 1599 and LogFileExists(strPathLibSDL, strIncSub & "/SDL_version.h") _ 1600 then 1601 strVersion = "" 1602 CheckForLibSDLSub = strPathLibSDL 1603 end if 1604 end if 1635 1605 end if 1636 1606 end function … … 1865 1835 ' 1866 1836 sub CheckForQt(strOptQt5, strOptInfix) 1867 dim strPathQt5, strInfixQt5, arrFolders, arrVccInfixes, strVccInfix 1837 dim strPathQt5, strInfixQt5, arrFolders, arrVccInfixes, strVccInfix, strPathDev 1868 1838 PrintHdr "Qt5" 1869 1839 … … 1872 1842 ' 1873 1843 LogPrint "Checking for user specified path of Qt5 ... " 1874 strPathQt5 = "" 1875 if strOptQt5 <> "" then 1876 strPathQt5 = CheckForQt5Sub(UnixSlashes(strOptQt5), strOptInfix, strInfixQt5) 1877 end if 1878 1879 if strPathQt = "" then 1844 strPathQt5 = CheckForQt5Sub(UnixSlashes(strOptQt5), strOptInfix, strInfixQt5) 1845 if strPathQt5 = "" and g_blnInternalFirst = true then strPathQt5 = CheckForQt5Internal(strOptInfix, strInfixQt5) 1846 if strPathQt5 = "" then 1880 1847 ' 1881 1848 ' Collect links from "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\UFH\SHC" … … 1919 1886 1920 1887 ' Check the dev tools - prefer ones matching the compiler. 1921 if strPathQt5 = "" then 1922 LogPrint "Testing tools dir (" & g_strPathDev & "/win." & g_strTargetArch & "/qt/v5*) ..." 1923 arrFolders = GetSubdirsStartingWithVerSorted(g_strPathDev & "/win." & g_strTargetArch & "/qt", "v5") 1924 arrVccInfixes = Array(LCase(g_strVCCVersion), Left(LCase(g_strVCCVersion), Len(g_strVCCVersion) - 1), "") 1925 for each strVccInfix in arrVccInfixes 1926 for i = UBound(arrFolders) to LBound(arrFolders) step -1 1927 if strVccInfix = "" or InStr(1, LCase(arrFolders(i)), strVccInfix) > 0 then 1928 strPathQt5 = CheckForQt5Sub(g_strPathDev & "/win." & g_strTargetArch & "/qt/" & arrFolders(i), strOptInfix, strInfixQt5) 1929 if strPathQt5 <> "" then exit for 1930 end if 1931 next 1932 if strPathQt5 <> "" then exit for 1933 next 1934 end if 1888 if strPathQt5 = "" and g_blnInternalFirst = false then strPathQt5 = CheckForQt5Internal(strOptInfix, strInfixQt5) 1935 1889 1936 1890 ' … … 1951 1905 end sub 1952 1906 1907 function CheckForQt5Internal(strOptInfix, ByRef strInfixQt5) 1908 dim strPathDev, arrFolders, arrVccInfixes, strVccInfix, i 1909 CheckForQt5Internal = "" 1910 for each strPathDev in g_arrPathDev 1911 LogPrint "Testing tools dir (" & strPathDev & "/win." & g_strTargetArch & "/qt/v5*) ..." 1912 arrFolders = GetSubdirsStartingWithVerSorted(strPathDev & "/win." & g_strTargetArch & "/qt", "v5") 1913 arrVccInfixes = Array(LCase(g_strVCCVersion), Left(LCase(g_strVCCVersion), Len(g_strVCCVersion) - 1), "") 1914 for each strVccInfix in arrVccInfixes 1915 for i = UBound(arrFolders) to LBound(arrFolders) step -1 1916 if strVccInfix = "" or InStr(1, LCase(arrFolders(i)), strVccInfix) > 0 then 1917 LogPrint "i="&i&" strVccInfix="&strVccInfix 1918 strPathQt5 = CheckForQt5Sub(strPathDev & "/win." & g_strTargetArch & "/qt/" & arrFolders(i), strOptInfix, strInfixQt5) 1919 if strPathQt5 <> "" then 1920 CheckForQt5Internal = strPathQt5 1921 exit function 1922 end if 1923 end if 1924 next 1925 next 1926 next 1927 end function 1928 1953 1929 function Qt5ProgramItemCallback(ByRef arrStrings, cStrings, ByRef strUnused) 1954 1930 dim str, off … … 1968 1944 function CheckForQt5Sub(strPathQt5, strOptInfix, ByRef strInfixQt5) 1969 1945 CheckForQt5Sub = "" 1970 LogPrint "trying: strPathQt5=" & strPathQt5 1971 1972 if LogFileExists(strPathQt5, "bin/moc.exe") _ 1973 and LogFileExists(strPathQt5, "bin/uic.exe") _ 1974 and LogFileExists(strPathQt5, "include/QtWidgets/qwidget.h") _ 1975 and LogFileExists(strPathQt5, "include/QtWidgets/QApplication") _ 1976 and LogFileExists(strPathQt5, "include/QtGui/QImage") _ 1977 and LogFileExists(strPathQt5, "include/QtNetwork/QHostAddress") _ 1978 then 1979 ' Infix testing. 1980 if LogFileExists(strPathQt5, "lib/Qt5Core.lib") _ 1981 and LogFileExists(strPathQt5, "lib/Qt5Network.lib") then 1982 strInfixQt5 = "" 1983 CheckForQt5Sub = UnixSlashes(PathAbs(strPathQt5)) 1984 elseif LogFileExists(strPathQt5, "lib/Qt5Core" & strOptInfix & ".lib") _ 1985 and LogFileExists(strPathQt5, "lib/Qt5Network" & strOptInfix & ".lib") then 1986 strInfixQt5 = strOptInfix 1987 CheckForQt5Sub = UnixSlashes(PathAbs(strPathQt5)) 1988 elseif LogFileExists(strPathQt5, "lib/Qt5CoreVBox.lib") _ 1989 and LogFileExists(strPathQt5, "lib/Qt5NetworkVBox.lib") then 1990 strInfixQt5 = "VBox" 1991 CheckForQt5Sub = UnixSlashes(PathAbs(strPathQt5)) 1946 if strPathQt5 <> "" then 1947 LogPrint "Trying: strPathQt5=" & strPathQt5 1948 1949 if LogFileExists(strPathQt5, "bin/moc.exe") _ 1950 and LogFileExists(strPathQt5, "bin/uic.exe") _ 1951 and LogFileExists(strPathQt5, "include/QtWidgets/qwidget.h") _ 1952 and LogFileExists(strPathQt5, "include/QtWidgets/QApplication") _ 1953 and LogFileExists(strPathQt5, "include/QtGui/QImage") _ 1954 and LogFileExists(strPathQt5, "include/QtNetwork/QHostAddress") _ 1955 then 1956 ' Infix testing. 1957 if LogFileExists(strPathQt5, "lib/Qt5Core.lib") _ 1958 and LogFileExists(strPathQt5, "lib/Qt5Network.lib") then 1959 LogPrint "found it w/o infix" 1960 strInfixQt5 = "" 1961 CheckForQt5Sub = UnixSlashes(PathAbs(strPathQt5)) 1962 elseif LogFileExists(strPathQt5, "lib/Qt5Core" & strOptInfix & ".lib") _ 1963 and LogFileExists(strPathQt5, "lib/Qt5Network" & strOptInfix & ".lib") then 1964 LogPrint "found it w/ infix: " & strOptInfix & " (option)" 1965 strInfixQt5 = strOptInfix 1966 CheckForQt5Sub = UnixSlashes(PathAbs(strPathQt5)) 1967 elseif LogFileExists(strPathQt5, "lib/Qt5CoreVBox.lib") _ 1968 and LogFileExists(strPathQt5, "lib/Qt5NetworkVBox.lib") then 1969 LogPrint "found it w/ infix: VBox" 1970 strInfixQt5 = "VBox" 1971 CheckForQt5Sub = UnixSlashes(PathAbs(strPathQt5)) 1972 end if 1992 1973 end if 1993 1974 end if … … 2084 2065 Print " --with-libcurl=PATH To use a cURL other than the VBox one (optional)." 2085 2066 Print " --with-libcurl32=PATH The 32-bit variant of cURL (optional)." 2067 Print "" 2068 Print " --append-tools-dir=PATH, --prepend-tools-dir=PATH" 2069 Print " Adds an alternative tools directory to search." 2070 Print " --append-tools-dir=PATH, --prepend-prog-files=PATH" 2071 Print " Adds an alternative Program Files dir to search." 2072 Print " --append-ewdk-drive=DRIVE, --prepend-ewdk-drive=DRIVE" 2073 Print " Adds an EWDK drive the search list." 2086 2074 end sub 2087 2075 … … 2199 2187 strOptPython = strPath 2200 2188 2189 ' Search lists. 2190 case "--append-tools-dir" 2191 g_arrToolsDirs = ArrayAppend(g_arrPathDev, strPath) 2192 case "--prepend-tools-dir" 2193 g_arrToolsDirs = ArrayPrepend(g_arrPathDev, strPath) 2194 case "--append-prog-files" 2195 g_arrProgramFiles = ArrayAppend(g_arrProgramFiles, strPath) 2196 case "--prepend-prog-files" 2197 g_arrProgramFiles = ArrayPrepend(g_arrProgramFiles, strPath) 2198 case "--append-ewdk-drive" 2199 g_arrProgramFiles = ArrayAppend(g_arrProgramFiles, strPath & "\Program Files") 2200 case "--prepend-ewdk-drive" 2201 g_arrProgramFiles = ArrayPrepend(g_arrProgramFiles, strPath & "\Program Files") 2202 2201 2203 ' --disable-something/--enable-something 2202 2204 case "--disable-com" -
trunk/tools/win/vbscript/helpers.vbs
r85823 r85824 668 668 end function 669 669 670 '' Wrapper for StrComp as GetRef("StrComp") fails. 671 function WrapStrComp(str1, str2) 672 WrapStrComp = StrComp(str1, str2) 673 end function 670 674 671 675 '' 672 676 ' Returns a reverse sorted array (strings). 673 677 function ArraySortStrings(arrStrings) 674 ArraySortStrings = ArraySortStringsEx(arrStrings, GetRef(" StrComp"))678 ArraySortStrings = ArraySortStringsEx(arrStrings, GetRef("WrapStrComp")) 675 679 end function 676 680 … … 683 687 684 688 689 '' Wrapper for StrComp as GetRef("StrComp") fails. 690 function WrapStrCompNeg(str1, str2) 691 WrapStrCompNeg = -StrComp(str1, str2) 692 end function 693 685 694 '' 686 695 ' Returns a reverse sorted array (strings). 687 696 function ArrayRSortStrings(arrStrings) 688 ArrayRSortStrings = Array Reverse(ArraySortStringsEx(arrStrings, GetRef("StrComp")))697 ArrayRSortStrings = ArraySortStringsEx(arrStrings, GetRef("WrapStrCompNeg")) 689 698 end function 690 699 … … 707 716 708 717 '' 718 ' Returns an Array() statement string 719 function ArrayToString(arrStrings) 720 dim strRet 721 strRet = "Array(" 722 for i = LBound(arrStrings) to UBound(arrStrings) 723 if i <> LBound(arrStrings) then strRet = strRet & ", " 724 strRet = strRet & """" & arrStrings(i) & """" 725 next 726 ArrayToString = strRet & ")" 727 end function 728 729 730 '' 709 731 ' Returns the input array with the string appended. 710 ' Note! There must be some better way of doing this... 711 ' @todo Lots of copying here... 712 function ArrayAppend(arr, str) 713 dim i, cnt 714 cnt = UBound(arr) - LBound(arr) + 1 715 redim arrRet(cnt) 716 for i = LBound(arr) to UBound(arr) 717 arrRet(i) = arr(i) 718 next 719 arrRet(UBound(arr) + 1) = str 720 ArrayAppend = arrRet 732 ' @note This works by reference 733 function ArrayAppend(ByRef arr, str) 734 dim i 735 redim preserve arr(UBound(arr) + 1) 736 arr(UBound(arr)) = str 737 ArrayAppend = arr 738 end function 739 740 741 '' 742 ' Returns the input array with the string prepended. 743 ' @note This works by reference 744 function ArrayPrepend(ByRef arr, str) 745 dim i 746 redim preserve arr(UBound(arr) + 1) 747 for i = UBound(arr) to (LBound(arr) + 1) step -1 748 arr(i) = arr(i - 1) 749 next 750 arr(LBound(arr)) = str 751 ArrayPrepend = arr 752 end function 753 754 755 '' 756 ' Returns the input array with the string prepended. 757 ' @note This works by reference 758 function ArrayRemove(ByRef arr, idx) 759 dim i 760 for i = idx to (UBound(arr) - 1) 761 arr(i) = arr(i + 1) 762 next 763 redim preserve arr(UBound(arr) - 1) 764 ArrayRemove = arr 721 765 end function 722 766 … … 748 792 next 749 793 end function 794 795 796 '' 797 ' Returns the index of the first occurance of the given string; -1 if not found. 798 function ArrayFindString(ByRef arr, str) 799 dim i 800 for i = LBound(arr) to UBound(arr) 801 if StrComp(arr(i), str, vbBinaryCompare) = 0 then 802 ArrayFindString = i 803 exit function 804 end if 805 next 806 ArrayFindString = LBound(arr) - 1 807 end function 808 809 810 '' 811 ' Returns the index of the first occurance of the given string, -1 if not found, 812 ' case insensitive edition. 813 function ArrayFindStringI(ByRef arr, str) 814 dim i 815 for i = LBound(arr) to UBound(arr) 816 if StrComp(arr(i), str, vbTextCompare) = 0 then 817 ArrayFindStringI = i 818 exit function 819 end if 820 next 821 ArrayFindStringI = LBound(arr) - 1 822 end function 823 750 824 751 825 '' … … 1134 1208 if StrGetFirstWord("1234 5") <> "1234" then MsgFatal "SelfTest: StrGetFirstWord #5" 1135 1209 if StrGetFirstWord(" ") <> "" then MsgFatal "SelfTest: StrGetFirstWord #6" 1136 end sub 1137 1210 1211 dim arr 1212 arr = ArrayAppend(Array("0", "1"), "2") 1213 if ArraySize(arr) <> 3 then MsgFatal "SelfTest: Array #1: size:" & ArraySize(arr) 1214 if ArrayToString(arr) <> "Array(""0"", ""1"", ""2"")" then MsgFatal "SelfTest: Array #1: " & ArrayToString(arr) 1215 1216 arr = ArrayPrepend(arr, "-1") 1217 if ArraySize(arr) <> 4 then MsgFatal "SelfTest: Array #2: size:" & ArraySize(arr) 1218 if ArrayToString(arr) <> "Array(""-1"", ""0"", ""1"", ""2"")" then MsgFatal "SelfTest: Array #2: " & ArrayToString(arr) 1219 1220 ArrayPrepend arr, "-2" 1221 if ArraySize(arr) <> 5 then MsgFatal "SelfTest: Array #3: size:" & ArraySize(arr) 1222 if ArrayToString(arr) <> "Array(""-2"", ""-1"", ""0"", ""1"", ""2"")" then MsgFatal "SelfTest: Array #3: " & ArrayToString(arr) 1223 1224 ArrayRemove arr, 1 1225 if ArraySize(arr) <> 4 then MsgFatal "SelfTest: Array #4: size:" & ArraySize(arr) 1226 if ArrayToString(arr) <> "Array(""-2"", ""0"", ""1"", ""2"")" then MsgFatal "SelfTest: Array #4: " & ArrayToString(arr) 1227 1228 arr = ArrayRemove(arr, 2) 1229 if ArraySize(arr) <> 3 then MsgFatal "SelfTest: Array #5: size:" & ArraySize(arr) 1230 if ArrayToString(arr) <> "Array(""-2"", ""0"", ""2"")" then MsgFatal "SelfTest: Array #5: " & ArrayToString(arr) 1231 1232 arr = ArrayPrepend(arr, "42") 1233 arr = ArrayAppend(arr, "-42") 1234 if ArraySize(arr) <> 5 then MsgFatal "SelfTest: Array #6: size:" & ArraySize(arr) 1235 if ArrayToString(arr) <> "Array(""42"", ""-2"", ""0"", ""2"", ""-42"")" then MsgFatal "SelfTest: Array #6: " & ArrayToString(arr) 1236 1237 arr = ArraySortStrings(arr) 1238 if ArraySize(arr) <> 5 then MsgFatal "SelfTest: Array #7: size:" & ArraySize(arr) 1239 if ArrayToString(arr) <> "Array(""-2"", ""-42"", ""0"", ""2"", ""42"")" then MsgFatal "SelfTest: Array #7: " & ArrayToString(arr) 1240 1241 arr = ArrayRSortStrings(arr) 1242 if ArraySize(arr) <> 5 then MsgFatal "SelfTest: Array #7: size:" & ArraySize(arr) 1243 if ArrayToString(arr) <> "Array(""42"", ""2"", ""0"", ""-42"", ""-2"")" then MsgFatal "SelfTest: Array #8: " & ArrayToString(arr) 1244 1245 arr = ArrayVerSortStrings(Array("v10", "v1", "v0")) 1246 if ArrayToString(arr) <> "Array(""v0"", ""v1"", ""v10"")" then MsgFatal "SelfTest: Array #9: " & ArrayToString(arr) 1247 1248 arr = ArrayRVerSortStrings(arr) 1249 if ArrayToString(arr) <> "Array(""v10"", ""v1"", ""v0"")" then MsgFatal "SelfTest: Array #10: " & ArrayToString(arr) 1250 1251 end sub 1252
Note:
See TracChangeset
for help on using the changeset viewer.