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
17 -- If you want to known more usage about xmake, please see https://xmake.io
\r
21 -- You can enter the project directory firstly before building project.
\r
25 -- 1. How to build project?
\r
29 -- 2. How to configure project?
\r
31 -- $ xmake f -p [macosx|linux|iphoneos ..] -a [x86_64|i386|arm64 ..] -m [debug|release]
\r
33 -- 3. Where is the build output directory?
\r
35 -- The default output directory is `./build` and you can configure the output directory.
\r
37 -- $ xmake f -o outputdir
\r
40 -- 4. How to run and debug target after building project?
\r
42 -- $ xmake run [targetname]
\r
43 -- $ xmake run -d [targetname]
\r
45 -- 5. How to install target to the system directory or other output directory?
\r
48 -- $ xmake install -o installdir
\r
50 -- 6. Add some frequently-used compilation flags in xmake.lua
\r
53 -- -- add debug and release modes
\r
54 -- add_rules("mode.debug", "mode.release")
\r
56 -- -- add macro defination
\r
57 -- add_defines("NDEBUG", "_GNU_SOURCE=1")
\r
59 -- -- set warning all as error
\r
60 -- set_warnings("all", "error")
\r
62 -- -- set language: c99, c++11
\r
63 -- set_languages("c99", "c++11")
\r
65 -- -- set optimization: none, faster, fastest, smallest
\r
66 -- set_optimize("fastest")
\r
68 -- -- add include search directories
\r
69 -- add_includedirs("/usr/include", "/usr/local/include")
\r
71 -- -- add link libraries and search directories
\r
72 -- add_links("tbox")
\r
73 -- add_linkdirs("/usr/local/lib", "/usr/lib")
\r
75 -- -- add system link libraries
\r
76 -- add_syslinks("z", "pthread")
\r
78 -- -- add compilation and link flags
\r
79 -- add_cxflags("-stdnolib", "-fno-strict-aliasing")
\r
80 -- add_ldflags("-L/usr/local/lib", "-lpthread", {force = true})
\r