我正在使用最新的 premake 5 alpha 生成 Visual Studio 项目,我的项目结构如下所示:
root
----include
--------Core
------------Window
----------------Window.h
----src
--------Core
------------Window
----------------Window.cpp
----project
--------Core
------------Core.vcxproj
--------Engine.sln
----premake5.lua
预制脚本:
solution "Engine"
configurations { "Debug", "Release" }
includedirs {
"external/include",
"include"
}
filter "configurations:Debug"
defines { "DEBUG" }
flags { "Symbols" }
targetname "%{prj.name}_D"
filter "configurations:Release"
defines { "NDEBUG" }
optimize "on"
targetname "%{prj.name}_R"
project "Engine-Core"
kind "StaticLib"
language "C++"
files {
"include/Core/**.h",
"src/Core/**.h",
"src/Core/**.cpp"
}
includedirs {
"include/Core/"
}
targetdir "lib"
location "project/Core"
我已经设置了我的 premake 脚本,以便使用 location 函数在我的根目录的项目文件夹中生成项目文件。我使用了includedirs 函数在我的根文件夹中添加了include 文件夹。我已将其指定为相对于 premake 脚本。当我在 Visual Studio 中查看项目中的包含目录时,这些目录相对于生成项目的文件夹。在这种情况下,它将是“....\include”。最终发生的是,如果我尝试将 Window.h 文件包含在 Window.cpp 文件中,则无法找到它。
如果我直接在根文件夹中生成解决方案和项目文件,我可以让一切正常工作。如果可能的话,我想避免这种情况。
有没有办法修改我的脚本,以便我可以在嵌套文件夹结构中组织我的源代码,同时在 Visual Studio 的单独文件夹中生成我的项目文件?
谢谢!