xmake.lua 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package("fltk")
  2. set_homepage("https://www.fltk.org")
  3. set_description("Fast Light Toolkit")
  4. set_urls("https://github.com/fltk/fltk/archive/d7985607d6dd8308f104d84c778080731fa23c9a.zip")
  5. add_versions("1.4.0", "43d398ab068732cb1debd9a98d124e47c9da6f53cdf3e36f22868a54cca0c371")
  6. add_deps("cmake")
  7. if is_host("linux") then
  8. add_configs("pango", {description = "Use pango for font support", default = false, type = "boolean"})
  9. add_configs("xft", {description = "Use libXft for font support", default = false, type = "boolean"})
  10. end
  11. if is_plat("windows", "mingw") then
  12. add_syslinks("ws2_32", "comctl32", "gdi32", "oleaut32", "ole32", "uuid", "shell32", "advapi32", "comdlg32", "winspool", "user32", "kernel32", "odbc32")
  13. elseif is_plat("macosx") then
  14. add_frameworks("Cocoa")
  15. elseif is_plat("android") then
  16. add_syslinks("android")
  17. add_syslinks("dl")
  18. else
  19. add_syslinks("dl", "pthread")
  20. add_deps("libx11", "libxext", "libxinerama", "libxcursor", "libxrender", "libxfixes", "fontconfig")
  21. end
  22. on_load(function (package)
  23. if is_plat("linux") then
  24. if package:config("pango") then
  25. package:add("deps", "pango-1.0", "pangoxft-1.0", "gobject-2.0", "cairo", "pangocairo-1.0")
  26. end
  27. if package:config("xft") then
  28. package:add("deps", "libxft")
  29. end
  30. end
  31. end)
  32. on_install("macosx", "windows", "mingw", "linux", "android", function (package)
  33. local configs = {}
  34. table.insert(configs, "-DOPTION_BUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  35. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  36. table.insert(configs, "-DFLTK_BUILD_TEST=OFF")
  37. if package:is_plat("linux") then
  38. table.insert(configs, "-DOPTION_USE_SYSTEM_LIBPNG=OFF")
  39. table.insert(configs, "-DOPTION_USE_SYSTEM_ZLIB=OFF")
  40. table.insert(configs, "-DOPTION_USE_SYSTEM_LIBJPEG=OFF")
  41. if package:config("pango") then
  42. table.insert(configs, "-DOPTION_USE_PANGO=ON")
  43. else
  44. table.insert(configs, "-DOPTION_USE_PANGO=OFF")
  45. end
  46. if package:config("xft") then
  47. table.insert(configs, "-DOPTION_USE_XFT=ON")
  48. else
  49. table.insert(configs, "-DOPTION_USE_XFT=OFF")
  50. end
  51. end
  52. if package:is_plat("android") then
  53. table.insert(configs, "-DOPTION_USE_SYSTEM_LIBPNG=OFF")
  54. table.insert(configs, "-DOPTION_USE_SYSTEM_ZLIB=OFF")
  55. table.insert(configs, "-DOPTION_USE_SYSTEM_LIBJPEG=OFF")
  56. end
  57. import("package.tools.cmake").install(package, configs)
  58. end)
  59. on_test(function (package)
  60. assert(package:check_cxxsnippets({test = [[
  61. #include "FL/Fl.H"
  62. #include "FL/Fl_Window.H"
  63. void test() {
  64. Fl_Window *win = new Fl_Window(400, 300);
  65. }
  66. ]]}, {configs = {languages = "c++11"}}))
  67. end)