add loguru, pegtl and utfcpp (#717)
* add loguru * add utfcpp * update icu4c * update vtk * fix loguru cross compilation * fix bsd build * add pegtlpull/719/head
parent
881f428229
commit
1e071114bf
6 changed files with 148 additions and 1 deletions
@ -0,0 +1,33 @@ |
||||
diff --git a/source/data/makedata.mak b/source/data/makedata.mak
|
||||
--- a/source/data/makedata.mak
|
||||
+++ b/source/data/makedata.mak
|
||||
@@ -33,7 +33,7 @@ ICU_LIB_TARGET=$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll
|
||||
!ENDIF
|
||||
!MESSAGE ICU data make path is $(ICUMAKE)
|
||||
|
||||
-!IF [py -3 -c "exit(0)"]!=0
|
||||
+!IF [python -c "exit(0)"]!=0
|
||||
!MESSAGE Information: Unable to find Python 3. Data will fail to build from source.
|
||||
!ENDIF
|
||||
|
||||
@@ -303,7 +303,7 @@
|
||||
$(COREDATA_TS):
|
||||
@cd "$(ICUSRCDATA)"
|
||||
set PYTHONPATH=$(ICUP)\source\python;%PYTHONPATH%
|
||||
- py -3 -B -m icutools.databuilder \
|
||||
+ python -B -m icutools.databuilder \
|
||||
--mode windows-exec \
|
||||
--src_dir "$(ICUSRCDATA)" \
|
||||
--tool_dir "$(ICUTOOLS)" \
|
||||
diff --git a/source/test/testdata/testdata.mak b/source/test/testdata/testdata.mak
|
||||
--- a/source/test/testdata/testdata.mak
|
||||
+++ b/source/test/testdata/testdata.mak
|
||||
@@ -35,7 +35,7 @@ CREATE_DIRS :
|
||||
"$(TESTDATAOUT)\testdata.dat" :
|
||||
@echo Building test data
|
||||
set PYTHONPATH=$(ICUP)\source\python;%PYTHONPATH%
|
||||
- py -3 -B -m icutools.databuilder \
|
||||
+ python -B -m icutools.databuilder \
|
||||
--mode windows-exec \
|
||||
--tool_dir "$(ICUTOOLS)" \
|
||||
--tool_cfg "$(CFG)" \
|
@ -0,0 +1,56 @@ |
||||
package("loguru") |
||||
|
||||
set_homepage("https://github.com/emilk/loguru") |
||||
set_description("A lightweight C++ logging library") |
||||
|
||||
add_urls("https://github.com/emilk/loguru/archive/refs/tags/$(version).tar.gz", |
||||
"https://github.com/emilk/loguru.git") |
||||
add_versions("v2.1.0", "1a3be62ebec5609af60b1e094109a93b7412198b896bb88f31dcfe4d95b79ce7") |
||||
|
||||
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) |
||||
add_configs("fmt", {description = "Use fmt to format the log.", default = false, type = "boolean"}) |
||||
|
||||
if is_plat("linux") then |
||||
add_syslinks("pthread", "dl") |
||||
elseif is_plat("bsd") then |
||||
add_syslinks("pthread", "dl", "execinfo") |
||||
end |
||||
on_load(function (package) |
||||
if package:config("fmt") then |
||||
package:add("deps", "fmt") |
||||
package:add("defines", "LOGURU_USE_FMTLIB") |
||||
end |
||||
end) |
||||
|
||||
on_install(function (package) |
||||
io.writefile("xmake.lua", [[ |
||||
add_rules("mode.debug", "mode.release") |
||||
set_languages("cxx11") |
||||
option("with_fmt", {default = false, showmenu = true}) |
||||
if has_config("with_fmt") then |
||||
add_requires("fmt") |
||||
end |
||||
target("loguru") |
||||
set_kind("static") |
||||
add_files("loguru.cpp") |
||||
add_headerfiles("loguru.hpp") |
||||
if is_plat("cross") then |
||||
add_defines("LOGURU_STACKTRACES=0") |
||||
end |
||||
if has_config("with_fmt") then |
||||
add_packages("fmt") |
||||
add_defines("LOGURU_USE_FMTLIB") |
||||
end |
||||
]]) |
||||
import("package.tools.xmake").install(package, {with_fmt = package:config("fmt")}) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
#include <loguru.hpp> |
||||
void test(int argc, char* argv[]) { |
||||
loguru::init(argc, argv); |
||||
LOG_F(INFO, "Hello from main.cpp!"); |
||||
} |
||||
]]}, {configs = {languages = "c++11"}})) |
||||
end) |
@ -0,0 +1,25 @@ |
||||
package("pegtl") |
||||
|
||||
set_kind("library", {headeronly = true}) |
||||
set_homepage("https://github.com/taocpp/PEGTL") |
||||
set_description("Parsing Expression Grammar Template Library") |
||||
set_license("BSL-1.0") |
||||
|
||||
add_urls("https://github.com/taocpp/PEGTL/archive/refs/tags/$(version).tar.gz", |
||||
"https://github.com/taocpp/PEGTL.git") |
||||
add_versions("3.2.2", "c6616275e78c618c016b79054eed0a0bdf4c1934f830d3ab33d3c3dac7320b03") |
||||
|
||||
add_deps("cmake") |
||||
on_install("windows", "macosx", "linux", "mingw", function (package) |
||||
import("package.tools.cmake").install(package, {"-DPEGTL_BUILD_TESTS=OFF", "-DPEGTL_BUILD_EXAMPLES=OFF"}) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
#include <tao/pegtl.hpp> |
||||
namespace pegtl = TAO_PEGTL_NAMESPACE; |
||||
void test(int argc, char *argv[]) { |
||||
pegtl::argv_input in(argv, 1); |
||||
} |
||||
]]}, {configs = {languages = "c++17"}})) |
||||
end) |
@ -0,0 +1,30 @@ |
||||
package("utfcpp") |
||||
|
||||
set_kind("library", {headeronly = true}) |
||||
set_homepage("https://github.com/nemtrif/utfcpp") |
||||
set_description("UTF8-CPP: UTF-8 with C++ in a Portable Way") |
||||
set_license("BSL-1.0") |
||||
|
||||
add_urls("https://github.com/nemtrif/utfcpp/archive/refs/tags/$(version).tar.gz", |
||||
"https://github.com/nemtrif/utfcpp.git") |
||||
add_versions("v3.2.1", "8d6aa7d77ad0abb35bb6139cb9a33597ac4c5b33da6a004ae42429b8598c9605") |
||||
|
||||
add_extsources("apt::libutfcpp-dev") |
||||
|
||||
add_deps("cmake") |
||||
on_install(function (package) |
||||
local configs = {"-DUTF8_TESTS=OFF", "-DUTF8_INSTALL=ON", "-DUTF8_SAMPLES=OFF"} |
||||
import("package.tools.cmake").install(package, configs) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
#define UTF_CPP_CPLUSPLUS 201103L |
||||
#include <utf8cpp/utf8.h> |
||||
void test() { |
||||
std::string line("你好,世界"); |
||||
std::u16string u16line = utf8::utf8to16(line); |
||||
std::string u8line = utf8::utf16to8(u16line); |
||||
} |
||||
]]}, {configs = {languages = "c++11"}})) |
||||
end) |
Loading…
Reference in new issue