premake管理一个solution和多个project的目录树
前文premake基本配置详解只是介绍了基本的配置,一个solution包含一个project,且project没有自己的目录,生成的makefile也都在solution目录下。
但是实际工作中,显然需要更多:
1. 所有的project代码都应该放在自己的目录下
2. premake生成的makefile需要专门放在build目录下,和cmake类似
3. 最后编译出来的binary,应该放在output目录下
现在看一下示例工程,目录结构:
-- A solution contains projects, and defines the available configurationssolution ("solution1")configurations {"Release","Debug"}location "build"targetdir "output"-- A project defines one build targetp = project("hello1")basedir(p.name)location("build/" .. p.name)kind "ConsoleApp"language "C++"files { p.name .. "/*.h", p.name .. "/*.cpp" }includedirs {"/usr/include/x86_64-linux-gnu/c++/4.8"}configuration "Debug"defines { "DEBUG" }flags { "Symbols" }configuration "Release"defines { "NDEBUG" }flags { "Optimize" }-- A project defines one build targetp = project("hello2")basedir(p.name)location("build/" .. p.name)kind "ConsoleApp"language "C++"files { p.name .. "/*.h", p.name .. "/*.cpp" }includedirs {"/usr/include/x86_64-linux-gnu/c++/4.8"}configuration "Debug"defines { "DEBUG" }flags { "Symbols" }configuration "Release"defines { "NDEBUG" }flags { "Optimize" }