toolchain("nix-clang")
    set_kind("standalone")
    set_runtimes("c++_static", "c++_shared", "stdc++_static", "stdc++_shared")

    set_toolset("cc", "clang")
    set_toolset("cxx", "clang++")
    set_toolset("ld", "clang++")
    set_toolset("sh", "clang++")
    set_toolset("ar", "llvm-ar")
    set_toolset("strip", "llvm-strip")
    set_toolset("ranlib", "llvm-ranlib")
    set_toolset("objcopy", "llvm-objcopy")
    set_toolset("mm", "clang")
    set_toolset("mxx", "clang++")
    set_toolset("as", "clang")
    set_toolset("mrc", "llvm-rc")

    on_load(function (toolchain)
        local march = is_arch("x86_64", "x64") and "-m64" or "-m32"
        toolchain:add("cxflags", march)
        toolchain:add("mxflags", march)
        toolchain:add("asflags", march)
        toolchain:add("ldflags", march)
        toolchain:add("shflags", march)
    end)

toolchain("mac-clang")
    set_kind("standalone")
    set_runtimes("c++_static", "c++_shared", "stdc++_static", "stdc++_shared")

    set_toolset("cc", "clang")
    set_toolset("cxx", "clang++")
    set_toolset("ld", "clang++")
    set_toolset("sh", "clang++")
    set_toolset("ar", "llvm-ar")
    set_toolset("strip", "llvm-strip")
    set_toolset("ranlib", "llvm-ranlib")
    set_toolset("objcopy", "llvm-objcopy")
    set_toolset("mm", "clang")
    set_toolset("mxx", "clang++")
    set_toolset("as", "clang")

    add_ldflags("-isysroot", "$(shell xcrun --show-sdk-path)")

    add_ldflags("-L$(shell brew --prefix llvm@21)/lib/c++")
    add_ldflags("-Wl,-rpath,$(shell brew --prefix llvm@21)/lib/c++")

    add_cxxflags("-includecstdlib")
    add_cxxflags("-includetype_traits")
    add_cxxflags("-isystem $(shell brew --prefix llvm@21)/include/c++/v1")

