xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031
  1. package("fixed-containers")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/teslamotors/fixed-containers")
  4. set_description("C++ Fixed Containers")
  5. set_license("MIT")
  6. add_urls("https://github.com/teslamotors/fixed-containers.git")
  7. add_versions("2025.12.10", "39f7c30b4fe333a792c58bbbc0ec3207c58ccbee")
  8. add_versions("2025.01.03", "b8e8427326b8f7d3485828488e59b5853cf8b6bf")
  9. add_deps("cmake", "magic_enum")
  10. on_install(function (package)
  11. io.replace("CMakeLists.txt", "install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include", [[install(DIRECTORY include/]], {plain = true})
  12. io.replace("CMakeLists.txt", "DESTINATION .)", [[DESTINATION include)]], {plain = true})
  13. local configs = {"-DBUILD_TESTS=OFF", "-DFIXED_CONTAINERS_OPT_INSTALL=ON"}
  14. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  15. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  16. import("package.tools.cmake").install(package, configs)
  17. end)
  18. on_test(function (package)
  19. assert(package:check_cxxsnippets({test = [[
  20. #include <fixed_containers/comparison_chain.hpp>
  21. void test() {
  22. auto c = fixed_containers::ComparisonChain::start()
  23. .compare(1, 1).compare(2, 2).compare(3, 3).compare(4, 4).compare(5, 5)
  24. .is_equal();
  25. }
  26. ]]}, {configs = {languages = "c++20"}}))
  27. end)