我有 2 个预制文件 1 用于我的渲染器,一个用于我的引擎,但是当我通过命令
premake5 vs2022
生成 vs2022 解决方案时,尝试构建所述解决方案给我带来了
我想知道为什么会发生这种行为,因为在命令行上构建(使用 gmake)工作得很好,并且能够在 VS 中构建将大大提高调试效率
这是前面提到的解决方案文件
workspace "Wrenderer"
configurations { "Debug", "Release"}
project "Wrenderer"
language "C"
targetname "Wrenderer"
architecture "x64"
kind "StaticLib"
outputdir = "%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}"
toolset "clang"
cdialect "C99"
targetdir("%{wks.location}/Binaries/" .. outputdir .. "/%{prj.name}")
objdir("%{wks.location}/Binaries/Intermediates/" .. outputdir .. "/%{prj.name}")
files { "include/**.h", "src/**.c" }
libdirs { "./libs/" }
includedirs { "./include/" }
includedirs { "./include/libs/" }
includedirs { os.getenv("VULKAN_SDK") .. "/Include" }
buildoptions { "-Wextra -Wall" }
links { "vulkan-1", "glfw3" }
removefiles { "test/**.**" }
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter ""
filter "configurations:Release"
optimize "On"
filter ""
filter "system:windows"
links { "user32", "msvcrt", "gdi32", "shell32", "libcmt" }
defines { "VK_USE_PLATFORM_WIN32_KHR" }
filter ""
filter "system:linux"
defines { "VK_USE_PLATFORM_XLIB_KHR" }
filter ""
filter "action:gmake"
prebuildcommands {
"mkdir -p" .. " %[%{wks.location}/Binaries/]",
"mkdir -p" .. " %[%{wks.location}/Binaries/Intermediates/]",
"mkdir -p" .. " %[%{wks.location}/Binaries/" .. outputdir .. "]",
"mkdir -p" .. " %[%{wks.location}/Binaries/Intermediates/" .. outputdir .. "]",
}
filter ""
filter "not action:gmake"
prebuildcommands {
"{MKDIR}" .. " %[%{wks.location}/Binaries/]",
"{MKDIR}" .. " %[%{wks.location}/Binaries/Intermediates/]",
"{MKDIR} %[%{wks.location}/Binaries/" .. outputdir .. "]",
"{MKDIR} %[%{wks.location}/Binaries/Intermediates/" .. outputdir .. "]",
}
filter ""
project "WrenTest"
architecture "x64"
kind "ConsoleApp"
language "C"
files { "**.h", "test/**.c" }
outputdir = "%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}"
toolset "clang"
cdialect "C99"
targetdir("%{wks.location}/Binaries/" .. outputdir .. "/%{prj.name}")
objdir("%{wks.location}/Binaries/Intermediates/" .. outputdir .. "/%{prj.name}")
libdirs { "./libs/" }
includedirs { "./include/" }
includedirs { "./include/libs/" }
includedirs { os.getenv("VULKAN_SDK") .. "/Include" }
links { "Wrenderer" }
buildoptions { "-Wextra -Wall" }
links { "vulkan-1", "glfw3" }
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
sanitize { "Address", "Fuzzer" }
filter ""
filter "configurations:Release"
optimize "On"
filter ""
filter "system:windows"
links { "user32", "msvcrt", "gdi32", "shell32", "libcmt" }
defines { "VK_USE_PLATFORM_WIN32_KHR" }
filter ""
filter "system:linux"
defines { "VK_USE_PLATFORM_XLIB_KHR" }
filter ""
newaction {
trigger = "clean",
description = "clean the software",
execute = function ()
print("Cleaning")
os.rmdir("./Binaries")
os.remove("./Lib/*.lib")
os.remove("*.make")
os.remove("Makefile")
os.remove("*.vcxproj")
os.remove("*.vcxproj.filters")
os.remove("*.vcxproj.user")
os.remove("*.sln")
print("done.")
end
}
还有发动机的
workspace "Wrenderer"
project "Wrengine"
language "C"
targetname "Wrengine"
architecture "x64"
outputdir = "%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}"
kind "ConsoleApp"
toolset "clang"
cdialect "C99"
targetdir("%{wks.location}/Binaries/" .. outputdir .. "/%{prj.name}")
objdir("%{wks.location}/Binaries/Intermediates/" .. outputdir .. "/%{prj.name}")
files { "include/**.h", "src/**.c" }
libdirs { "./libs/" }
includedirs { "./include/" }
includedirs { "./Wrenderer/include/" }
includedirs { "./include/libs/" }
includedirs { os.getenv("VULKAN_SDK") .. "/Include" }
libdirs { os.getenv("VULKAN_SDK") .. "/Lib" }
buildoptions { "-Wextra -Wall" }
links { "vulkan-1", "glfw3" }
links { "Wrenderer" }
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
sanitize {"Address"}
filter ""
filter "configurations:Release"
optimize "On"
filter ""
filter "system:windows"
links { "user32", "msvcrt", "gdi32", "shell32", "libcmt" }
defines { "VK_USE_PLATFORM_WIN32_KHR" }
filter ""
filter "system:linux"
defines { "VK_USE_PLATFORM_XLIB_KHR" }
filter ""
filter "action:gmake"
filter ""
prebuildcommands {
"compileShaders.bat"
}
include "Wrenderer/premake5.lua"
从我一直在搞乱的情况看来,它似乎试图在其上强制使用 msvc c 标准,这可能会导致问题,但仍然回避我
答案就是忍住并切换到 msvc 来获取 vs2022 配置文件
workspace "Wrenderer"
configurations { "Debug", "Release"}
project "Wrenderer"
language "C"
targetname "Wrenderer"
architecture "x64"
kind "StaticLib"
outputdir = "%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}"
cdialect "C99"
targetdir("%{wks.location}/Binaries/" .. outputdir .. "/%{prj.name}")
objdir("%{wks.location}/Binaries/Intermediates/" .. outputdir .. "/%{prj.name}")
files { "include/**.h", "src/**.c" }
libdirs { "./libs/" }
includedirs { "./include/" }
includedirs { "./include/libs/" }
includedirs { os.getenv("VULKAN_SDK") .. "/Include" }
links { "vulkan-1", "glfw3" }
removefiles { "test/**.**" }
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter ""
filter "configurations:Release"
optimize "On"
filter ""
filter "system:windows"
defines { "VK_USE_PLATFORM_WIN32_KHR" }
filter ""
filter "system:linux"
defines { "VK_USE_PLATFORM_XLIB_KHR" }
filter ""
filter "action:gmake"
prebuildcommands {
"mkdir -p" .. " %[%{wks.location}/Binaries/]",
"mkdir -p" .. " %[%{wks.location}/Binaries/Intermediates/]",
"mkdir -p" .. " %[%{wks.location}/Binaries/" .. outputdir .. "]",
"mkdir -p" .. " %[%{wks.location}/Binaries/Intermediates/" .. outputdir .. "]",
}
filter "not action:gmake"
prebuildcommands {
"{MKDIR}" .. " %[%{wks.location}/Binaries/]",
"{MKDIR}" .. " %[%{wks.location}/Binaries/Intermediates/]",
"{MKDIR} %[%{wks.location}/Binaries/" .. outputdir .. "]",
"{MKDIR} %[%{wks.location}/Binaries/Intermediates/" .. outputdir .. "]",
}
filter ""
filter "action:gmake"
toolset "clang"
buildoptions {"-Wextra", "-Wall"}
filter "not action:gmake"
toolset "msc"
filter""
project "WrenTest"
architecture "x64"
kind "ConsoleApp"
language "C"
files { "**.h", "test/**.c" }
outputdir = "%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}"
cdialect "C99"
targetdir("%{wks.location}/Binaries/" .. outputdir .. "/%{prj.name}")
objdir("%{wks.location}/Binaries/Intermediates/" .. outputdir .. "/%{prj.name}")
libdirs { "./libs/" }
includedirs { "./include/" }
includedirs { "./include/libs/" }
includedirs { os.getenv("VULKAN_SDK") .. "/Include" }
links { "Wrenderer" }
links { "vulkan-1", "glfw3" }
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter ""
filter "configurations:Release"
optimize "On"
filter ""
filter "system:windows"
defines { "VK_USE_PLATFORM_WIN32_KHR" }
filter ""
filter "system:linux"
defines { "VK_USE_PLATFORM_XLIB_KHR" }
filter ""
filter "action:gmake"
toolset "clang"
buildoptions {"-Wextra", "-Wall"}
links { "user32", "msvcrt", "gdi32", "shell32", "libcmt" }
filter "not action:gmake"
toolset "msc"
filter ""
newaction {
trigger = "clean",
description = "clean the software",
execute = function ()
print("Cleaning")
os.rmdir("./Binaries")
os.remove("./Lib/*.lib")
os.remove("*.make")
os.remove("Makefile")
os.remove("*.vcxproj")
os.remove("*.vcxproj.filters")
os.remove("*.vcxproj.user")
os.remove("*.sln")
print("done.")
end
}
workspace "Wrenderer"
project "Wrengine"
language "C"
targetname "Wrengine"
architecture "x64"
outputdir = "%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}"
kind "ConsoleApp"
cdialect "C99"
targetdir("%{wks.location}/Binaries/" .. outputdir .. "/%{prj.name}")
objdir("%{wks.location}/Binaries/Intermediates/" .. outputdir .. "/%{prj.name}")
files { "include/**.h", "src/**.c" }
libdirs { "./libs/" }
includedirs { "./include/" }
includedirs { "./Wrenderer/include/" }
includedirs { "./include/libs/" }
includedirs { os.getenv("VULKAN_SDK") .. "/Include" }
libdirs { os.getenv("VULKAN_SDK") .. "/Lib" }
links { "vulkan-1", "glfw3" }
links { "Wrenderer" }
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter ""
filter "configurations:Release"
optimize "On"
filter ""
filter "system:windows"
defines { "VK_USE_PLATFORM_WIN32_KHR" }
filter ""
filter "system:linux"
defines { "VK_USE_PLATFORM_XLIB_KHR" }
filter ""
prebuildcommands {
"compileShaders.bat"
}
filter "action:gmake"
toolset "clang"
links { "user32", "msvcrt", "gdi32", "shell32", "libcmt" }
buildoptions {"-Wextra", "-Wall"}
filter "not action:gmake"
toolset "msc"
filter ""
include "Wrenderer/premake5.lua"