xmake.lua 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. set_version("v1.0.1", {soname = "1"})
  2. add_rules("mode.debug", "mode.release")
  3. add_requires("xxhash")
  4. target("fast-lzma2")
  5. set_kind("$(kind)")
  6. add_files("*.c")
  7. add_headerfiles("fast-lzma2.h", "fl2_errors.h")
  8. add_packages("xxhash")
  9. if is_kind("shared") and is_plat("windows") then
  10. add_defines("FL2_DLL_EXPORT")
  11. add_defines("FL2_DLL_IMPORT", {interface = true})
  12. end
  13. if is_plat("linux", "bsd") then
  14. add_syslinks("pthread")
  15. end
  16. on_config(function (target)
  17. if not target:is_arch("x64", "x86_64") or is_host("bsd", "macosx") then
  18. return
  19. end
  20. target:add("defines", "LZMA2_DEC_OPT")
  21. if target:has_tool("cxx", "clang") then
  22. target:add("deps", "asm")
  23. else
  24. if target:is_plat("windows") then
  25. target:add("files", "*.asm")
  26. target:add("asflags", "-DMS_x64_CALL=1")
  27. else
  28. target:add("files", "*.S")
  29. target:add("asflags", "-DMS_x64_CALL=0")
  30. end
  31. end
  32. end)
  33. target_end()
  34. if is_arch("x64", "x86_64") and not is_host("bsd", "macosx") then
  35. -- workaround for clang toolchain
  36. target("asm")
  37. set_kind("object")
  38. if is_plat("windows") then
  39. add_files("*.asm")
  40. add_asflags("-DMS_x64_CALL=1")
  41. set_toolchains("msvc")
  42. else
  43. add_asflags("-DMS_x64_CALL=0")
  44. add_files("*.S")
  45. set_toolchains("gcc")
  46. end
  47. end