add exprtk and strtk (#786)

* add exprtk

* add strtk
pull/790/head
Hoildkv 3 years ago committed by GitHub
parent bda26ba384
commit 5f08baf542
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 36
      packages/e/exprtk/xmake.lua
  2. 26
      packages/s/strtk/xmake.lua

@ -0,0 +1,36 @@
package("exprtk")
set_kind("library", {headeronly = true})
set_homepage("https://www.partow.net/programming/exprtk/index.html")
set_description("C++ Mathematical Expression Parsing And Evaluation Library")
set_license("MIT")
add_urls("https://github.com/ArashPartow/exprtk.git")
add_versions("2021.06.06", "93a9f44f99b910bfe07cd1e933371e83cea3841c")
if is_plat("windows") then
add_cxxflags("/bigobj")
elseif is_plat("mingw") then
add_cxxflags("-Wa,-mbig-obj")
end
on_install(function (package)
os.cp("exprtk.hpp", package:installdir("include"))
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test() {
double x;
const std::string expression_string =
"clamp(-1.0,sin(2 * pi * x) + cos(x / 2 * pi),+1.0)";
exprtk::symbol_table<double> symbol_table;
exprtk::expression<double> expression;
exprtk::parser<double> parser;
symbol_table.add_variable("x",x);
symbol_table.add_constants();
expression.register_symbol_table(symbol_table);
parser.compile(expression_string,expression);
}
]]}, {configs = {languages = "c++14"}, includes = "exprtk.hpp"}))
end)

@ -0,0 +1,26 @@
package("strtk")
set_kind("library", {headeronly = true})
set_homepage("https://www.partow.net/programming/strtk/index.html")
set_description("C++ String Toolkit Library")
set_license("MIT")
add_urls("https://github.com/ArashPartow/strtk.git")
add_versions("2020.01.01", "d2b446bf1f7854e8b08f5295ec6f6852cae066a2")
on_install(function (package)
os.cp("strtk.hpp", package:installdir("include"))
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#define strtk_no_tr1_or_boost
#include <strtk.hpp>
void test() {
std::string s = "abc|123|xyz|789";
strtk::single_delimiter_predicate<std::string::value_type> predicate('|');
strtk::std_string::tokenizer<>::type tokenizer(s,predicate);
strtk::std_string::tokenizer<>::type::iterator itr = tokenizer.begin();
}
]]}, {configs = {languages = "c++14"}}))
end)
Loading…
Cancel
Save