VirtualBox

Changeset 85787 in vbox


Ignore:
Timestamp:
Aug 16, 2020 9:14:49 PM (4 years ago)
Author:
vboxsync
Message:

configure.vbs: Find a windows 10 SDK. Needed for UCRT and winhv api.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.vbs

    r85786 r85787  
    4242g_strPathDev = ""
    4343
    44 dim g_strTargetArch
     44dim g_strTargetArch, g_StrTargetArchWin
    4545g_strTargetArch = ""
    46 
    47 dim g_strHostArch
     46g_StrTargetArchWin = ""
     47
     48dim g_strHostArch, g_strHostArchWin
    4849g_strHostArch = ""
     50g_strHostArchWin = ""
    4951
    5052' Visual C++ info.
     
    5456
    5557' SDK and DDK.
    56 dim g_strPathPSDK, g_strVerPSDK, g_strPathDDK
     58dim g_strPathSDK10, g_strPathPSDK, g_strVerPSDK, g_strPathDDK
     59g_strPathSDK10 = ""
    5760g_strPathPSDK = ""
    5861g_strVerPSDK = ""
     
    645648
    646649''
    647 ' Sorts a string array.
    648 sub SortStringArray(ByRef arr)
    649    dim i, j, strTemp
    650    for i = UBound(arr) - 1 to 0 step -1
    651       for j = 0 to i
    652          if StrComp(arr(j), arr(j + 1)) > 0 then
    653             strTemp = arr(j)
    654             arr(j) = arr(j + 1)
    655             arr(j + 1) = strTemp
    656          end if
    657       next
    658    next
    659 end sub
    660 
    661 ''
    662650' Returns a sorted array of subfolder names that starts with the given string.
    663 function GetSubdirsStartingWithSorted(strFolder, strStartingWith)
     651function GetSubdirsStartingWith(strFolder, strStartingWith)
    664652   if DirExists(strFolder) then
    665653      dim obj, i
     
    672660      next
    673661      if i > 0 then
    674          redim arrResult(i)
     662         redim arrResult(i - 1)
    675663         i = 0
    676664         for each objSub in obj.SubFolders
     
    680668            end if
    681669         next
    682 
    683          SortStringArray arrResult
    684          GetSubdirsStartingWithSorted = arrResult
     670         GetSubdirsStartingWith = arrResult
    685671      else
    686          GetSubdirsStartingWithSorted = Array()
     672         GetSubdirsStartingWith = Array()
    687673      end if
    688674   else
    689       GetSubdirsStartingWithSorted = Array()
    690    end if
     675      GetSubdirsStartingWith = Array()
     676   end if
     677end function
     678
     679
     680''
     681' Returns a sorted array of subfolder names that starts with the given string.
     682function GetSubdirsStartingWithSorted(strFolder, strStartingWith)
     683   GetSubdirsStartingWithSorted = ArraySortStrings(GetSubdirsStartingWith(strFolder, strStartingWith))
     684end function
     685
     686
     687''
     688' Returns a reverse sorted array of subfolder names that starts with the given string.
     689function GetSubdirsStartingWithRSorted(strFolder, strStartingWith)
     690   GetSubdirsStartingWithRSorted = ArrayRSortStrings(GetSubdirsStartingWith(strFolder, strStartingWith))
    691691end function
    692692
     
    11811181   EnvPrint "set KBUILD_TARGET_ARCH=" & g_strTargetArch
    11821182
     1183   ' Windows variant of the arch name.
     1184   g_strTargetArchWin = g_strTargetArch
     1185   if g_strTargetArchWin = "amd64" then g_strTargetArchWin = "x64"
     1186
    11831187   str = EnvGetFirst("KBUILD_TARGET_CPU", "BUILD_TARGET_CPU")
    11841188    ' perhaps a bit pedantic this since this isn't clearly define nor used much...
     
    12141218   EnvPrint "set KBUILD_HOST_ARCH=" & str
    12151219   g_strHostArch = str
     1220
     1221   ' Windows variant of the arch name.
     1222   g_strHostArchWin = g_strHostArch
     1223   if g_strHostArchWin = "amd64" then g_strHostArchWin = "x64"
     1224
    12161225
    12171226   str = EnvGetFirst("KBUILD_HOST_CPU", "BUILD_PLATFORM_CPU")
     
    13861395         then
    13871396            LogPrint " => seems okay. new layout."
    1388             if g_strHostArch = "amd64" then
    1389                m_blnFound = checkClExe(strPathVC & "/bin/HostX64/x64/cl.exe")
    1390             else
    1391                m_blnFound = checkClExe(strPathVC & "/bin/Host" & g_strHostArch & "/bin/" & g_strHostArch & "/cl.exe")
    1392             end if
     1397            m_blnFound = checkClExe(strPathVC & "/bin/Host" & g_strHostArchWin & "/bin/" & g_strHostArchWin & "/cl.exe")
    13931398            if m_blnFound then
    13941399               m_strPathVC = strPathVC
     
    16701675         g_strVerPSDK = "71"
    16711676         CheckForPlatformSDKSub = True
     1677      end if
     1678   end if
     1679end function
     1680
     1681
     1682''
     1683' Checks for a platform SDK that works with the compiler
     1684sub CheckForSDK10(strOptSDK10, strOptSDK10Version)
     1685   dim strPathSDK10, strSDK10Version, str
     1686   PrintHdr "Windows 10 SDK/WDK"
     1687   '' @todo implement strOptSDK10Version
     1688
     1689   '
     1690   ' Try find the Windows 10 kit.
     1691   '
     1692   strSDK10Version = ""
     1693   strPathSDK10 = CheckForSDK10Sub(strOptSDK10, strSDK10Version)
     1694   if strPathSDK10 = "" and g_blnInternalFirst = True  then strPathSDK10 = CheckForSDK10ToolsSub(strSDK10Version)
     1695   if strPathSDK10 = "" then
     1696      str = RegGetString("HKLM\SOFTWARE\Microsoft\Windows Kits\Installed Roots\KitsRoot10")
     1697      strPathSDK10 = CheckForSDK10Sub(str, strSDK10Version)
     1698   end if
     1699   if strPathSDK10 = "" then
     1700      for each str in g_arrProgramFiles
     1701         strPathSDK10 = CheckForSDK10Sub(str & "/Windows Kits/10", strSDK10Version)
     1702         if strPathSDK10 <> "" then exit for
     1703      next
     1704   end if
     1705   if strPathSDK10 = "" and g_blnInternalFirst = False then strPathSDK10 = CheckForSDK10ToolsSub()
     1706
     1707   if strPathSDK10 = "" then
     1708      MsgError "Cannot find a suitable Windows 10 SDK.  Check configure.log and the build requirements."
     1709      exit sub
     1710   end if
     1711
     1712   '
     1713   ' Emit the config.
     1714   '
     1715   strPathSDK10 = UnixSlashes(PathAbs(strPathSDK10))
     1716   CfgPrint "PATH_SDK_WINSDK10     := " & strPathSDK10
     1717   CfgPrint "SDK_WINSDK10_VERSION  := " & strSDK10Version
     1718
     1719   PrintResult "Windows 10 SDK (" & strSDK10Version & ")", strPathSDK10
     1720   g_strPathSDK10 = strPathSDK10
     1721end sub
     1722
     1723''
     1724' Checks the tools directory.
     1725function CheckForSDK10ToolsSub(ByRef strSDK10Version)
     1726   dim arrToolsDirs, strToolsDir, arrDirs, strDir
     1727   CheckForSDK10ToolSub = ""
     1728   arrToolsDirs = Array(g_strPathDev & "/win." & g_strTargetArch & "/sdk", _
     1729                        g_strPathDev & "/win.x86/sdk", g_strPathDev & "/win.amd64/sdk")
     1730   for each strToolsDir in arrToolsDirs
     1731      arrDirs = GetSubdirsStartingWithRSorted(strToolsDir, "v10.")
     1732      for each strDir in arrDirs
     1733         CheckForSDK10ToolsSub = CheckForSDK10Sub(strToolsDir & "/" & strDir, strSDK10Version)
     1734         if CheckForSDK10ToolsSub <> "" then
     1735            exit function
     1736         end if
     1737      next
     1738   next
     1739
     1740end function
     1741
     1742''
     1743' Checks if the specified path points to a usable Windows 10 SDK/WDK.
     1744function CheckForSDK10Sub(strPathSDK10, ByRef strSDK10Version)
     1745   CheckForSDK10Sub = ""
     1746   if strPathSDK10 <> "" then
     1747      LogPrint "Trying: strPathSDK10=" & strPathSDK10
     1748      if LogDirExists(strPathSDK10) then
     1749         if   LogDirExists(strPathSDK10 & "/Bin") _
     1750          and LogDirExists(strPathSDK10 & "/Include") _
     1751          and LogDirExists(strPathSDK10 & "/Lib") _
     1752          and LogDirExists(strPathSDK10 & "/Redist") _
     1753         then
     1754            ' Only testing the highest one, for now. '' @todo incorporate strOptSDK10Version
     1755            dim arrVersions
     1756            arrVersions = GetSubdirsStartingWithSorted(strPathSDK10 & "/Include", "10.0.")
     1757            if UBound(arrVersions) >= 0 then
     1758               dim strVersion
     1759               strVersion = arrVersions(UBound(arrVersions))
     1760               LogPrint "Trying version: " & strVersion
     1761               if    LogFileExists(strPathSDK10, "include/" & strVersion & "/um/Windows.h") _
     1762                and  LogFileExists(strPathSDK10, "include/" & strVersion & "/ucrt/malloc.h") _
     1763                and  LogFileExists(strPathSDK10, "include/" & strVersion & "/ucrt/stdio.h") _
     1764                and  LogFileExists(strPathSDK10, "lib/" & strVersion & "/um/"   & g_strTargetArchWin & "/kernel32.lib") _
     1765                and  LogFileExists(strPathSDK10, "lib/" & strVersion & "/um/"   & g_strTargetArchWin & "/user32.lib") _
     1766                and  LogFileExists(strPathSDK10, "lib/" & strVersion & "/ucrt/" & g_strTargetArchWin & "/libucrt.lib") _
     1767                and  LogFileExists(strPathSDK10, "lib/" & strVersion & "/ucrt/" & g_strTargetArchWin & "/ucrt.lib") _
     1768                and  LogFileExists(strPathSDK10, "bin/" & strVersion & "/" & g_strHostArchWin & "/rc.exe") _
     1769                and  LogFileExists(strPathSDK10, "bin/" & strVersion & "/" & g_strHostArchWin & "/midl.exe") _
     1770               then
     1771                  '' @todo check minimum version (for WinHv).
     1772                  strSDK10Version  = strVersion
     1773                  CheckForSDK10Sub = strPathSDK10
     1774               end if
     1775            else
     1776               LogPrint "Found no 10.0.* subdirectories under '" & strPathSDK10 & "/Include'!"
     1777            end if
     1778         end if
    16721779      end if
    16731780   end if
     
    23312438   Print "  --with-DDK=PATH         Where the WDK is to be found."
    23322439   Print "  --with-SDK=PATH         Where the Windows SDK is to be found."
    2333    '' @todo Print "  --with-SDK10=PATH       Where the Windows 10 SDK is to be found."
     2440   Print "  --with-SDK10=PATH       Where the Windows 10 SDK/WDK is to be found."
    23342441   Print "  --with-VC=PATH          Where the Visual C++ compiler is to be found."
    23352442   Print "                          (Expecting bin, include and lib subdirs.)"
     
    23692476   strOptQt5Infix = ""
    23702477   strOptSDK = ""
     2478   strOptSDK10 = ""
     2479   strOptSDK10Version = ""
    23712480   strOptVC = ""
    23722481   strOptVCCommon = ""
     
    24152524         case "--with-sdk"
    24162525            strOptSDK = strPath
     2526         case "--with-sdk10"
     2527            strOptSDK10 = strPath
     2528         case "--with-sdk10-version"
     2529            strOptSDK10Version = strPath
    24172530         case "--with-vc"
    24182531            strOptVC = strPath
     
    25052618   CheckForVisualCPP    strOptVC, strOptVCCommon
    25062619   CheckForPlatformSDK  strOptSDK
     2620   CheckForSDK10        strOptSDK10, strOptSDK10Version
    25072621   CheckForMidl
    25082622   CfgPrint "VBOX_WITH_OPEN_WATCOM := " '' @todo look for openwatcom 1.9+
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette