我正在使用Premake5来构建C Visual Studio 2019应用程序引擎。我需要弄清楚为什么在使用Premake5构建项目后它不起作用。
我试图将体系结构更改为x64,但它坚持CFG.System是X86_64。
workspace "Engine_Autry"
architecture "x64"
configurations
{
"Debug",
"Release",
"Dist"
}
outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
project "Engine"
location "Engine"
kind "SharedLib"
language "C++"
targetdir ("bin/" .. outputdir .. "/%{prj.nam}")
objdir ("bin-int/" .. outputdir .. "/%{prj.nam}")
files
{
"%{prj.name}/src/**.h",
"%{prj.name}/src/**.cpp"
}
includedirs
{
"%{prj.name}/vendor/spdlog/include"
}
filter "system:windows"
cppdialect "C++17"
staticruntime "On"
systemversion "latest"
defines
{
"APP_PLATFORM_WINDOWS",
"APP_BUILD_DLL"
}
postbuildcommands
{
{"{COPY} %{cfg.buildtarget.relpath} ../bin/" .. outputdir .. "/Sandbox"}
}
filter "configurations:Debug"
defines "APP_DEBUG"
symbols "On"
filter "configurations:Release"
defines "APP_RELEASE"
optimize "On"
filter "configurations:Dist"
defines "APP_DIST"
optimize "On"
project "Sandbox"
location "Sandbox"
kind "ConsoleApp"
language "C++"
targetdir ("bin/" .. outputdir .. "/%{prj.nam}")
objdir ("bin-int/" .. outputdir .. "/%{prj.nam}")
files
{
"%{prj.name}/src/**.h",
"%{prj.name}/src/**.cpp"
}
includedirs
{
"Engine/vendor/spdlog/include",
"Engine/src"
}
links
{
"Engine"
}
filter "system:windows"
cppdialect "C++17"
staticruntime "On"
systemversion "latest"
defines
{
"APP_PLATFORM_WINDOWS"
}
filter "configurations:Debug"
defines "APP_DEBUG"
symbols "On"
filter "configurations:Release"
defines "APP_RELEASE"
optimize "On"
filter "configurations:Dist"
defines "APP_DIST"
optimize "On"
它在我使用Premake5构建引擎之前正在工作。
Error MSB3073 The command "IF EXIST ..binDebug-windows-x86_64Engine.dll (xcopy /Q /E /Y /I ..binDebug-windows-x86_64Engine.dll ..binDebug-windows-x86_64Sandbox > nul) ELSE (xcopy /Q /Y /I ..binDebug-windows-x86_64Engine.dll ..binDebug-windows-x86_64Sandbox > nul)
:VCEnd" exited with code 2. Engine C:Program Files (x86)Microsoft Visual Studio2019CommunityMSBuildMicrosoftVCv160Microsoft.CppCommon.targets 138
我遵循Thecherno的教程时也有相同的问题。
有两个问题引起了这个问题:
- 在我的后构建命令中,目录不正确。在您的情况下,目录是正确的。
- 将沙箱设置为启动项目。我认为您在重建和重新装载Visual Studio后忘了这样做。
尝试一下,让我知道。