1 add_rules("mode.debug", "mode.release")
\r
5 add_files("src/main.cpp")
\r
6 add_files("gen/*.cpp")
\r
8 "antlr4-cpp-runtime-4.9.2-source/install/lib"
\r
10 add_links("antlr4-runtime")
\r
13 "antlr4-cpp-runtime-4.9.2-source/install/include/antlr4-runtime/"
\r
15 set_languages("c++20")
\r
18 -- java -jar antlr-4.9.2-complete.jar -Dlanguage=Cpp -no-listener -o gen Toc.g4
\r
21 -- If you want to known more usage about xmake, please see https://xmake.io
\r
25 -- You can enter the project directory firstly before building project.
\r
29 -- 1. How to build project?
\r
33 -- 2. How to configure project?
\r
35 -- $ xmake f -p [macosx|linux|iphoneos ..] -a [x86_64|i386|arm64 ..] -m [debug|release]
\r
37 -- 3. Where is the build output directory?
\r
39 -- The default output directory is `./build` and you can configure the output directory.
\r
41 -- $ xmake f -o outputdir
\r
44 -- 4. How to run and debug target after building project?
\r
46 -- $ xmake run [targetname]
\r
47 -- $ xmake run -d [targetname]
\r
49 -- 5. How to install target to the system directory or other output directory?
\r
52 -- $ xmake install -o installdir
\r
54 -- 6. Add some frequently-used compilation flags in xmake.lua
\r
57 -- -- add debug and release modes
\r
58 -- add_rules("mode.debug", "mode.release")
\r
60 -- -- add macro defination
\r
61 -- add_defines("NDEBUG", "_GNU_SOURCE=1")
\r
63 -- -- set warning all as error
\r
64 -- set_warnings("all", "error")
\r
66 -- -- set language: c99, c++11
\r
67 -- set_languages("c99", "c++11")
\r
69 -- -- set optimization: none, faster, fastest, smallest
\r
70 -- set_optimize("fastest")
\r
72 -- -- add include search directories
\r
73 -- add_includedirs("/usr/include", "/usr/local/include")
\r
75 -- -- add link libraries and search directories
\r
76 -- add_links("tbox")
\r
77 -- add_linkdirs("/usr/local/lib", "/usr/lib")
\r
79 -- -- add system link libraries
\r
80 -- add_syslinks("z", "pthread")
\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