mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 09:04:38 +00:00
Append ' DLL' to DLL filename to improve VS link times.
This commit is contained in:
parent
feec36731e
commit
ec78e4d502
3 changed files with 36 additions and 16 deletions
|
|
@ -32,29 +32,49 @@ extern "C"
|
||||||
int (*torque_winmain)( HINSTANCE hInstance, HINSTANCE h, LPSTR lpszCmdLine, int nShow) = NULL;
|
int (*torque_winmain)( HINSTANCE hInstance, HINSTANCE h, LPSTR lpszCmdLine, int nShow) = NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool getDllName(std::wstring& dllName)
|
bool getDllName(std::wstring& dllName, const std::wstring suffix)
|
||||||
{
|
{
|
||||||
wchar_t filenameBuf[MAX_PATH];
|
wchar_t filenameBuf[MAX_PATH];
|
||||||
DWORD length = GetModuleFileNameW( NULL, filenameBuf, MAX_PATH );
|
DWORD length = GetModuleFileNameW( NULL, filenameBuf, MAX_PATH );
|
||||||
if(length == 0) return false;
|
if(length == 0) return false;
|
||||||
dllName = std::wstring(filenameBuf);
|
dllName = std::wstring(filenameBuf);
|
||||||
size_t dotPos = dllName.find_last_of(L".");
|
size_t dotPos = dllName.find_last_of(L".");
|
||||||
if(dotPos == std::wstring::npos) return false;
|
if(dotPos == std::wstring::npos)
|
||||||
|
{
|
||||||
|
dllName.clear();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
dllName.erase(dotPos);
|
dllName.erase(dotPos);
|
||||||
dllName += L".dll";
|
dllName += suffix + L".dll";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCommandShow)
|
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCommandShow)
|
||||||
{
|
{
|
||||||
|
// Try to find the game DLL, which may have one of several file names.
|
||||||
|
HMODULE hGame = NULL;
|
||||||
std::wstring dllName = std::wstring();
|
std::wstring dllName = std::wstring();
|
||||||
if(!getDllName(dllName))
|
// The file name is the same as this executable's name, plus a suffix.
|
||||||
|
const std::wstring dllSuffices[] = {L"", L" DLL"};
|
||||||
|
const unsigned int numSuffices = sizeof(dllSuffices) / sizeof(std::wstring);
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < numSuffices; i++)
|
||||||
|
{
|
||||||
|
// Attempt to glue the suffix onto the current filename.
|
||||||
|
if(!getDllName(dllName, dllSuffices[i]))
|
||||||
|
continue;
|
||||||
|
// Load the DLL at that address.
|
||||||
|
hGame = LoadLibraryW(dllName.c_str());
|
||||||
|
if (hGame)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!dllName.length())
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL, L"Unable to find game dll", L"Error", MB_OK|MB_ICONWARNING);
|
MessageBoxW(NULL, L"Unable to find game dll", L"Error", MB_OK|MB_ICONWARNING);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
HMODULE hGame = LoadLibraryW(dllName.c_str());
|
|
||||||
if (!hGame)
|
if (!hGame)
|
||||||
{
|
{
|
||||||
wchar_t error[4096];
|
wchar_t error[4096];
|
||||||
|
|
|
||||||
|
|
@ -50,15 +50,15 @@
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">{$projectOffset}../../{$gameFolder}/</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">{$projectOffset}../../{$gameFolder}/</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName)/$(ProjectName)/</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName)/$(ProjectName)/</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">{$projOutName}_DEBUG</TargetName>
|
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">{$projOutName}_DEBUG DLL</TargetName>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">{$projectOffset}../../{$gameFolder}/</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">{$projectOffset}../../{$gameFolder}/</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName)/$(ProjectName)/</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName)/$(ProjectName)/</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">false</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">false</LinkIncremental>
|
||||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">{$projOutName}_OPTIMIZEDDEBUG</TargetName>
|
<TargetName Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">{$projOutName}_OPTIMIZEDDEBUG DLL</TargetName>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">{$projectOffset}../../{$gameFolder}/</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">{$projectOffset}../../{$gameFolder}/</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName)/$(ProjectName)/</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName)/$(ProjectName)/</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">{$projOutName}</TargetName>
|
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">{$projOutName} DLL</TargetName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<Midl>
|
<Midl>
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>{foreach item=def from=$projLibsDebug}{$def};{/foreach}%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>{foreach item=def from=$projLibsDebug}{$def};{/foreach}%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<OutputFile>$(OutDir){$projOutName}_DEBUG.dll</OutputFile>
|
<OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<AdditionalLibraryDirectories>{foreach item=def from=$projLibDirs}{$def};{/foreach}{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName);$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>{foreach item=def from=$projLibDirs}{$def};{/foreach}{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName);$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;{foreach item=def from=$projLibsIgnore}{$def};{/foreach}%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;{foreach item=def from=$projLibsIgnore}{$def};{/foreach}%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||||
|
|
@ -148,7 +148,7 @@
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>{foreach item=def from=$projLibsDebug}{$def};{/foreach}%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>{foreach item=def from=$projLibsDebug}{$def};{/foreach}%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<OutputFile>$(OutDir){$projOutName}_OPTIMIZEDDEBUG.dll</OutputFile>
|
<OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<AdditionalLibraryDirectories>{foreach item=def from=$projLibDirs}{$def};{/foreach}{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>{foreach item=def from=$projLibDirs}{$def};{/foreach}{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;{foreach item=def from=$projLibsIgnore}{$def};{/foreach}%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;{foreach item=def from=$projLibsIgnore}{$def};{/foreach}%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||||
|
|
@ -200,7 +200,7 @@
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>{foreach item=def from=$projLibs}{$def};{/foreach}%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>{foreach item=def from=$projLibs}{$def};{/foreach}%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<OutputFile>$(OutDir){$projOutName}.dll</OutputFile>
|
<OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<AdditionalLibraryDirectories>{foreach item=def from=$projLibDirs}{$def};{/foreach}{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName);$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>{foreach item=def from=$projLibDirs}{$def};{/foreach}{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName);$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;{foreach item=def from=$projLibsIgnore}{$def};{/foreach}%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;{foreach item=def from=$projLibsIgnore}{$def};{/foreach}%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||||
|
|
|
||||||
|
|
@ -81,9 +81,9 @@
|
||||||
AdditionalDependencies="{foreach item=def from=$projLibsDebug}{$def} {/foreach}"
|
AdditionalDependencies="{foreach item=def from=$projLibsDebug}{$def} {/foreach}"
|
||||||
|
|
||||||
{if $uniformOutputFile eq 1}
|
{if $uniformOutputFile eq 1}
|
||||||
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName}.dll"
|
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName} DLL.dll"
|
||||||
{else}
|
{else}
|
||||||
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName}_DEBUG.dll"
|
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName}_DEBUG DLL.dll"
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
|
|
@ -191,9 +191,9 @@
|
||||||
AdditionalDependencies="{foreach item=def from=$projLibsDebug}{$def} {/foreach}"
|
AdditionalDependencies="{foreach item=def from=$projLibsDebug}{$def} {/foreach}"
|
||||||
|
|
||||||
{if $uniformOutputFile eq 1}
|
{if $uniformOutputFile eq 1}
|
||||||
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName}.dll"
|
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName} DLL.dll"
|
||||||
{else}
|
{else}
|
||||||
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName}_OPTIMIZEDDEBUG.dll"
|
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName}_OPTIMIZEDDEBUG DLL.dll"
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
|
|
@ -299,7 +299,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="{foreach item=def from=$projLibs}{$def} {/foreach}"
|
AdditionalDependencies="{foreach item=def from=$projLibs}{$def} {/foreach}"
|
||||||
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName}.dll"
|
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName} DLL.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="true"
|
SuppressStartupBanner="true"
|
||||||
AdditionalLibraryDirectories="{foreach item=def from=$projLibDirs}{$def};{/foreach}{$projectOffset}../Link/VC2k8.$(ConfigurationName).$(PlatformName);"
|
AdditionalLibraryDirectories="{foreach item=def from=$projLibDirs}{$def};{/foreach}{$projectOffset}../Link/VC2k8.$(ConfigurationName).$(PlatformName);"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue