我正在尝试将premake 5集成到我的项目中,但是它不包含cpp文件,如果我在IDE中手动添加它们,则可以正常编译。
我试图删除pch并将cppdialect移至filter "system:windows"
,没有任何结果,但是有时premake 5会挂起,如果我重新运行它,它将生成项目文件。
workspace "Fusion"
architecture "x64"
startproject "Sandbox"
configurations
{
"Debug",
"Release",
"Dist"
}
outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
-- Include directories relative to root folder (solution directory)
IncludeDir = {}
IncludeDir["GLFW"] = "Fusion/vendor/GLFW/include"
IncludeDir["SpdLog"] = "Fusion/vendor/spdlog/include"
group "Dependencies"
include "Fusion/vendor/GLFW"
group ""
project "Fusion"
location "Fusion"
kind "SharedLib"
language "C++"
staticruntime "Off"
targetdir("bin/" .. outputdir .. "/%{prj.name}")
objdir("bin-int/" .. outputdir .. "/%{prj.name}")
files
{
"%{prj.name}/src/**.h",
"%{prj.name]/src/**.cpp"
}
includedirs
{
"%{prj.name}/src",
"%{IncludeDir.SpdLog}",
"%{IncludeDir.GLFW}"
}
links
{
"GLFW",
"opengl32.lib"
}
filter "system:windows"
cppdialect "C++17"
systemversion "latest"
defines
{
"F_PLATFORM_WINDOWS",
"F_BUILD_DLL",
"GLFW_INCLUDE_NONE"
}
postbuildcommands
{
("{COPY} %{cfg.buildtarget.relpath} \"../bin/" .. outputdir .. "/Sandbox/\"")
}
filter "configurations:Debug"
defines "F_DEBUG"
runtime "Debug"
symbols "On"
filter "configurations:Release"
defines "F_RELEASE"
runtime "Release"
optimize "On"
filter "configurations:Dist"
defines "F_DIST"
runtime "Release"
optimize "On"
project "Sandbox"
location "Sandbox"
kind "ConsoleApp"
language "C++"
staticruntime "Off"
targetdir("bin/" .. outputdir .. "/%{prj.name}")
objdir("bin/" .. outputdir .. "/%{prj.name}")
files
{
"%{prj.name}/src/**.h",
"%{prj.name}/src/**.cpp"
}
includedirs
{
"%{IncludeDir.SpdLog}",
"Fusion/src",
"Fusion/vendor"
}
links
{
"Fusion"
}
filter "system:windows"
cppdialect "C++17"
systemversion "latest"
defines
{
"F_PLATFORM_WINDOWS"
}
filter "configurations:Debug"
defines "F_DEBUG"
runtime "Debug"
symbols "On"
filter "configurations:Release"
defines "F_RELEASE"
runtime "Release"
optimize "On"
filter "configurations:Dist"
defines "F_DIST"
runtime "Release"
optimize "On"
我除了预制5可以正常制造。 Premake 5 Windows二进制文件可从官方网站this中获取。构建新生成的项目文件时的错误消息是:LNK1104 cannot open file "<path>/<project>.lib"
。出于您的兴趣,我已经知道解决方法,但是当项目很大时,这对我没有帮助。解决方法是将cpp文件添加到项目中。哪个会变得乏味。