xmake.lua 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. option("tools", {default = false})
  2. add_rules("mode.debug", "mode.release")
  3. if is_plat("windows") and has_config("tools") then
  4. add_requires("strings_h")
  5. end
  6. if is_plat("macosx") or (is_host("macosx") and is_plat("mingw")) then
  7. -- Fixes duplicate symbols
  8. set_languages("gnu89")
  9. end
  10. add_includedirs("include")
  11. set_configdir("include")
  12. add_configfiles("config.h.in")
  13. includes("@builtin/check")
  14. -- set_configvar("ATTRIBUTE_ALIGNED_MAX", 4)
  15. configvar_check_cfuncs("HAVE_BUILTIN_EXPECT", "__builtin_expect")
  16. -- configvar_check_cincludes("HAVE_DLFCN_H", "dlfcn.h")
  17. configvar_check_cfuncs("HAVE_FTIME", "ftime", {includes = "time.h"})
  18. configvar_check_cfuncs("HAVE_GETTIMEOFDAY", "gettimeofday", {includes = "time.h"})
  19. configvar_check_cincludes("HAVE_INTTYPES_H", "inttypes.h")
  20. configvar_check_cincludes("HAVE_IO_H", "io.h")
  21. configvar_check_cfuncs("HAVE_MEMALIGN", "memalign", {includes = "stdlib.h"})
  22. -- configvar_check_cincludes("HAVE_MEMORY_H", "memory.h")
  23. -- configvar_check_cincludes("HAVE_STDINT_H", "stdint.h")
  24. -- configvar_check_cincludes("HAVE_STDLIB_H", "stdlib.h")
  25. -- configvar_check_cincludes("HAVE_STRINGS_H", "strings.h")
  26. configvar_check_cincludes("HAVE_STRING_H", "string.h")
  27. configvar_check_cincludes("HAVE_STRUCT_TIMEVAL", ".h")
  28. -- configvar_check_cincludes("HAVE_SYS_STAT_H", "sys/stat.h")
  29. configvar_check_cincludes("HAVE_SYS_TIMEB_H", "sys/timeb.h")
  30. configvar_check_cincludes("HAVE_SYS_TIME_H", "sys/time.h")
  31. -- configvar_check_cincludes("HAVE_SYS_TYPES_H", "sys/types.h")
  32. configvar_check_cincludes("HAVE_TIME_H", "time.h")
  33. -- configvar_check_cincludes("HAVE_UNISTD_H", "unistd.h")
  34. configvar_check_cincludes("LIBA52_DJBFFT", "fftc4.h")
  35. -- set_configvar("LIBA52_DOUBLE", "1")
  36. -- set_configvar("LIBA52_FIXED", "1")
  37. -- set_configvar("LIBAO_AL", "1")
  38. if is_plat("linux") then
  39. set_configvar("LIBAO_OSS", "1")
  40. end
  41. if is_plat("windows", "mingw", "msys", "cygwin") then
  42. set_configvar("LIBAO_WIN", 1)
  43. end
  44. target("a52")
  45. set_kind("$(kind)")
  46. add_files("liba52/*.c", "libao/*.c")
  47. add_headerfiles(
  48. "include/a52.h",
  49. "include/attributes.h",
  50. "include/audio_out.h",
  51. "include/mm_accel.h",
  52. "liba52/a52_internal.h", {prefixdir = "a52dec"}
  53. )
  54. if is_plat("windows", "mingw") then
  55. add_syslinks("winmm")
  56. elseif is_plat("linux", "bsd") then
  57. add_syslinks("m")
  58. end
  59. if is_plat("windows") and is_kind("shared") then
  60. add_rules("utils.symbols.export_all")
  61. end
  62. rule("tools")
  63. on_load(function (target)
  64. if not get_config("tools") then
  65. target:set("enabled", false)
  66. return
  67. end
  68. target:add("kind", "binary")
  69. target:add("files", "src/getopt.c")
  70. target:add("includedirs", "src")
  71. target:add("deps", "a52")
  72. if target:is_plat("windows") then
  73. target:add("packages", "strings_h")
  74. end
  75. end)
  76. target("a52dec")
  77. add_rules("tools")
  78. add_files("src/a52dec.c", "src/gettimeofday.c")
  79. target("extract_a52")
  80. add_rules("tools")
  81. add_files("src/extract_a52.c")