From e7a196e58fcf4b0f89cfe0e6e85cdf9acb7d5ced Mon Sep 17 00:00:00 2001 From: Mohammed Alyousef Date: Thu, 26 Nov 2020 13:46:04 +0300 Subject: [PATCH] Create xmake.lua for fltk (#158) * Create xmake.lua for fltk * fix option_shared_libs * fix framework Cocoa for macos * Update xmake.lua * fix android builds * try fix for linux * add libuuid which is needed by fontconfig * remove libuuid * Update xmake.lua * move configs outside, build image libs only on linux --- packages/f/fltk/xmake.lua | 73 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 packages/f/fltk/xmake.lua diff --git a/packages/f/fltk/xmake.lua b/packages/f/fltk/xmake.lua new file mode 100644 index 000000000..509a5d43a --- /dev/null +++ b/packages/f/fltk/xmake.lua @@ -0,0 +1,73 @@ +package("fltk") + + set_homepage("https://www.fltk.org") + set_description("Fast Light Toolkit") + set_urls("https://github.com/fltk/fltk/archive/d7985607d6dd8308f104d84c778080731fa23c9a.zip") + add_versions("1.4.0", "43d398ab068732cb1debd9a98d124e47c9da6f53cdf3e36f22868a54cca0c371") + add_deps("cmake") + + if is_host("linux") then + add_configs("pango", {description = "Use pango for font support", default = false, type = "boolean"}) + add_configs("xft", {description = "Use libXft for font support", default = false, type = "boolean"}) + end + + if is_plat("windows", "mingw") then + add_syslinks("ws2_32", "comctl32", "gdi32", "oleaut32", "ole32", "uuid", "shell32", "advapi32", "comdlg32", "winspool", "user32", "kernel32", "odbc32") + elseif is_plat("macosx") then + add_frameworks("Cocoa") + elseif is_plat("android") then + add_syslinks("android") + add_syslinks("dl") + else + add_syslinks("dl", "pthread") + add_deps("libx11", "libxext", "libxinerama", "libxcursor", "libxrender", "libxfixes", "fontconfig") + end + + on_load(function (package) + if is_plat("linux") then + if package:config("pango") then + package:add("deps", "pango-1.0", "pangoxft-1.0", "gobject-2.0", "cairo", "pangocairo-1.0") + end + if package:config("xft") then + package:add("deps", "libxft") + end + end + end) + + on_install("macosx", "windows", "mingw", "linux", "android", function (package) + local configs = {} + table.insert(configs, "-DOPTION_BUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) + table.insert(configs, "-DFLTK_BUILD_TEST=OFF") + if package:is_plat("linux") then + table.insert(configs, "-DOPTION_USE_SYSTEM_LIBPNG=OFF") + table.insert(configs, "-DOPTION_USE_SYSTEM_ZLIB=OFF") + table.insert(configs, "-DOPTION_USE_SYSTEM_LIBJPEG=OFF") + if package:config("pango") then + table.insert(configs, "-DOPTION_USE_PANGO=ON") + else + table.insert(configs, "-DOPTION_USE_PANGO=OFF") + end + if package:config("xft") then + table.insert(configs, "-DOPTION_USE_XFT=ON") + else + table.insert(configs, "-DOPTION_USE_XFT=OFF") + end + end + if package:is_plat("android") then + table.insert(configs, "-DOPTION_USE_SYSTEM_LIBPNG=OFF") + table.insert(configs, "-DOPTION_USE_SYSTEM_ZLIB=OFF") + table.insert(configs, "-DOPTION_USE_SYSTEM_LIBJPEG=OFF") + end + import("package.tools.cmake").install(package, configs) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include "FL/Fl.H" + #include "FL/Fl_Window.H" + void test() { + Fl_Window *win = new Fl_Window(400, 300); + } + ]]}, {configs = {languages = "c++11"}})) + end)