package An official xmake package repository https://xrepo.xmake.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.9 KiB

6 years ago
package("nana")
set_homepage("http://nanapro.org")
set_description("A modern C++ GUI library.")
add_urls("https://github.com/cnjinhao/nana/archive/v$(version).tar.gz",
"https://github.com/cnjinhao/nana.git")
add_versions("1.6.2", "5f5cb791dff292e27bfa29d850b93f809a0d91d6044ea7e22ce7ae76a5d8b24e")
add_versions("1.7.2", "e2efb3b7619e4ef3b6de93f8afc70ff477ec6cabf4f9740f0d786904c790613f")
4 years ago
add_versions("1.7.4", "56f7b1ed006c750fccf8ef15ab1e83f96751f2dfdcb68d93e5f712a6c9b58bcb")
if is_plat("linux") then
add_patches("1.7.4", path.join(os.scriptdir(), "patches", "1.7.4", "u8string_fix.patch"), "c783588816664124ba3b4077e18696899c8389419a015773b5bfe988e3a73f6a")
end
6 years ago
add_configs("nana_filesystem_force", {description = "Force nana filesystem over ISO and boost?", default = is_plat("linux"), type = "boolean"})
5 years ago
if is_plat("linux", "windows") then
add_deps("cmake >=3.12")
5 years ago
end
5 years ago
if is_plat("windows") then
4 years ago
add_syslinks("ole32", "shell32", "kernel32", "user32", "gdi32", "winspool", "comdlg32", "advapi32")
add_defines("_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING")
elseif is_plat("linux") then
add_deps("libxcursor")
add_syslinks("pthread", "fontconfig", "Xft")
5 years ago
end
add_links("nana")
5 years ago
on_load("linux", "windows", function (package)
if package:config("nana_filesystem_force") then
package:add("defines", "NANA_FILESYSTEM_FORCE")
end
end)
5 years ago
on_install("linux", "windows", function (package)
if package:is_plat("windows") then
4 years ago
local file_name = path.join(os.curdir(), "source", "system", "split_string.cpp")
io.gsub(file_name, " and ", " && ")
end
local configs = {"-DNANA_CMAKE_ENABLE_JPEG=OFF", "-DNANA_CMAKE_ENABLE_PNG=OFF", "-DBUILD_SHARED_LIBS=OFF"}
if package:config("nana_filesystem_force") then
5 years ago
table.insert(configs, "-DNANA_CMAKE_NANA_FILESYSTEM_FORCE=ON")
end
import("package.tools.cmake").build(package, configs, {buildir = "build_xmake"})
4 years ago
os.cp("include", package:installdir())
if package:is_plat("windows") then
os.trycp(path.join("build_xmake", "src", "*", "*.lib"), package:installdir("lib"))
else
os.trycp(path.join("build_xmake", "*.a"), package:installdir("lib"))
end
end)
6 years ago
on_test(function (package)
6 years ago
assert(package:check_cxxsnippets({test = [[
5 years ago
#include <nana/gui.hpp>
#include <nana/gui/widgets/form.hpp>
#include <nana/gui/widgets/label.hpp>
6 years ago
using namespace nana;
5 years ago
void test() {
form fm;
label lb(fm, rectangle(fm.size()));
lb.caption("Hello, World");
fm.show();
exec();
}
5 years ago
]]}, {configs = {languages = "c++11"}}))
6 years ago
end)