Improve quickcpplib (#1656)

* Improve quickcpplib

Convert quickcpplib to XMake

* Fix test on clang

* Use io.writefile instead of a file

* Fix test on clang

* Add missing header files
pull/1658/head
Arthur Laurent 2 years ago committed by GitHub
parent 7973dcb9ab
commit d672209cf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 27
      packages/q/quickcpplib/xmake.lua

@ -7,29 +7,26 @@ package("quickcpplib")
add_urls("https://github.com/ned14/quickcpplib.git") add_urls("https://github.com/ned14/quickcpplib.git")
add_versions("20221116", "52163d5a198f1d0a2583e683f090778686f9f998") add_versions("20221116", "52163d5a198f1d0a2583e683f090778686f9f998")
add_configs("header_only", {description = "Use header only version. (not supported atm)", default = false, type = "boolean", readonly = true})
add_deps("cmake")
on_install(function (package) on_install(function (package)
local configs = {"-DPROJECT_IS_DEPENDENCY=ON"} io.writefile("xmake.lua", [[
io.replace("CMakeLists.txt", "include(QuickCppLibMakeStandardTests)", "", {plain = true}) target("quickcpplib")
io.replace("CMakeLists.txt", "include(QuickCppLibMakeDoxygen)", "", {plain = true}) set_kind("headeronly")
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) add_headerfiles("include/(quickcpplib/**.hpp)")
local target = "quickcpplib_" add_headerfiles("include/(quickcpplib/**.h)")
if package:config("header_only") then add_headerfiles("include/(quickcpplib/**.ixx)")
target = target .. "hl" add_headerfiles("include/(quickcpplib/**.ipp)")
else add_includedirs("include")
target = target .. (package:config("shared") and "_dl" or "_sl") ]])
end import("package.tools.xmake").install(package)
import("package.tools.cmake").install(package, configs, { target = target })
end) end)
on_test(function (package) on_test(function (package)
local cxxflags = package:has_tool("cxx", "clang", "clangxx") and {"-fsized-deallocation"} or {}
assert(package:check_cxxsnippets({test = [[ assert(package:check_cxxsnippets({test = [[
#include <quickcpplib/uint128.hpp> #include <quickcpplib/uint128.hpp>
void test () { void test () {
auto bar = QUICKCPPLIB_NAMESPACE::integers128::uint128{}; auto bar = QUICKCPPLIB_NAMESPACE::integers128::uint128{};
} }
]]}, {configs = {languages = "c++17"}})) ]]}, {configs = {languages = "c++17", cxxflags = cxxflags}}))
end) end)

Loading…
Cancel
Save