xmake.lua 1.9 KB

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