/ xmake.lua
xmake.lua
  1  add_rules("mode.debug", "mode.release")
  2  set_languages("c89")
  3  
  4  if is_plat("windows") then
  5      set_toolchains("msvc")
  6      add_cxxflags("/TC")
  7  elseif is_plat("macosx") then
  8      set_toolchains("clang")
  9      add_cxxflags("-x c")
 10  else 
 11      set_toolchains("gcc")
 12      add_cxxflags("-x c")
 13  end 
 14  
 15  target("test")
 16      set_kind("binary")
 17      add_files("src/Test/*.cpp")
 18  
 19  target("f1")
 20      set_kind("binary")
 21      add_files("src/Focused 1/*.cpp")
 22  
 23  target("f2")
 24      set_kind("binary")
 25      add_files("src/Focused 2/*.cpp")
 26      
 27  target("f3")
 28      set_kind("binary")
 29      add_files("src/Focused 3/*.cpp")
 30  
 31  target("f4")
 32      set_kind("binary")
 33      add_files("src/Focused 4/*.cpp")
 34  
 35  target("f5")
 36      set_kind("binary")
 37      add_files("src/Focused 5/*.cpp")
 38  
 39  target("f6")
 40      set_kind("binary")
 41      add_files("src/Focused 6/*.cpp")
 42  
 43  target("f7")
 44      set_kind("binary")
 45      add_files("src/Focused 7/*.cpp")
 46  
 47  target("f8")
 48      set_kind("binary")
 49      add_files("src/Focused 8/*.cpp")
 50  
 51  target("m1")
 52      set_kind("binary")
 53      add_files("src/Major 1/*.cpp")
 54  
 55  target("m2")
 56      set_kind("binary")
 57      add_files("src/Major 2/*.cpp")
 58  
 59  target("m3")
 60      set_kind("binary")
 61      add_files("src/Major 3/*.cpp")
 62  --
 63  -- If you want to known more usage about xmake, please see https://xmake.io
 64  --
 65  -- ## FAQ
 66  --
 67  -- You can enter the project directory firstly before building project.
 68  --
 69  --   $ cd projectdir
 70  --
 71  -- 1. How to build project?
 72  --
 73  --   $ xmake
 74  --
 75  -- 2. How to configure project?
 76  --
 77  --   $ xmake f -p [macosx|linux|iphoneos ..] -a [x86_64|i386|arm64 ..] -m [debug|release]
 78  --
 79  -- 3. Where is the build output directory?
 80  --
 81  --   The default output directory is `./build` and you can configure the output directory.
 82  --
 83  --   $ xmake f -o outputdir
 84  --   $ xmake
 85  --
 86  -- 4. How to run and debug target after building project?
 87  --
 88  --   $ xmake run [targetname]
 89  --   $ xmake run -d [targetname]
 90  --
 91  -- 5. How to install target to the system directory or other output directory?
 92  --
 93  --   $ xmake install
 94  --   $ xmake install -o installdir
 95  --
 96  -- 6. Add some frequently-used compilation flags in xmake.lua
 97  --
 98  -- @code
 99  --    -- add debug and release modes
100  --    add_rules("mode.debug", "mode.release")
101  --
102  --    -- add macro definition
103  --    add_defines("NDEBUG", "_GNU_SOURCE=1")
104  --
105  --    -- set warning all as error
106  --    set_warnings("all", "error")
107  --
108  --    -- set language: c99, c++11
109  --    set_languages("c99", "c++11")
110  --
111  --    -- set optimization: none, faster, fastest, smallest
112  --    set_optimize("fastest")
113  --
114  --    -- add include search directories
115  --    add_includedirs("/usr/include", "/usr/local/include")
116  --
117  --    -- add link libraries and search directories
118  --    add_links("tbox")
119  --    add_linkdirs("/usr/local/lib", "/usr/lib")
120  --
121  --    -- add system link libraries
122  --    add_syslinks("z", "pthread")
123  --
124  --    -- add compilation and link flags
125  --    add_cxflags("-stdnolib", "-fno-strict-aliasing")
126  --    add_ldflags("-L/usr/local/lib", "-lpthread", {force = true})
127  --
128  -- @endcode
129  --
130