xmake.lua 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. option("tools", {default = false})
  2. add_rules("mode.release", "mode.debug", "jxrlib")
  3. add_includedirs(
  4. "common/include",
  5. "image/sys",
  6. "jxrgluelib",
  7. "jxrtestlib"
  8. )
  9. add_headerfiles("common/include/*.h", "image/sys/windowsmediaphoto.h", {prefixdir = "jxrlib"})
  10. target("jpegxr")
  11. set_kind("$(kind)")
  12. add_files("image/**.c")
  13. if is_plat("windows") and is_kind("shared") then
  14. add_rules("utils.symbols.export_all")
  15. end
  16. target("jxrglue")
  17. set_kind("$(kind)")
  18. add_files("jxrgluelib/*.c", "jxrtestlib/*.c")
  19. if is_plat("windows") and is_kind("shared") then
  20. add_rules("utils.symbols.export_all")
  21. end
  22. add_deps("jpegxr")
  23. add_headerfiles(
  24. "jxrgluelib/JXRGlue.h",
  25. "jxrgluelib/JXRMeta.h",
  26. "jxrtestlib/JXRTest.h", {prefixdir = "jxrlib"}
  27. )
  28. target("JxrEncApp")
  29. add_rules("tools")
  30. add_files("jxrencoderdecoder/JxrEncApp.c")
  31. target("JxrDecApp")
  32. add_rules("tools")
  33. add_files("jxrencoderdecoder/JxrDecApp.c")
  34. rule("jxrlib")
  35. on_config(function (target)
  36. target:add("defines", "DISABLE_PERF_MEASUREMENT")
  37. if target:is_plat("windows", "mingw", "msys") then
  38. target:add("defines", "WIN32")
  39. else
  40. target:add("defines", "__ANSI__")
  41. end
  42. if target:check_bigendian() then
  43. target:add("defines", "_BIG__ENDIAN_")
  44. end
  45. if not target:has_tool("cxx", "cl") then
  46. target:add("cxflags",
  47. "-Wno-error=implicit-function-declaration",
  48. "-Wno-endif-labels",
  49. -- https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types
  50. "-Wno-incompatible-pointer-types"
  51. )
  52. end
  53. end)
  54. rule("tools")
  55. on_load(function (target)
  56. if not get_config("tools") then
  57. target:set("enabled", false)
  58. return
  59. end
  60. target:add("kind", "binary")
  61. target:add("deps", "jxrglue")
  62. end)