target("hpr") set_kind("shared") set_languages("c++20") set_policy("build.c++.modules", false) add_options("scalar", "scalar_implementation") add_includedirs("..", { public = true }) add_headerfiles("../(hpr/*.hpp)") add_headerfiles("../(hpr/*/*.hpp)") add_files("hpr.cpp") -- export all symbols for windows/dll if is_plat("windows") and is_kind("shared") then if is_mode("release") then set_optimize("fastest") end add_rules("utils.symbols.export_all") end -- install importfiles for pkg-config/cmake add_rules("utils.install.cmake_importfiles") add_rules("utils.install.pkgconfig_importfiles") -- add packages for _, name in ipairs({"imgui", "implot", "glfw", "opencascade"}) do add_packages(name) if has_package(name) then set_configvar("HPR_HAVE_PACKAGE_" .. name:upper(), 1) end end target_end() target("tests") set_kind("binary") set_default(false) set_languages("c++20") if is_plat("mingw") or is_plat("windows") then add_ldflags("-static", { force = true} ) end set_policy("build.c++.modules", false) add_options("scalar", "scalar_implementation") add_packages("gtest") add_includedirs("..", { public = true }) add_files("tests/main.cpp") on_load(function (target) for _, file in ipairs(os.files("source/hpr/tests/test_*.cpp")) do target:add("files", file) for line in io.lines(file) do local group, name = string.match(line:gsub("%s+", ""), "TEST%a*%((%a+),(%a+)%)") if group then target:add("tests", group .. "/" .. name, { group = group, runargs = "--gtest_filter=" .. group .. "." .. name}) end end end end) target_end()