driver cross-compilation
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "tier1/interface.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier2/fileformats/ini.h"
|
||||
#include "winerunner.h"
|
||||
|
||||
class CMSVCLinker : public ILinker
|
||||
{
|
||||
@@ -41,6 +42,9 @@ CUtlString CMSVCLinker::Link( LinkProject_t *pProject )
|
||||
case ELINK_DYNAMIC_LIBRARY:
|
||||
szFileName = CUtlString("%s.dll", pProject->m_szName.GetString());
|
||||
break;
|
||||
case ELINK_KERNEL_DRIVER:
|
||||
szFileName = CUtlString("%s.sys", pProject->m_szName.GetString());
|
||||
break;
|
||||
}
|
||||
|
||||
CUtlString szTarget = pProject->m_target.GetTriplet();
|
||||
@@ -50,13 +54,13 @@ CUtlString CMSVCLinker::Link( LinkProject_t *pProject )
|
||||
filesystem2->MakeDirectory(szOutputDir);
|
||||
|
||||
if (!g_pConfig)
|
||||
Plat_FatalErrorFunc(".fpccfg was not found");
|
||||
Plat_FatalErrorFunc(".fpccfg was not found\n");
|
||||
IINISection *pSection = g_pConfig->GetSection("MSVC_LINKER_INTERFACE_NAME");
|
||||
if (!pSection)
|
||||
Plat_FatalErrorFunc("MSVC_LINKER_INTERFACE_NAME was not found in .fpccfg");
|
||||
Plat_FatalErrorFunc("MSVC_LINKER_INTERFACE_NAME was not found in .fpccfg\n");
|
||||
CUtlString szExePath = pSection->GetStringValue("exe");
|
||||
if (!pSection)
|
||||
Plat_FatalErrorFunc("exe was not found in MSVC_LINKER_INTERFACE_NAME");
|
||||
Plat_FatalErrorFunc("exe was not found in MSVC_LINKER_INTERFACE_NAME\n");
|
||||
|
||||
if (pProject->linkType == ELINK_STATIC_LIBRARY)
|
||||
{
|
||||
@@ -106,16 +110,26 @@ CUtlString CMSVCLinker::Link( LinkProject_t *pProject )
|
||||
{
|
||||
szCompiledTarget = CUtlString("%s%u", szTarget.GetString(), pProject->m_androidmanifest.m_nTargetVersion);
|
||||
}
|
||||
|
||||
args = {
|
||||
"-o",
|
||||
szOutputFile,
|
||||
"-target",
|
||||
szCompiledTarget,
|
||||
"/nologo"
|
||||
};
|
||||
|
||||
const char *szWindowsPath = GetWindowsPath(szOutputFile);
|
||||
args.AppendTail(CUtlString("/out:%s", szWindowsPath));
|
||||
V_free((void*)szWindowsPath);
|
||||
|
||||
if (pProject->linkType == ELINK_KERNEL_DRIVER)
|
||||
{
|
||||
args.AppendTail("/driver");
|
||||
args.AppendTail(CUtlString("/entry:\"%s\"", pProject->szEntry));
|
||||
args.AppendTail(CUtlString("/entry:%s", pProject->szEntry));
|
||||
}
|
||||
switch (pProject->m_eWindowsSubsystem)
|
||||
{
|
||||
case WINDOWS_SUBSYSTEM_NATIVE:
|
||||
args.AppendTail("/subsystem:native");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Disable stdlib
|
||||
@@ -134,9 +148,19 @@ CUtlString CMSVCLinker::Link( LinkProject_t *pProject )
|
||||
*/
|
||||
}
|
||||
|
||||
runner->Run(szExePath, args);
|
||||
runner->Wait();
|
||||
winerunner->Run(szExePath, args);
|
||||
winerunner->Wait();
|
||||
}
|
||||
compiled:
|
||||
return szOutputFile;
|
||||
};
|
||||
|
||||
bool CMSVCLinker::IsLibraryExists( CUtlString szName )
|
||||
{
|
||||
szName = CUtlString("%s.dll", szName.GetString());
|
||||
void *pLib = Plat_LoadLibrary(szName.GetString());
|
||||
if (!pLib)
|
||||
return false;
|
||||
Plat_UnloadLibrary(pLib);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user