diff options
| author | ruki <[email protected]> | 2018-02-06 00:49:12 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-02-05 22:55:15 +0800 |
| commit | d38a8d50bb1ea28d203b70617e5ba18eef1d9924 (patch) | |
| tree | 6db714264037a3da9debbc202ed7f4e0cec5f508 /xmake/core/project/template.lua | |
| parent | f544576e010e2d37defa0592a7b5b919375bd2c3 (diff) | |
add FAQ to auto-generated xmake.lua
Diffstat (limited to 'xmake/core/project/template.lua')
| -rw-r--r-- | xmake/core/project/template.lua | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/xmake/core/project/template.lua b/xmake/core/project/template.lua index c4339d4c3..e72209523 100644 --- a/xmake/core/project/template.lua +++ b/xmake/core/project/template.lua @@ -275,9 +275,86 @@ function template.create(language, templateid, targetname) end end + -- append FAQ to xmake.lua + local projectfile = path.join(projectdir, "xmake.lua") + if os.isfile(projectfile) then + local file = io.open("xmake.lua", "a+") + if file then + file:print(template.faq()) + file:close() + end + end + -- ok return true end +-- get FAQ +function template.faq() + return [[ +-- FAQ +-- +-- You can enter the project directory firstly before building project. +-- +-- $ cd projectdir +-- +-- 1. How to build project? +-- +-- $ xmake +-- +-- 2. How to configure project? +-- +-- $ xmake f -p [macosx|linux|iphoneos ..] -a [x86_64|i386|arm64 ..] -m [debug|release] +-- +-- 3. Where is the build output directory? +-- +-- The default output directory is `./build` and you can configure the output directory. +-- +-- $ xmake f -o outputdir +-- $ xmake +-- +-- 4. How to run and debug target after building project? +-- +-- $ xmake run [targetname] +-- $ xmake run -d [targetname] +-- +-- 5. How to install target to the system directory or other output directory? +-- +-- $ xmake install +-- $ xmake install -o installdir +-- +-- 6. Add some frequently-used compilation flags in xmake.lua +-- +-- @code +-- -- add macro defination +-- add_defines("NDEBUG", "_GNU_SOURCE=1") +-- +-- -- set warning all as error +-- set_warnings("all", "error") +-- +-- -- set language: c99, c++11 +-- set_languages("c99", "cxx11") +-- +-- -- set optimization: none, faster, fastest, smallest +-- set_optimize("fastest") +-- +-- -- add include search directories +-- add_includedirs("/usr/include", "/usr/local/include") +-- +-- -- add link libraries and search directories +-- add_links("tbox", "z", "pthread") +-- add_linkdirs("/usr/local/lib", "/usr/lib") +-- +-- -- add compilation and link flags +-- add_cxflags("-stdnolib", "-fno-strict-aliasing") +-- add_ldflags("-L/usr/local/lib", "-lpthread", {force = true}) +-- +-- @endcode +-- +-- 7. If you want to known more usage about xmake, please see http://xmake.io/#/home +-- + ]] +end + -- return module: template return template |
