]> gitweb.ps.run Git - toc/blob - xmake.lua
add antlr source code and ReadMe
[toc] / xmake.lua
1 add_rules("mode.debug", "mode.release")\r
2 \r
3 target("main")\r
4     set_kind("binary")\r
5     add_files("src/main.cpp")\r
6     add_files("gen/*.cpp")\r
7     add_linkdirs(\r
8         "antlr4-cpp-runtime-4.9.2-source/install/lib"\r
9     )\r
10     add_links("antlr4-runtime")\r
11     add_includedirs(\r
12         "gen",\r
13         "antlr4-cpp-runtime-4.9.2-source/install/include/antlr4-runtime/"\r
14     )\r
15     set_languages("c++20")\r
16 \r
17 \r
18 -- java -jar antlr-4.9.2-complete.jar -Dlanguage=Cpp -no-listener -o gen Toc.g4\r
19 \r
20 --\r
21 -- If you want to known more usage about xmake, please see https://xmake.io\r
22 --\r
23 -- ## FAQ\r
24 --\r
25 -- You can enter the project directory firstly before building project.\r
26 --\r
27 --   $ cd projectdir\r
28 --\r
29 -- 1. How to build project?\r
30 --\r
31 --   $ xmake\r
32 --\r
33 -- 2. How to configure project?\r
34 --\r
35 --   $ xmake f -p [macosx|linux|iphoneos ..] -a [x86_64|i386|arm64 ..] -m [debug|release]\r
36 --\r
37 -- 3. Where is the build output directory?\r
38 --\r
39 --   The default output directory is `./build` and you can configure the output directory.\r
40 --\r
41 --   $ xmake f -o outputdir\r
42 --   $ xmake\r
43 --\r
44 -- 4. How to run and debug target after building project?\r
45 --\r
46 --   $ xmake run [targetname]\r
47 --   $ xmake run -d [targetname]\r
48 --\r
49 -- 5. How to install target to the system directory or other output directory?\r
50 --\r
51 --   $ xmake install\r
52 --   $ xmake install -o installdir\r
53 --\r
54 -- 6. Add some frequently-used compilation flags in xmake.lua\r
55 --\r
56 -- @code\r
57 --    -- add debug and release modes\r
58 --    add_rules("mode.debug", "mode.release")\r
59 --\r
60 --    -- add macro defination\r
61 --    add_defines("NDEBUG", "_GNU_SOURCE=1")\r
62 --\r
63 --    -- set warning all as error\r
64 --    set_warnings("all", "error")\r
65 --\r
66 --    -- set language: c99, c++11\r
67 --    set_languages("c99", "c++11")\r
68 --\r
69 --    -- set optimization: none, faster, fastest, smallest\r
70 --    set_optimize("fastest")\r
71 --\r
72 --    -- add include search directories\r
73 --    add_includedirs("/usr/include", "/usr/local/include")\r
74 --\r
75 --    -- add link libraries and search directories\r
76 --    add_links("tbox")\r
77 --    add_linkdirs("/usr/local/lib", "/usr/lib")\r
78 --\r
79 --    -- add system link libraries\r
80 --    add_syslinks("z", "pthread")\r
81 --\r
82 --    -- add compilation and link flags\r
83 --    add_cxflags("-stdnolib", "-fno-strict-aliasing")\r
84 --    add_ldflags("-L/usr/local/lib", "-lpthread", {force = true})\r
85 --\r
86 -- @endcode\r
87 --\r
88 \r