diff options
| author | ruki <[email protected]> | 2016-06-02 09:01:27 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-06-02 09:01:27 +0800 |
| commit | 5c4e11744a8c181be6f96048f94289dbdc8df38b (patch) | |
| tree | 147dff66c555b08e24d38bcd4a3173429bb71119 /xmake/plugins/doxygen/main.lua | |
| parent | effb1055c467886ad873c01ee67167008e39ee9b (diff) | |
modify project version and name for doxygen
Diffstat (limited to 'xmake/plugins/doxygen/main.lua')
| -rwxr-xr-x | xmake/plugins/doxygen/main.lua | 97 |
1 files changed, 65 insertions, 32 deletions
diff --git a/xmake/plugins/doxygen/main.lua b/xmake/plugins/doxygen/main.lua index 72af8124e..5ac2f1ae4 100755 --- a/xmake/plugins/doxygen/main.lua +++ b/xmake/plugins/doxygen/main.lua @@ -23,6 +23,8 @@ -- imports import("core.base.option") import("core.tool.tool") +import("core.project.config") +import("core.project.project") -- main function main() @@ -33,51 +35,82 @@ function main() end) assert(doxygen, "doxygen not found!") - -- generate doxyfile first if not exists - local doxyfile = option.get("doxyfile") - if not os.isfile(doxyfile) then + -- generate doxyfile first + local doxyfile = path.join(os.tmpdir(), "doxyfile") - -- generate the default doxyfile - os.run("%s -g %s", doxygen, doxyfile) + -- generate the default doxyfile + os.run("%s -g %s", doxygen, doxyfile) - -- enable recursive - -- - -- RECURSIVE = YES - -- - io.gsub(doxyfile, "RECURSIVE%s-=%s-NO", "RECURSIVE = YES") + -- load configure + config.load() - -- set the source directory - -- - -- INPUT = xxx - -- - local srcdir = option.get("srcdir") - if srcdir and os.isdir(srcdir) then - io.gsub(doxyfile, "INPUT%s-=.-\n", format("INPUT = %s\n", srcdir)) - end + -- load project + project.load() - -- set the output directory - -- - -- HTML_OUTPUT = html - -- LATEX_OUTPUT = latex - -- - local outputdir = option.get("outputdir") - if outputdir then + -- enable recursive + -- + -- RECURSIVE = YES + -- + io.gsub(doxyfile, "RECURSIVE%s-=%s-NO", "RECURSIVE = YES") - -- update the doxyfile - io.gsub(doxyfile, "HTML_OUTPUT%s-=.-\n", format("HTML_OUTPUT = %s/html\n", outputdir)) - io.gsub(doxyfile, "LATEX_OUTPUT%s-=.-\n", format("LATEX_OUTPUT = %s/latex\n", outputdir)) + -- set the source directory + -- + -- INPUT = xxx + -- + local srcdir = option.get("srcdir") + if srcdir and os.isdir(srcdir) then + io.gsub(doxyfile, "INPUT%s-=.-\n", format("INPUT = %s\n", srcdir)) + end + + -- set the output directory + -- + -- OUTPUT_DIRECTORY = + -- + local outputdir = option.get("outputdir") or config.get("buildir") or "build" + if outputdir then + + -- update the doxyfile + io.gsub(doxyfile, "OUTPUT_DIRECTORY%s-=.-\n", format("OUTPUT_DIRECTORY = %s\n", outputdir)) + + -- ensure the output directory + os.mkdir(outputdir) + end - -- ensure the output directory - os.mkdir(outputdir) - end + -- set the project version + -- + -- PROJECT_NUMBER = + -- + local version = project.version() + if version then + io.gsub(doxyfile, "PROJECT_NUMBER%s-=.-\n", format("PROJECT_NUMBER = %s\n", version)) + end + + -- set the project name + -- + -- PROJECT_NAME = + -- + local name = project.name() + if name then + io.gsub(doxyfile, "PROJECT_NAME%s-=.-\n", format("PROJECT_NAME = %s\n", name)) end -- check assert(os.isfile(doxyfile), "%s not found!", doxyfile) + -- enter the project directory + os.cd(project.directory()) + -- generate document - os.run("%s %s", doxygen, doxyfile) + if option.get("verbose") then + os.exec("%s %s", doxygen, doxyfile) + else + os.run("%s %s", doxygen, doxyfile) + end + + -- leave the project directory + os.cd("-") -- trace + print("result: %s/html/index.html", outputdir) print("doxygen ok!") end |
