From bad5bec3f435ea56495f850c33aa21df9e432d3f Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Thu, 6 Apr 2023 05:20:58 -0500 Subject: [PATCH] [simpleini] Add package (#1971) * [simpleini] Add package * [simpleini] Add `convertutf` dependency * [simpleini] Add `convert` config * [simpleini] Tweaks --- packages/s/simpleini/xmake.lua | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 packages/s/simpleini/xmake.lua diff --git a/packages/s/simpleini/xmake.lua b/packages/s/simpleini/xmake.lua new file mode 100644 index 000000000..2525fd5b9 --- /dev/null +++ b/packages/s/simpleini/xmake.lua @@ -0,0 +1,45 @@ +package("simpleini") + set_kind("library", {headeronly = true}) + set_homepage("https://github.com/brofield/simpleini") + set_description("Cross-platform C++ library providing a simple API to read and write INI-style configuration files.") + set_license("MIT") + + set_urls("https://github.com/brofield/simpleini/archive/refs/tags/$(version).tar.gz", + "https://github.com/brofield/simpleini.git") + add_versions("v4.19", "dc10df3fa363be2c57627d52cbb1b5ddd0689d474bf13908e822c1522df8377e") + + add_configs("convert", {description = "Unicode converter to use.", type = "string", values = {"none", "generic", "icu", "win32"}}) + + on_load(function (package) + if package:config("convert") == nil then + if package:is_plat("windows") then + package:config_set("convert", "win32") + else + package:config_set("convert", "generic") + end + end + if package:config("convert") == "none" then + package:add("define", "SI_NO_CONVERSION") + elseif package:config("convert") == "generic" then + package:add("define", "SI_CONVERT_GENERIC") + package:add("deps", "convertutf") + elseif package:config("convert") == "icu" then + package:add("define", "SI_CONVERT_ICU") + package:add("deps", "icu4c") + elseif package:config("convert") == "win32" then + package:add("define", "SI_CONVERT_WIN32") + end + end) + + on_install(function (package) + os.cp("SimpleIni.h", package:installdir("include")) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + void test() { + CSimpleIniA ini; + ini.SetUnicode(); + } + ]]}, {configs = {languages = "c++11"}, includes = "SimpleIni.h"})) + end)