usearch 2.21.3 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -24
- package/binding.gyp +15 -37
- package/c/CMakeLists.txt +4 -5
- package/c/README.md +7 -7
- package/c/lib.cpp +32 -14
- package/c/test.c +83 -1
- package/c/usearch.h +24 -3
- package/cpp/CMakeLists.txt +4 -0
- package/cpp/README.md +5 -5
- package/cpp/bench.cpp +97 -116
- package/cpp/test.cpp +117 -20
- package/include/usearch/index.hpp +235 -52
- package/include/usearch/index_dense.hpp +105 -40
- package/include/usearch/index_plugins.hpp +1387 -204
- package/javascript/dist/cjs/usearch.d.ts +8 -3
- package/javascript/dist/cjs/usearch.js +12 -4
- package/javascript/dist/esm/usearch.d.ts +8 -3
- package/javascript/dist/esm/usearch.js +12 -4
- package/javascript/lib.cpp +17 -0
- package/javascript/usearch.ts +14 -6
- package/numkong/.clang-tidy +30 -0
- package/{simsimd → numkong}/.cmake-format.py +18 -0
- package/numkong/.editorconfig +12 -0
- package/numkong/.git-blame-ignore-revs +123 -0
- package/numkong/.mailmap +15 -0
- package/numkong/.spi.yml +11 -0
- package/numkong/.swift-format +14 -0
- package/numkong/CITATION.cff +81 -0
- package/numkong/CONTRIBUTING.md +500 -0
- package/numkong/Cargo.toml +54 -0
- package/numkong/MANIFEST.in +8 -0
- package/numkong/Package.swift +84 -0
- package/numkong/README.md +569 -0
- package/numkong/bench/README.md +217 -0
- package/numkong/bench/bench-browser.html +323 -0
- package/numkong/bench/bench.cpp +344 -0
- package/numkong/bench/bench.hpp +816 -0
- package/numkong/bench/bench.js +148 -0
- package/numkong/bench/bench.mjs +616 -0
- package/numkong/bench/bench_attention.cpp +113 -0
- package/numkong/bench/bench_cast.cpp +264 -0
- package/numkong/bench/bench_cross_amx.cpp +62 -0
- package/numkong/bench/bench_cross_arm.cpp +245 -0
- package/numkong/bench/bench_cross_blas.cpp +309 -0
- package/numkong/bench/bench_cross_loongarch.cpp +106 -0
- package/numkong/bench/bench_cross_power.cpp +84 -0
- package/numkong/bench/bench_cross_rvv.cpp +121 -0
- package/numkong/bench/bench_cross_serial.cpp +151 -0
- package/numkong/bench/bench_cross_sme.cpp +163 -0
- package/numkong/bench/bench_cross_wasm.cpp +142 -0
- package/numkong/bench/bench_cross_x86.cpp +455 -0
- package/numkong/bench/bench_curved.cpp +210 -0
- package/numkong/bench/bench_dot.cpp +315 -0
- package/numkong/bench/bench_each.cpp +503 -0
- package/numkong/bench/bench_geospatial.cpp +112 -0
- package/numkong/bench/bench_maxsim.cpp +154 -0
- package/numkong/bench/bench_mesh.cpp +148 -0
- package/numkong/bench/bench_probability.cpp +60 -0
- package/numkong/bench/bench_reduce.cpp +371 -0
- package/numkong/bench/bench_set.cpp +73 -0
- package/numkong/bench/bench_sparse.cpp +198 -0
- package/numkong/bench/bench_spatial.cpp +347 -0
- package/numkong/bench/bench_trigonometry.cpp +137 -0
- package/numkong/bench/swift/Bench.swift +506 -0
- package/numkong/binding.gyp +169 -0
- package/numkong/build.rs +484 -0
- package/numkong/c/dispatch.h +512 -0
- package/numkong/c/dispatch_bf16.c +447 -0
- package/numkong/c/dispatch_bf16c.c +52 -0
- package/numkong/c/dispatch_e2m3.c +296 -0
- package/numkong/c/dispatch_e3m2.c +284 -0
- package/numkong/c/dispatch_e4m3.c +318 -0
- package/numkong/c/dispatch_e5m2.c +316 -0
- package/numkong/c/dispatch_f16.c +452 -0
- package/numkong/c/dispatch_f16c.c +58 -0
- package/numkong/c/dispatch_f32.c +434 -0
- package/numkong/c/dispatch_f32c.c +99 -0
- package/numkong/c/dispatch_f64.c +348 -0
- package/numkong/c/dispatch_f64c.c +98 -0
- package/numkong/c/dispatch_i16.c +96 -0
- package/numkong/c/dispatch_i32.c +89 -0
- package/numkong/c/dispatch_i4.c +153 -0
- package/numkong/c/dispatch_i64.c +86 -0
- package/numkong/c/dispatch_i8.c +348 -0
- package/numkong/c/dispatch_other.c +348 -0
- package/numkong/c/dispatch_u1.c +193 -0
- package/numkong/c/dispatch_u16.c +124 -0
- package/numkong/c/dispatch_u32.c +118 -0
- package/numkong/c/dispatch_u4.c +153 -0
- package/numkong/c/dispatch_u64.c +102 -0
- package/numkong/c/dispatch_u8.c +364 -0
- package/numkong/c/numkong.c +940 -0
- package/numkong/cmake/nk_arm_isa_probes.cmake +61 -0
- package/numkong/cmake/nk_isa_probe.cmake +90 -0
- package/numkong/cmake/nk_loongarch_isa_probes.cmake +15 -0
- package/numkong/cmake/nk_math_lib.cmake +46 -0
- package/numkong/cmake/nk_power_isa_probes.cmake +15 -0
- package/numkong/cmake/nk_riscv_isa_probes.cmake +19 -0
- package/numkong/cmake/nk_x86_isa_probes.cmake +35 -0
- package/numkong/cmake/toolchain-aarch64-gnu.cmake +86 -0
- package/numkong/cmake/toolchain-android-arm64.cmake +25 -0
- package/numkong/cmake/toolchain-android-armv7.cmake +25 -0
- package/numkong/cmake/toolchain-loongarch64-gnu.cmake +68 -0
- package/numkong/cmake/toolchain-ppc64le-gnu.cmake +74 -0
- package/numkong/cmake/toolchain-riscv64-gnu.cmake +107 -0
- package/numkong/cmake/toolchain-riscv64-llvm.cmake +114 -0
- package/numkong/cmake/toolchain-wasi.cmake +77 -0
- package/numkong/cmake/toolchain-wasm.cmake +70 -0
- package/numkong/cmake/toolchain-wasm64.cmake +62 -0
- package/numkong/cmake/toolchain-x86_64-llvm.cmake +47 -0
- package/numkong/include/README.md +643 -0
- package/numkong/include/module.modulemap +129 -0
- package/numkong/include/numkong/attention/sapphireamx.h +1363 -0
- package/numkong/include/numkong/attention/sme.h +2075 -0
- package/numkong/include/numkong/attention.h +49 -0
- package/numkong/include/numkong/capabilities.h +930 -0
- package/numkong/include/numkong/cast/README.md +262 -0
- package/numkong/include/numkong/cast/diamond.h +64 -0
- package/numkong/include/numkong/cast/haswell.h +823 -0
- package/numkong/include/numkong/cast/icelake.h +475 -0
- package/numkong/include/numkong/cast/loongsonasx.h +252 -0
- package/numkong/include/numkong/cast/neon.h +1174 -0
- package/numkong/include/numkong/cast/powervsx.h +449 -0
- package/numkong/include/numkong/cast/rvv.h +970 -0
- package/numkong/include/numkong/cast/sapphire.h +262 -0
- package/numkong/include/numkong/cast/serial.h +2336 -0
- package/numkong/include/numkong/cast/skylake.h +915 -0
- package/numkong/include/numkong/cast/v128relaxed.h +537 -0
- package/numkong/include/numkong/cast.h +254 -0
- package/numkong/include/numkong/cast.hpp +44 -0
- package/numkong/include/numkong/curved/README.md +223 -0
- package/numkong/include/numkong/curved/genoa.h +182 -0
- package/numkong/include/numkong/curved/haswell.h +276 -0
- package/numkong/include/numkong/curved/neon.h +329 -0
- package/numkong/include/numkong/curved/neonbfdot.h +211 -0
- package/numkong/include/numkong/curved/rvv.h +305 -0
- package/numkong/include/numkong/curved/serial.h +207 -0
- package/numkong/include/numkong/curved/skylake.h +457 -0
- package/numkong/include/numkong/curved/smef64.h +530 -0
- package/numkong/include/numkong/curved.h +513 -0
- package/numkong/include/numkong/curved.hpp +144 -0
- package/numkong/include/numkong/dot/README.md +442 -0
- package/numkong/include/numkong/dot/alder.h +563 -0
- package/numkong/include/numkong/dot/diamond.h +158 -0
- package/numkong/include/numkong/dot/genoa.h +289 -0
- package/numkong/include/numkong/dot/haswell.h +1723 -0
- package/numkong/include/numkong/dot/icelake.h +997 -0
- package/numkong/include/numkong/dot/loongsonasx.h +671 -0
- package/numkong/include/numkong/dot/neon.h +869 -0
- package/numkong/include/numkong/dot/neonbfdot.h +243 -0
- package/numkong/include/numkong/dot/neonfhm.h +358 -0
- package/numkong/include/numkong/dot/neonfp8.h +323 -0
- package/numkong/include/numkong/dot/neonsdot.h +622 -0
- package/numkong/include/numkong/dot/powervsx.h +752 -0
- package/numkong/include/numkong/dot/rvv.h +722 -0
- package/numkong/include/numkong/dot/rvvbb.h +72 -0
- package/numkong/include/numkong/dot/rvvbf16.h +123 -0
- package/numkong/include/numkong/dot/rvvhalf.h +129 -0
- package/numkong/include/numkong/dot/sapphire.h +141 -0
- package/numkong/include/numkong/dot/serial.h +874 -0
- package/numkong/include/numkong/dot/sierra.h +405 -0
- package/numkong/include/numkong/dot/skylake.h +1116 -0
- package/numkong/include/numkong/dot/sve.h +420 -0
- package/numkong/include/numkong/dot/svebfdot.h +75 -0
- package/numkong/include/numkong/dot/svehalf.h +168 -0
- package/numkong/include/numkong/dot/svesdot.h +90 -0
- package/numkong/include/numkong/dot/v128relaxed.h +1293 -0
- package/numkong/include/numkong/dot.h +1136 -0
- package/numkong/include/numkong/dot.hpp +94 -0
- package/numkong/include/numkong/dots/README.md +496 -0
- package/numkong/include/numkong/dots/alder.h +117 -0
- package/numkong/include/numkong/dots/diamond.h +86 -0
- package/numkong/include/numkong/dots/genoa.h +100 -0
- package/numkong/include/numkong/dots/graniteamx.h +733 -0
- package/numkong/include/numkong/dots/haswell.h +310 -0
- package/numkong/include/numkong/dots/icelake.h +180 -0
- package/numkong/include/numkong/dots/loongsonasx.h +176 -0
- package/numkong/include/numkong/dots/neon.h +123 -0
- package/numkong/include/numkong/dots/neonbfdot.h +59 -0
- package/numkong/include/numkong/dots/neonfhm.h +96 -0
- package/numkong/include/numkong/dots/neonfp8.h +99 -0
- package/numkong/include/numkong/dots/neonsdot.h +144 -0
- package/numkong/include/numkong/dots/powervsx.h +194 -0
- package/numkong/include/numkong/dots/rvv.h +2593 -0
- package/numkong/include/numkong/dots/sapphireamx.h +4017 -0
- package/numkong/include/numkong/dots/serial.h +2867 -0
- package/numkong/include/numkong/dots/sierra.h +100 -0
- package/numkong/include/numkong/dots/skylake.h +207 -0
- package/numkong/include/numkong/dots/sme.h +5041 -0
- package/numkong/include/numkong/dots/smebi32.h +477 -0
- package/numkong/include/numkong/dots/smef64.h +1328 -0
- package/numkong/include/numkong/dots/smehalf.h +47 -0
- package/numkong/include/numkong/dots/v128relaxed.h +317 -0
- package/numkong/include/numkong/dots.h +3110 -0
- package/numkong/include/numkong/dots.hpp +641 -0
- package/numkong/include/numkong/each/README.md +465 -0
- package/numkong/include/numkong/each/haswell.h +1658 -0
- package/numkong/include/numkong/each/icelake.h +272 -0
- package/numkong/include/numkong/each/neon.h +1138 -0
- package/numkong/include/numkong/each/neonbfdot.h +211 -0
- package/numkong/include/numkong/each/neonhalf.h +318 -0
- package/numkong/include/numkong/each/rvv.h +1121 -0
- package/numkong/include/numkong/each/sapphire.h +343 -0
- package/numkong/include/numkong/each/serial.h +282 -0
- package/numkong/include/numkong/each/skylake.h +1562 -0
- package/numkong/include/numkong/each/v128relaxed.h +562 -0
- package/numkong/include/numkong/each.h +2232 -0
- package/numkong/include/numkong/each.hpp +434 -0
- package/numkong/include/numkong/geospatial/README.md +147 -0
- package/numkong/include/numkong/geospatial/haswell.h +633 -0
- package/numkong/include/numkong/geospatial/neon.h +615 -0
- package/numkong/include/numkong/geospatial/rvv.h +701 -0
- package/numkong/include/numkong/geospatial/serial.h +309 -0
- package/numkong/include/numkong/geospatial/skylake.h +613 -0
- package/numkong/include/numkong/geospatial/v128relaxed.h +652 -0
- package/numkong/include/numkong/geospatial.h +453 -0
- package/numkong/include/numkong/geospatial.hpp +235 -0
- package/numkong/include/numkong/matrix.hpp +336 -0
- package/numkong/include/numkong/maxsim/README.md +187 -0
- package/numkong/include/numkong/maxsim/alder.h +511 -0
- package/numkong/include/numkong/maxsim/genoa.h +115 -0
- package/numkong/include/numkong/maxsim/haswell.h +553 -0
- package/numkong/include/numkong/maxsim/icelake.h +480 -0
- package/numkong/include/numkong/maxsim/neonsdot.h +394 -0
- package/numkong/include/numkong/maxsim/sapphireamx.h +877 -0
- package/numkong/include/numkong/maxsim/serial.h +490 -0
- package/numkong/include/numkong/maxsim/sme.h +993 -0
- package/numkong/include/numkong/maxsim/v128relaxed.h +280 -0
- package/numkong/include/numkong/maxsim.h +571 -0
- package/numkong/include/numkong/maxsim.hpp +133 -0
- package/numkong/include/numkong/mesh/README.md +219 -0
- package/numkong/include/numkong/mesh/haswell.h +2013 -0
- package/numkong/include/numkong/mesh/neon.h +1821 -0
- package/numkong/include/numkong/mesh/neonbfdot.h +771 -0
- package/numkong/include/numkong/mesh/rvv.h +936 -0
- package/numkong/include/numkong/mesh/serial.h +721 -0
- package/numkong/include/numkong/mesh/skylake.h +2344 -0
- package/numkong/include/numkong/mesh/v128relaxed.h +1081 -0
- package/numkong/include/numkong/mesh.h +666 -0
- package/numkong/include/numkong/mesh.hpp +701 -0
- package/numkong/include/numkong/numkong.h +78 -0
- package/numkong/include/numkong/numkong.hpp +58 -0
- package/numkong/include/numkong/probability/README.md +177 -0
- package/numkong/include/numkong/probability/haswell.h +267 -0
- package/numkong/include/numkong/probability/neon.h +255 -0
- package/numkong/include/numkong/probability/rvv.h +414 -0
- package/numkong/include/numkong/probability/serial.h +181 -0
- package/numkong/include/numkong/probability/skylake.h +324 -0
- package/numkong/include/numkong/probability.h +380 -0
- package/numkong/include/numkong/probability.hpp +120 -0
- package/numkong/include/numkong/random.h +50 -0
- package/numkong/include/numkong/random.hpp +285 -0
- package/numkong/include/numkong/reduce/README.md +552 -0
- package/numkong/include/numkong/reduce/alder.h +636 -0
- package/numkong/include/numkong/reduce/genoa.h +201 -0
- package/numkong/include/numkong/reduce/haswell.h +3785 -0
- package/numkong/include/numkong/reduce/icelake.h +549 -0
- package/numkong/include/numkong/reduce/neon.h +3980 -0
- package/numkong/include/numkong/reduce/neonbfdot.h +142 -0
- package/numkong/include/numkong/reduce/neonfhm.h +293 -0
- package/numkong/include/numkong/reduce/neonsdot.h +357 -0
- package/numkong/include/numkong/reduce/rvv.h +3533 -0
- package/numkong/include/numkong/reduce/serial.h +753 -0
- package/numkong/include/numkong/reduce/sierra.h +338 -0
- package/numkong/include/numkong/reduce/skylake.h +3794 -0
- package/numkong/include/numkong/reduce/sve.h +52 -0
- package/numkong/include/numkong/reduce/v128relaxed.h +2302 -0
- package/numkong/include/numkong/reduce.h +1582 -0
- package/numkong/include/numkong/reduce.hpp +778 -0
- package/numkong/include/numkong/scalar/README.md +89 -0
- package/numkong/include/numkong/scalar/haswell.h +122 -0
- package/numkong/include/numkong/scalar/loongsonasx.h +74 -0
- package/numkong/include/numkong/scalar/neon.h +122 -0
- package/numkong/include/numkong/scalar/neonhalf.h +70 -0
- package/numkong/include/numkong/scalar/powervsx.h +96 -0
- package/numkong/include/numkong/scalar/rvv.h +211 -0
- package/numkong/include/numkong/scalar/sapphire.h +74 -0
- package/numkong/include/numkong/scalar/serial.h +332 -0
- package/numkong/include/numkong/scalar/v128relaxed.h +56 -0
- package/numkong/include/numkong/scalar.h +696 -0
- package/numkong/include/numkong/set/README.md +179 -0
- package/numkong/include/numkong/set/haswell.h +334 -0
- package/numkong/include/numkong/set/icelake.h +485 -0
- package/numkong/include/numkong/set/loongsonasx.h +181 -0
- package/numkong/include/numkong/set/neon.h +363 -0
- package/numkong/include/numkong/set/powervsx.h +326 -0
- package/numkong/include/numkong/set/rvv.h +226 -0
- package/numkong/include/numkong/set/rvvbb.h +117 -0
- package/numkong/include/numkong/set/serial.h +174 -0
- package/numkong/include/numkong/set/sve.h +187 -0
- package/numkong/include/numkong/set/v128relaxed.h +240 -0
- package/numkong/include/numkong/set.h +471 -0
- package/numkong/include/numkong/set.hpp +114 -0
- package/numkong/include/numkong/sets/README.md +149 -0
- package/numkong/include/numkong/sets/haswell.h +63 -0
- package/numkong/include/numkong/sets/icelake.h +66 -0
- package/numkong/include/numkong/sets/loongsonasx.h +52 -0
- package/numkong/include/numkong/sets/neon.h +61 -0
- package/numkong/include/numkong/sets/powervsx.h +65 -0
- package/numkong/include/numkong/sets/serial.h +43 -0
- package/numkong/include/numkong/sets/smebi32.h +1135 -0
- package/numkong/include/numkong/sets/v128relaxed.h +58 -0
- package/numkong/include/numkong/sets.h +382 -0
- package/numkong/include/numkong/sparse/README.md +156 -0
- package/numkong/include/numkong/sparse/icelake.h +463 -0
- package/numkong/include/numkong/sparse/neon.h +288 -0
- package/numkong/include/numkong/sparse/serial.h +117 -0
- package/numkong/include/numkong/sparse/sve2.h +504 -0
- package/numkong/include/numkong/sparse/turin.h +322 -0
- package/numkong/include/numkong/sparse.h +363 -0
- package/numkong/include/numkong/sparse.hpp +113 -0
- package/numkong/include/numkong/spatial/README.md +439 -0
- package/numkong/include/numkong/spatial/alder.h +604 -0
- package/numkong/include/numkong/spatial/diamond.h +240 -0
- package/numkong/include/numkong/spatial/genoa.h +222 -0
- package/numkong/include/numkong/spatial/haswell.h +979 -0
- package/numkong/include/numkong/spatial/icelake.h +1067 -0
- package/numkong/include/numkong/spatial/loongsonasx.h +483 -0
- package/numkong/include/numkong/spatial/neon.h +846 -0
- package/numkong/include/numkong/spatial/neonbfdot.h +164 -0
- package/numkong/include/numkong/spatial/neonfp8.h +258 -0
- package/numkong/include/numkong/spatial/neonsdot.h +429 -0
- package/numkong/include/numkong/spatial/powervsx.h +738 -0
- package/numkong/include/numkong/spatial/rvv.h +991 -0
- package/numkong/include/numkong/spatial/rvvbf16.h +128 -0
- package/numkong/include/numkong/spatial/rvvhalf.h +120 -0
- package/numkong/include/numkong/spatial/serial.h +347 -0
- package/numkong/include/numkong/spatial/sierra.h +516 -0
- package/numkong/include/numkong/spatial/skylake.h +605 -0
- package/numkong/include/numkong/spatial/sve.h +246 -0
- package/numkong/include/numkong/spatial/svebfdot.h +125 -0
- package/numkong/include/numkong/spatial/svehalf.h +136 -0
- package/numkong/include/numkong/spatial/svesdot.h +143 -0
- package/numkong/include/numkong/spatial/v128relaxed.h +969 -0
- package/numkong/include/numkong/spatial.h +1681 -0
- package/numkong/include/numkong/spatial.hpp +183 -0
- package/numkong/include/numkong/spatials/README.md +580 -0
- package/numkong/include/numkong/spatials/alder.h +94 -0
- package/numkong/include/numkong/spatials/diamond.h +82 -0
- package/numkong/include/numkong/spatials/genoa.h +94 -0
- package/numkong/include/numkong/spatials/graniteamx.h +173 -0
- package/numkong/include/numkong/spatials/haswell.h +219 -0
- package/numkong/include/numkong/spatials/icelake.h +113 -0
- package/numkong/include/numkong/spatials/loongsonasx.h +153 -0
- package/numkong/include/numkong/spatials/neon.h +109 -0
- package/numkong/include/numkong/spatials/neonbfdot.h +60 -0
- package/numkong/include/numkong/spatials/neonfhm.h +92 -0
- package/numkong/include/numkong/spatials/neonfp8.h +111 -0
- package/numkong/include/numkong/spatials/neonsdot.h +143 -0
- package/numkong/include/numkong/spatials/powervsx.h +153 -0
- package/numkong/include/numkong/spatials/rvv.h +1976 -0
- package/numkong/include/numkong/spatials/sapphireamx.h +1149 -0
- package/numkong/include/numkong/spatials/serial.h +248 -0
- package/numkong/include/numkong/spatials/sierra.h +96 -0
- package/numkong/include/numkong/spatials/skylake.h +184 -0
- package/numkong/include/numkong/spatials/sme.h +1927 -0
- package/numkong/include/numkong/spatials/smef64.h +483 -0
- package/numkong/include/numkong/spatials/v128relaxed.h +240 -0
- package/numkong/include/numkong/spatials.h +3374 -0
- package/numkong/include/numkong/spatials.hpp +509 -0
- package/numkong/include/numkong/tensor.hpp +1981 -0
- package/numkong/include/numkong/trigonometry/README.md +184 -0
- package/numkong/include/numkong/trigonometry/haswell.h +653 -0
- package/numkong/include/numkong/trigonometry/neon.h +638 -0
- package/numkong/include/numkong/trigonometry/rvv.h +700 -0
- package/numkong/include/numkong/trigonometry/serial.h +703 -0
- package/numkong/include/numkong/trigonometry/skylake.h +725 -0
- package/numkong/include/numkong/trigonometry/v128relaxed.h +667 -0
- package/numkong/include/numkong/trigonometry.h +467 -0
- package/numkong/include/numkong/trigonometry.hpp +166 -0
- package/numkong/include/numkong/types.h +1695 -0
- package/numkong/include/numkong/types.hpp +6027 -0
- package/numkong/include/numkong/vector.hpp +766 -0
- package/numkong/javascript/@numkong-darwin-arm64/package.json +26 -0
- package/numkong/javascript/@numkong-darwin-x64/package.json +26 -0
- package/numkong/javascript/@numkong-linux-arm64/package.json +25 -0
- package/numkong/javascript/@numkong-linux-x64/package.json +25 -0
- package/numkong/javascript/@numkong-win32-arm64/package.json +25 -0
- package/numkong/javascript/@numkong-win32-x64/package.json +25 -0
- package/numkong/javascript/README.md +254 -0
- package/numkong/javascript/node-gyp-build.d.ts +4 -0
- package/numkong/javascript/numkong-browser.ts +40 -0
- package/numkong/javascript/numkong-wasm.ts +750 -0
- package/numkong/javascript/numkong.c +712 -0
- package/numkong/javascript/numkong.ts +613 -0
- package/{simsimd → numkong}/javascript/tsconfig-base.json +6 -3
- package/numkong/javascript/tsconfig-cjs.json +13 -0
- package/{simsimd → numkong}/javascript/tsconfig-esm.json +1 -1
- package/numkong/javascript/types.ts +784 -0
- package/numkong/numkong.gypi +104 -0
- package/numkong/package.json +108 -0
- package/numkong/probes/arm_neon.c +8 -0
- package/numkong/probes/arm_neon_bfdot.c +9 -0
- package/numkong/probes/arm_neon_fhm.c +9 -0
- package/numkong/probes/arm_neon_half.c +8 -0
- package/numkong/probes/arm_neon_sdot.c +9 -0
- package/numkong/probes/arm_neonfp8.c +9 -0
- package/numkong/probes/arm_sme.c +16 -0
- package/numkong/probes/arm_sme2.c +16 -0
- package/numkong/probes/arm_sme2p1.c +16 -0
- package/numkong/probes/arm_sme_bf16.c +16 -0
- package/numkong/probes/arm_sme_bi32.c +16 -0
- package/numkong/probes/arm_sme_f64.c +16 -0
- package/numkong/probes/arm_sme_fa64.c +14 -0
- package/numkong/probes/arm_sme_half.c +16 -0
- package/numkong/probes/arm_sme_lut2.c +15 -0
- package/numkong/probes/arm_sve.c +18 -0
- package/numkong/probes/arm_sve2.c +20 -0
- package/numkong/probes/arm_sve2p1.c +18 -0
- package/numkong/probes/arm_sve_bfdot.c +20 -0
- package/numkong/probes/arm_sve_half.c +18 -0
- package/numkong/probes/arm_sve_sdot.c +21 -0
- package/numkong/probes/loongarch_lasx.c +12 -0
- package/numkong/probes/power_vsx.c +12 -0
- package/numkong/probes/probe.js +127 -0
- package/numkong/probes/riscv_rvv.c +14 -0
- package/numkong/probes/riscv_rvv_bb.c +15 -0
- package/numkong/probes/riscv_rvv_bf16.c +17 -0
- package/numkong/probes/riscv_rvv_half.c +14 -0
- package/numkong/probes/wasm_v128relaxed.c +11 -0
- package/numkong/probes/x86_alder.c +17 -0
- package/numkong/probes/x86_diamond.c +17 -0
- package/numkong/probes/x86_genoa.c +17 -0
- package/numkong/probes/x86_graniteamx.c +19 -0
- package/numkong/probes/x86_haswell.c +11 -0
- package/numkong/probes/x86_icelake.c +17 -0
- package/numkong/probes/x86_sapphire.c +16 -0
- package/numkong/probes/x86_sapphireamx.c +18 -0
- package/numkong/probes/x86_sierra.c +17 -0
- package/numkong/probes/x86_skylake.c +15 -0
- package/numkong/probes/x86_turin.c +17 -0
- package/numkong/rust/README.md +698 -0
- package/numkong/rust/capabilities.rs +96 -0
- package/numkong/rust/cast.rs +314 -0
- package/numkong/rust/curved.rs +391 -0
- package/numkong/rust/each.rs +2721 -0
- package/numkong/rust/geospatial.rs +343 -0
- package/numkong/rust/matrix.rs +5424 -0
- package/numkong/rust/maxsim.rs +540 -0
- package/numkong/rust/mesh.rs +837 -0
- package/numkong/rust/numkong.rs +409 -0
- package/numkong/rust/probability.rs +272 -0
- package/numkong/rust/reduce.rs +1249 -0
- package/numkong/rust/set.rs +194 -0
- package/numkong/rust/sparse.rs +513 -0
- package/numkong/rust/spatial.rs +1815 -0
- package/numkong/rust/tensor.rs +7565 -0
- package/numkong/rust/types.rs +3666 -0
- package/numkong/rust/vector.rs +1899 -0
- package/numkong/rustfmt.toml +2 -0
- package/numkong/swift/Matrix.swift +1388 -0
- package/numkong/swift/MaxSim.swift +151 -0
- package/numkong/swift/NumKong.swift +283 -0
- package/numkong/swift/Numerics.swift +329 -0
- package/numkong/swift/README.md +433 -0
- package/numkong/swift/Scalar.swift +741 -0
- package/numkong/swift/Tensor.swift +209 -0
- package/numkong/test/README.md +315 -0
- package/numkong/test/playwright.config.ts +16 -0
- package/numkong/test/swift/Test.swift +534 -0
- package/numkong/test/test-browser-bundle-runner.mjs +36 -0
- package/numkong/test/test-browser-bundle.html +188 -0
- package/numkong/test/test-browser-runner.mjs +43 -0
- package/numkong/test/test-browser.html +305 -0
- package/numkong/test/test-dtypes.mjs +453 -0
- package/numkong/test/test-wasm.mjs +267 -0
- package/numkong/test/test.cpp +442 -0
- package/numkong/test/test.hpp +580 -0
- package/numkong/test/test.mjs +363 -0
- package/numkong/test/test_base.py +1041 -0
- package/numkong/test/test_cast.cpp +242 -0
- package/numkong/test/test_cross.hpp +551 -0
- package/numkong/test/test_cross.py +467 -0
- package/numkong/test/test_cross_amx.cpp +50 -0
- package/numkong/test/test_cross_arm.cpp +225 -0
- package/numkong/test/test_cross_blas.cpp +354 -0
- package/numkong/test/test_cross_loongarch.cpp +90 -0
- package/numkong/test/test_cross_power.cpp +73 -0
- package/numkong/test/test_cross_rvv.cpp +109 -0
- package/numkong/test/test_cross_serial.cpp +181 -0
- package/numkong/test/test_cross_sme.cpp +148 -0
- package/numkong/test/test_cross_wasm.cpp +141 -0
- package/numkong/test/test_cross_x86.cpp +442 -0
- package/numkong/test/test_curved.cpp +182 -0
- package/numkong/test/test_curved.py +207 -0
- package/numkong/test/test_dot.cpp +353 -0
- package/numkong/test/test_dot.py +296 -0
- package/numkong/test/test_each.cpp +437 -0
- package/numkong/test/test_each.py +756 -0
- package/numkong/test/test_geospatial.cpp +155 -0
- package/numkong/test/test_geospatial.py +241 -0
- package/numkong/test/test_maxsim.cpp +138 -0
- package/numkong/test/test_maxsim.py +209 -0
- package/numkong/test/test_mesh.cpp +203 -0
- package/numkong/test/test_mesh.py +394 -0
- package/numkong/test/test_probability.cpp +136 -0
- package/numkong/test/test_probability.py +166 -0
- package/numkong/test/test_reduce.cpp +563 -0
- package/numkong/test/test_reduce.py +781 -0
- package/numkong/test/test_set.cpp +151 -0
- package/numkong/test/test_set.py +120 -0
- package/numkong/test/test_similarities.py +579 -0
- package/numkong/test/test_sparse.cpp +121 -0
- package/numkong/test/test_sparse.py +118 -0
- package/numkong/test/test_spatial.cpp +518 -0
- package/numkong/test/test_spatial.py +269 -0
- package/numkong/test/test_tensor.cpp +884 -0
- package/numkong/test/test_tensor.py +1417 -0
- package/numkong/test/test_trigonometry.cpp +156 -0
- package/numkong/test/test_trigonometry.py +180 -0
- package/package.json +7 -8
- package/prebuilds/darwin-arm64+x64/usearch.node +0 -0
- package/prebuilds/linux-arm64/usearch.node +0 -0
- package/prebuilds/linux-x64/usearch.node +0 -0
- package/fp16/CMakeLists.txt +0 -176
- package/fp16/LICENSE +0 -11
- package/fp16/README.md +0 -20
- package/fp16/bench/alt-element.cc +0 -89
- package/fp16/bench/from-alt-array.cc +0 -175
- package/fp16/bench/from-ieee-array.cc +0 -399
- package/fp16/bench/ieee-element.cc +0 -272
- package/fp16/bench/to-alt-array.cc +0 -91
- package/fp16/bench/to-ieee-array.cc +0 -303
- package/fp16/cmake/DownloadGoogleBenchmark.cmake +0 -15
- package/fp16/cmake/DownloadGoogleTest.cmake +0 -15
- package/fp16/cmake/DownloadPSimd.cmake +0 -15
- package/fp16/configure.py +0 -65
- package/fp16/confu.yaml +0 -8
- package/fp16/include/fp16/__init__.py +0 -0
- package/fp16/include/fp16/avx.py +0 -50
- package/fp16/include/fp16/avx2.py +0 -53
- package/fp16/include/fp16/bitcasts.h +0 -92
- package/fp16/include/fp16/fp16.h +0 -451
- package/fp16/include/fp16/psimd.h +0 -131
- package/fp16/include/fp16.h +0 -11
- package/fp16/jni/Android.mk +0 -6
- package/fp16/jni/Application.mk +0 -4
- package/fp16/test/alt-from-fp32-value.cc +0 -498
- package/fp16/test/alt-to-fp32-bits.cc +0 -263
- package/fp16/test/alt-to-fp32-psimd.cc +0 -145
- package/fp16/test/alt-to-fp32-value.cc +0 -348
- package/fp16/test/alt-to-fp32x2-psimd.cc +0 -245
- package/fp16/test/bitcasts.cc +0 -56
- package/fp16/test/ieee-from-fp32-value.cc +0 -523
- package/fp16/test/ieee-to-fp32-bits.cc +0 -333
- package/fp16/test/ieee-to-fp32-psimd.cc +0 -312
- package/fp16/test/ieee-to-fp32-value.cc +0 -420
- package/fp16/test/ieee-to-fp32x2-psimd.cc +0 -541
- package/fp16/test/peachpy/alt-xmm-to-fp32-xmm-avx.cc +0 -96
- package/fp16/test/peachpy/alt-xmm-to-fp32-ymm-avx2.cc +0 -96
- package/fp16/test/peachpy/stubs.py +0 -38
- package/fp16/test/tables.cc +0 -530
- package/fp16/test/tables.h +0 -13
- package/fp16/third-party/THHalf.h +0 -92
- package/fp16/third-party/eigen-half.h +0 -170
- package/fp16/third-party/float16-compressor.h +0 -80
- package/fp16/third-party/half.hpp +0 -2916
- package/fp16/third-party/npy-halffloat.h +0 -328
- package/simsimd/.git-blame-ignore-revs +0 -2
- package/simsimd/CONTRIBUTING.md +0 -321
- package/simsimd/Cargo.toml +0 -49
- package/simsimd/MANIFEST.in +0 -4
- package/simsimd/Package.swift +0 -28
- package/simsimd/README.md +0 -1493
- package/simsimd/binding.gyp +0 -35
- package/simsimd/build.rs +0 -70
- package/simsimd/c/lib.c +0 -374
- package/simsimd/include/module.modulemap +0 -4
- package/simsimd/include/simsimd/binary.h +0 -486
- package/simsimd/include/simsimd/curved.h +0 -1541
- package/simsimd/include/simsimd/dot.h +0 -1853
- package/simsimd/include/simsimd/elementwise.h +0 -2465
- package/simsimd/include/simsimd/geospatial.h +0 -43
- package/simsimd/include/simsimd/mesh.h +0 -69
- package/simsimd/include/simsimd/probability.h +0 -606
- package/simsimd/include/simsimd/simsimd.h +0 -2567
- package/simsimd/include/simsimd/sparse.h +0 -1384
- package/simsimd/include/simsimd/spatial.h +0 -2335
- package/simsimd/include/simsimd/types.h +0 -666
- package/simsimd/javascript/fallback.ts +0 -233
- package/simsimd/javascript/lib.c +0 -125
- package/simsimd/javascript/node-gyp-build.d.ts +0 -1
- package/simsimd/javascript/simsimd.ts +0 -179
- package/simsimd/javascript/tsconfig-cjs.json +0 -8
- package/simsimd/package-lock.json +0 -1761
- package/simsimd/package.json +0 -61
- package/simsimd/rust/lib.rs +0 -1821
- package/simsimd/scripts/bench.cxx +0 -1170
- package/simsimd/scripts/bench.ipynb +0 -187
- package/simsimd/scripts/bench.js +0 -127
- package/simsimd/scripts/bench.rs +0 -876
- package/simsimd/scripts/bench_vectors.py +0 -734
- package/simsimd/scripts/bench_vectors_live.py +0 -213
- package/simsimd/scripts/test.c +0 -187
- package/simsimd/scripts/test.mjs +0 -220
- package/simsimd/scripts/test.py +0 -1505
- package/simsimd/swift/SimSIMD.swift +0 -149
- package/simsimd/swift/Test.swift +0 -128
- /package/{simsimd → numkong}/CODE_OF_CONDUCT.md +0 -0
- /package/{simsimd → numkong}/LICENSE +0 -0
- /package/{simsimd → numkong}/javascript/dist-package-cjs.json +0 -0
- /package/{simsimd → numkong}/javascript/dist-package-esm.json +0 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# RISC-V 64 GNU toolchain for NumKong.
|
|
2
|
+
#
|
|
3
|
+
# Usage:
|
|
4
|
+
# cmake -B build_riscv -D CMAKE_TOOLCHAIN_FILE=cmake/toolchain-riscv64-gnu.cmake
|
|
5
|
+
# cmake --build build_riscv
|
|
6
|
+
#
|
|
7
|
+
# Optional inputs:
|
|
8
|
+
# -D RISCV_TOOLCHAIN_PATH=/path/to/riscv-gnu-toolchain
|
|
9
|
+
# -D RISCV_SYSROOT=/path/to/riscv64/sysroot
|
|
10
|
+
# -D RISCV_MARCH=rv64gcv_zvfh_zvfbfwma_zvbb
|
|
11
|
+
# -D RISCV_MABI=lp64d
|
|
12
|
+
#
|
|
13
|
+
# Prerequisites:
|
|
14
|
+
# Download the toolchain: https://github.com/riscv-collab/riscv-gnu-toolchain/releases
|
|
15
|
+
# sudo apt install qemu-user
|
|
16
|
+
#
|
|
17
|
+
# Testing with QEMU:
|
|
18
|
+
# Tests will automatically run under QEMU via CMAKE_CROSSCOMPILING_EMULATOR
|
|
19
|
+
#
|
|
20
|
+
# To customize the architecture, set RISCV_MARCH before configuring:
|
|
21
|
+
# cmake -B build_riscv -D CMAKE_TOOLCHAIN_FILE=cmake/toolchain-riscv64-gnu.cmake -D RISCV_MARCH=rv64gcv
|
|
22
|
+
|
|
23
|
+
set(CMAKE_SYSTEM_NAME Linux)
|
|
24
|
+
set(CMAKE_SYSTEM_PROCESSOR riscv64)
|
|
25
|
+
|
|
26
|
+
# Cross-compiler from the riscv-collab toolchain.
|
|
27
|
+
# Set RISCV_TOOLCHAIN_PATH to override the default location.
|
|
28
|
+
if (NOT DEFINED RISCV_TOOLCHAIN_PATH)
|
|
29
|
+
if (DEFINED ENV{RISCV_TOOLCHAIN_PATH})
|
|
30
|
+
set(RISCV_TOOLCHAIN_PATH "$ENV{RISCV_TOOLCHAIN_PATH}")
|
|
31
|
+
else ()
|
|
32
|
+
set(RISCV_TOOLCHAIN_PATH "/tmp/riscv")
|
|
33
|
+
endif ()
|
|
34
|
+
endif ()
|
|
35
|
+
set(RISCV_TOOLCHAIN_PATH "${RISCV_TOOLCHAIN_PATH}" CACHE PATH "RISC-V GNU toolchain root")
|
|
36
|
+
set(ENV{RISCV_TOOLCHAIN_PATH} "${RISCV_TOOLCHAIN_PATH}")
|
|
37
|
+
|
|
38
|
+
set(CMAKE_C_COMPILER "${RISCV_TOOLCHAIN_PATH}/bin/riscv64-unknown-linux-gnu-gcc")
|
|
39
|
+
set(CMAKE_CXX_COMPILER "${RISCV_TOOLCHAIN_PATH}/bin/riscv64-unknown-linux-gnu-g++")
|
|
40
|
+
|
|
41
|
+
# Sysroot for the target system. By default it is derived from RISCV_TOOLCHAIN_PATH.
|
|
42
|
+
if (NOT DEFINED RISCV_SYSROOT)
|
|
43
|
+
if (DEFINED ENV{RISCV_SYSROOT})
|
|
44
|
+
set(RISCV_SYSROOT "$ENV{RISCV_SYSROOT}")
|
|
45
|
+
else ()
|
|
46
|
+
set(RISCV_SYSROOT "${RISCV_TOOLCHAIN_PATH}/sysroot")
|
|
47
|
+
endif ()
|
|
48
|
+
endif ()
|
|
49
|
+
set(RISCV_SYSROOT "${RISCV_SYSROOT}" CACHE PATH "RISC-V sysroot for GNU cross-compilation")
|
|
50
|
+
set(ENV{RISCV_SYSROOT} "${RISCV_SYSROOT}")
|
|
51
|
+
set(CMAKE_SYSROOT "${RISCV_SYSROOT}")
|
|
52
|
+
|
|
53
|
+
# Target architecture with Vector extension (RVV 1.0)
|
|
54
|
+
# Default: Enables all extensions supported by NumKong
|
|
55
|
+
#
|
|
56
|
+
# Base architecture components:
|
|
57
|
+
# rv64gc : RV64 + G (IMAFD) + C (compressed)
|
|
58
|
+
# v : Vector extension (RVV 1.0)
|
|
59
|
+
# lp64d : 64-bit pointers, double-precision floats in FP registers
|
|
60
|
+
#
|
|
61
|
+
# Common profiles:
|
|
62
|
+
# rv64gcv : Base RVV 1.0 only
|
|
63
|
+
# rv64gcv_zvfh : RVV + fp16 (SiFive-class)
|
|
64
|
+
# rv64gcv_zvfh_zvfbfwma : RVV + fp16 + bf16
|
|
65
|
+
# rv64gcv_zvfh_zvfbfwma_zvbb : RVV + fp16 + bf16 + bit-manip (full NumKong support)
|
|
66
|
+
#
|
|
67
|
+
if (NOT DEFINED RISCV_MARCH)
|
|
68
|
+
if (DEFINED ENV{RISCV_MARCH})
|
|
69
|
+
set(RISCV_MARCH "$ENV{RISCV_MARCH}")
|
|
70
|
+
else ()
|
|
71
|
+
set(RISCV_MARCH "rv64gcv_zvfh_zvfbfwma_zvbb")
|
|
72
|
+
endif ()
|
|
73
|
+
endif ()
|
|
74
|
+
set(RISCV_MARCH "${RISCV_MARCH}" CACHE STRING "RISC-V ISA string for GNU cross-compilation")
|
|
75
|
+
set(ENV{RISCV_MARCH} "${RISCV_MARCH}")
|
|
76
|
+
|
|
77
|
+
if (NOT DEFINED RISCV_MABI)
|
|
78
|
+
if (DEFINED ENV{RISCV_MABI})
|
|
79
|
+
set(RISCV_MABI "$ENV{RISCV_MABI}")
|
|
80
|
+
else ()
|
|
81
|
+
set(RISCV_MABI "lp64d")
|
|
82
|
+
endif ()
|
|
83
|
+
endif ()
|
|
84
|
+
set(RISCV_MABI "${RISCV_MABI}" CACHE STRING "RISC-V ABI for GNU cross-compilation")
|
|
85
|
+
set(ENV{RISCV_MABI} "${RISCV_MABI}")
|
|
86
|
+
|
|
87
|
+
# Nested try_compile() projects re-enter this toolchain file, so forward the
|
|
88
|
+
# custom cross-compilation settings explicitly.
|
|
89
|
+
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES RISCV_TOOLCHAIN_PATH RISCV_SYSROOT RISCV_MARCH RISCV_MABI)
|
|
90
|
+
|
|
91
|
+
# Toolchain validation only needs to prove the project compiles.
|
|
92
|
+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
|
93
|
+
|
|
94
|
+
set(CMAKE_C_FLAGS_INIT "-march=${RISCV_MARCH} -mabi=${RISCV_MABI}")
|
|
95
|
+
set(CMAKE_CXX_FLAGS_INIT "-march=${RISCV_MARCH} -mabi=${RISCV_MABI}")
|
|
96
|
+
|
|
97
|
+
# QEMU user-mode emulation for running tests.
|
|
98
|
+
# -L sysroot provides the dynamic linker path.
|
|
99
|
+
# -cpu max enables all supported extensions, including zvfh and zvfbfwma when available.
|
|
100
|
+
set(CMAKE_CROSSCOMPILING_EMULATOR "qemu-riscv64;-L;${RISCV_SYSROOT};-cpu;max")
|
|
101
|
+
|
|
102
|
+
# Search paths for libraries and headers (target system only).
|
|
103
|
+
set(CMAKE_FIND_ROOT_PATH "${RISCV_SYSROOT}")
|
|
104
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
105
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
106
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
107
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# RISC-V 64 LLVM Clang toolchain for NumKong.
|
|
2
|
+
#
|
|
3
|
+
# Usage:
|
|
4
|
+
# cmake -B build_riscv_llvm -D CMAKE_TOOLCHAIN_FILE=cmake/toolchain-riscv64-llvm.cmake \
|
|
5
|
+
# -D RISCV_SYSROOT=/path/to/riscv64/sysroot
|
|
6
|
+
#
|
|
7
|
+
# Required inputs:
|
|
8
|
+
# -D RISCV_SYSROOT=/path/to/riscv64/sysroot
|
|
9
|
+
#
|
|
10
|
+
# Optional inputs:
|
|
11
|
+
# -D LLVM_ROOT=/path/to/llvm
|
|
12
|
+
# -D RISCV_TARGET=riscv64-unknown-linux-gnu
|
|
13
|
+
# -D RISCV_MARCH=rv64gcv_zvfh_zvfbfwma_zvbb
|
|
14
|
+
# -D RISCV_MABI=lp64d
|
|
15
|
+
|
|
16
|
+
set(CMAKE_SYSTEM_NAME Linux)
|
|
17
|
+
set(CMAKE_SYSTEM_PROCESSOR riscv64)
|
|
18
|
+
|
|
19
|
+
if (NOT DEFINED RISCV_SYSROOT)
|
|
20
|
+
if (DEFINED ENV{RISCV_SYSROOT})
|
|
21
|
+
set(RISCV_SYSROOT "$ENV{RISCV_SYSROOT}")
|
|
22
|
+
else ()
|
|
23
|
+
message(FATAL_ERROR "RISCV_SYSROOT must point to a riscv64 Linux sysroot for LLVM cross-compilation.")
|
|
24
|
+
endif ()
|
|
25
|
+
endif ()
|
|
26
|
+
set(RISCV_SYSROOT "${RISCV_SYSROOT}" CACHE PATH "RISC-V sysroot for LLVM cross-compilation")
|
|
27
|
+
set(ENV{RISCV_SYSROOT} "${RISCV_SYSROOT}")
|
|
28
|
+
|
|
29
|
+
if (NOT DEFINED RISCV_TARGET)
|
|
30
|
+
if (DEFINED ENV{RISCV_TARGET})
|
|
31
|
+
set(RISCV_TARGET "$ENV{RISCV_TARGET}")
|
|
32
|
+
else ()
|
|
33
|
+
set(RISCV_TARGET "riscv64-unknown-linux-gnu")
|
|
34
|
+
endif ()
|
|
35
|
+
endif ()
|
|
36
|
+
set(RISCV_TARGET "${RISCV_TARGET}" CACHE STRING "RISC-V target triple for LLVM cross-compilation")
|
|
37
|
+
set(ENV{RISCV_TARGET} "${RISCV_TARGET}")
|
|
38
|
+
|
|
39
|
+
if (NOT DEFINED RISCV_MARCH)
|
|
40
|
+
if (DEFINED ENV{RISCV_MARCH})
|
|
41
|
+
set(RISCV_MARCH "$ENV{RISCV_MARCH}")
|
|
42
|
+
else ()
|
|
43
|
+
set(RISCV_MARCH "rv64gcv_zvfh_zvfbfwma_zvbb")
|
|
44
|
+
endif ()
|
|
45
|
+
endif ()
|
|
46
|
+
set(RISCV_MARCH "${RISCV_MARCH}" CACHE STRING "RISC-V ISA string for LLVM cross-compilation")
|
|
47
|
+
set(ENV{RISCV_MARCH} "${RISCV_MARCH}")
|
|
48
|
+
|
|
49
|
+
if (NOT DEFINED RISCV_MABI)
|
|
50
|
+
if (DEFINED ENV{RISCV_MABI})
|
|
51
|
+
set(RISCV_MABI "$ENV{RISCV_MABI}")
|
|
52
|
+
else ()
|
|
53
|
+
set(RISCV_MABI "lp64d")
|
|
54
|
+
endif ()
|
|
55
|
+
endif ()
|
|
56
|
+
set(RISCV_MABI "${RISCV_MABI}" CACHE STRING "RISC-V ABI for LLVM cross-compilation")
|
|
57
|
+
set(ENV{RISCV_MABI} "${RISCV_MABI}")
|
|
58
|
+
|
|
59
|
+
if (NOT DEFINED LLVM_ROOT)
|
|
60
|
+
if (DEFINED ENV{LLVM_ROOT})
|
|
61
|
+
set(LLVM_ROOT "$ENV{LLVM_ROOT}")
|
|
62
|
+
elseif (EXISTS "/opt/homebrew/opt/llvm/bin/clang")
|
|
63
|
+
set(LLVM_ROOT "/opt/homebrew/opt/llvm")
|
|
64
|
+
elseif (EXISTS "/usr/local/opt/llvm/bin/clang")
|
|
65
|
+
set(LLVM_ROOT "/usr/local/opt/llvm")
|
|
66
|
+
endif ()
|
|
67
|
+
endif ()
|
|
68
|
+
if (DEFINED LLVM_ROOT)
|
|
69
|
+
set(LLVM_ROOT "${LLVM_ROOT}" CACHE PATH "LLVM toolchain root for cross-compilation")
|
|
70
|
+
set(ENV{LLVM_ROOT} "${LLVM_ROOT}")
|
|
71
|
+
endif ()
|
|
72
|
+
|
|
73
|
+
# Nested try_compile() projects re-enter this toolchain file, so forward the
|
|
74
|
+
# custom cross-compilation settings explicitly.
|
|
75
|
+
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES LLVM_ROOT RISCV_SYSROOT RISCV_TARGET RISCV_MARCH RISCV_MABI)
|
|
76
|
+
|
|
77
|
+
# Toolchain validation only needs to prove the project compiles.
|
|
78
|
+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
|
79
|
+
|
|
80
|
+
if (DEFINED LLVM_ROOT)
|
|
81
|
+
set(_NK_LLVM_BIN "${LLVM_ROOT}/bin")
|
|
82
|
+
set(CMAKE_C_COMPILER "${_NK_LLVM_BIN}/clang")
|
|
83
|
+
set(CMAKE_CXX_COMPILER "${_NK_LLVM_BIN}/clang++")
|
|
84
|
+
set(CMAKE_AR "${_NK_LLVM_BIN}/llvm-ar")
|
|
85
|
+
set(CMAKE_RANLIB "${_NK_LLVM_BIN}/llvm-ranlib")
|
|
86
|
+
if (EXISTS "${_NK_LLVM_BIN}/ld.lld")
|
|
87
|
+
set(CMAKE_LINKER "${_NK_LLVM_BIN}/ld.lld")
|
|
88
|
+
endif ()
|
|
89
|
+
else ()
|
|
90
|
+
find_program(CMAKE_C_COMPILER clang REQUIRED)
|
|
91
|
+
find_program(CMAKE_CXX_COMPILER clang++ REQUIRED)
|
|
92
|
+
find_program(CMAKE_AR llvm-ar REQUIRED)
|
|
93
|
+
find_program(CMAKE_RANLIB llvm-ranlib REQUIRED)
|
|
94
|
+
find_program(CMAKE_LINKER ld.lld)
|
|
95
|
+
endif ()
|
|
96
|
+
|
|
97
|
+
set(CMAKE_SYSROOT "${RISCV_SYSROOT}")
|
|
98
|
+
set(CMAKE_C_COMPILER_TARGET "${RISCV_TARGET}")
|
|
99
|
+
set(CMAKE_CXX_COMPILER_TARGET "${RISCV_TARGET}")
|
|
100
|
+
|
|
101
|
+
set(_NK_RISCV_FLAGS "--target=${RISCV_TARGET} --sysroot=${RISCV_SYSROOT} -march=${RISCV_MARCH} -mabi=${RISCV_MABI}")
|
|
102
|
+
set(CMAKE_C_FLAGS_INIT "${_NK_RISCV_FLAGS}")
|
|
103
|
+
set(CMAKE_CXX_FLAGS_INIT "${_NK_RISCV_FLAGS}")
|
|
104
|
+
|
|
105
|
+
find_program(_NK_QEMU_RISCV64 qemu-riscv64)
|
|
106
|
+
if (_NK_QEMU_RISCV64)
|
|
107
|
+
set(CMAKE_CROSSCOMPILING_EMULATOR "${_NK_QEMU_RISCV64};-L;${RISCV_SYSROOT};-cpu;max")
|
|
108
|
+
endif ()
|
|
109
|
+
|
|
110
|
+
set(CMAKE_FIND_ROOT_PATH "${RISCV_SYSROOT}")
|
|
111
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
112
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
113
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
114
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# WASI toolchain for NumKong (standalone WASM runtimes such as Wasmer and Wasmtime).
|
|
2
|
+
# Usage: cmake -B build-wasi -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-wasi.cmake -DNK_BUILD_TEST=ON
|
|
3
|
+
|
|
4
|
+
set(CMAKE_SYSTEM_NAME WASI)
|
|
5
|
+
set(CMAKE_SYSTEM_VERSION 1)
|
|
6
|
+
set(CMAKE_SYSTEM_PROCESSOR wasm32)
|
|
7
|
+
|
|
8
|
+
# Locate the WASI SDK.
|
|
9
|
+
if (NOT DEFINED WASI_SDK_PATH)
|
|
10
|
+
if (DEFINED ENV{WASI_SDK_PATH})
|
|
11
|
+
set(WASI_SDK_PATH "$ENV{WASI_SDK_PATH}")
|
|
12
|
+
elseif (EXISTS "$ENV{HOME}/wasi-sdk")
|
|
13
|
+
set(WASI_SDK_PATH "$ENV{HOME}/wasi-sdk")
|
|
14
|
+
else ()
|
|
15
|
+
message(
|
|
16
|
+
FATAL_ERROR
|
|
17
|
+
"WASI_SDK_PATH not set and ~/wasi-sdk not found.\n"
|
|
18
|
+
"Download from: https://github.com/WebAssembly/wasi-sdk/releases\n"
|
|
19
|
+
"Then set: export WASI_SDK_PATH=~/wasi-sdk"
|
|
20
|
+
)
|
|
21
|
+
endif ()
|
|
22
|
+
endif ()
|
|
23
|
+
|
|
24
|
+
file(TO_CMAKE_PATH "${WASI_SDK_PATH}" WASI_SDK_PATH)
|
|
25
|
+
|
|
26
|
+
# Windows SDK archives ship executable suffixes that Unix hosts do not use.
|
|
27
|
+
if (CMAKE_HOST_WIN32)
|
|
28
|
+
set(WASI_TOOL_SUFFIX ".exe")
|
|
29
|
+
else ()
|
|
30
|
+
set(WASI_TOOL_SUFFIX "")
|
|
31
|
+
endif ()
|
|
32
|
+
|
|
33
|
+
# Set compilers.
|
|
34
|
+
set(CMAKE_C_COMPILER "${WASI_SDK_PATH}/bin/clang${WASI_TOOL_SUFFIX}")
|
|
35
|
+
set(CMAKE_CXX_COMPILER "${WASI_SDK_PATH}/bin/clang++${WASI_TOOL_SUFFIX}")
|
|
36
|
+
set(CMAKE_AR "${WASI_SDK_PATH}/bin/llvm-ar${WASI_TOOL_SUFFIX}")
|
|
37
|
+
set(CMAKE_RANLIB "${WASI_SDK_PATH}/bin/llvm-ranlib${WASI_TOOL_SUFFIX}")
|
|
38
|
+
set(CMAKE_SYSROOT "${WASI_SDK_PATH}/share/wasi-sysroot")
|
|
39
|
+
set(CMAKE_FIND_ROOT_PATH "${WASI_SDK_PATH}")
|
|
40
|
+
|
|
41
|
+
# WASM SIMD flags (same as Emscripten for consistency).
|
|
42
|
+
set(WASM_SIMD_FLAGS "-msimd128 -mrelaxed-simd")
|
|
43
|
+
set(CMAKE_C_FLAGS_INIT "${WASM_SIMD_FLAGS} --target=wasm32-wasip1-threads -pthread")
|
|
44
|
+
set(CMAKE_CXX_FLAGS_INIT "${WASM_SIMD_FLAGS} --target=wasm32-wasip1-threads -pthread -fno-exceptions")
|
|
45
|
+
|
|
46
|
+
# Optimization flags.
|
|
47
|
+
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
|
|
48
|
+
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
|
49
|
+
set(CMAKE_C_FLAGS_DEBUG "-O0 -g")
|
|
50
|
+
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
|
|
51
|
+
|
|
52
|
+
# Linker flags for WASI.
|
|
53
|
+
set(CMAKE_EXE_LINKER_FLAGS_INIT
|
|
54
|
+
"-Wl,--allow-undefined \
|
|
55
|
+
-Wl,--import-memory -Wl,--export-memory \
|
|
56
|
+
-Wl,--shared-memory -Wl,--max-memory=2147483648 \
|
|
57
|
+
-Wl,--export=main \
|
|
58
|
+
-Wl,--export=_start"
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
# Do not look for programs in build-host directories.
|
|
62
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
63
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
64
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
65
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
|
66
|
+
|
|
67
|
+
# Verify the WASI SDK version.
|
|
68
|
+
if (EXISTS "${WASI_SDK_PATH}/VERSION")
|
|
69
|
+
file(READ "${WASI_SDK_PATH}/VERSION" WASI_SDK_VERSION)
|
|
70
|
+
string(STRIP "${WASI_SDK_VERSION}" WASI_SDK_VERSION)
|
|
71
|
+
message(STATUS "NumKong WASI: WASI-SDK ${WASI_SDK_VERSION}")
|
|
72
|
+
else ()
|
|
73
|
+
message(STATUS "NumKong WASI: WASI-SDK version unknown")
|
|
74
|
+
endif ()
|
|
75
|
+
|
|
76
|
+
message(STATUS "NumKong WASI: SIMD128 and Relaxed SIMD enabled")
|
|
77
|
+
message(STATUS "NumKong WASI: Toolchain at ${WASI_SDK_PATH}")
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# WASM/Emscripten toolchain for NumKong.
|
|
2
|
+
# Usage: cmake -B build-wasm -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-wasm.cmake
|
|
3
|
+
|
|
4
|
+
set(CMAKE_SYSTEM_NAME Emscripten)
|
|
5
|
+
set(CMAKE_SYSTEM_PROCESSOR wasm32)
|
|
6
|
+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
|
7
|
+
|
|
8
|
+
# Verify the Emscripten SDK.
|
|
9
|
+
if (NOT DEFINED ENV{EMSDK})
|
|
10
|
+
message(
|
|
11
|
+
FATAL_ERROR
|
|
12
|
+
"EMSDK environment variable not set.\n"
|
|
13
|
+
"Install Emscripten: https://emscripten.org/docs/getting_started/downloads.html\n"
|
|
14
|
+
"Then run: source $EMSDK/emsdk_env.sh"
|
|
15
|
+
)
|
|
16
|
+
endif ()
|
|
17
|
+
|
|
18
|
+
# Set compilers.
|
|
19
|
+
set(EMSCRIPTEN_ROOT "$ENV{EMSDK}/upstream/emscripten")
|
|
20
|
+
file(TO_CMAKE_PATH "${EMSCRIPTEN_ROOT}" EMSCRIPTEN_ROOT)
|
|
21
|
+
|
|
22
|
+
if (CMAKE_HOST_WIN32)
|
|
23
|
+
set(EMSCRIPTEN_TOOL_SUFFIX ".bat")
|
|
24
|
+
else ()
|
|
25
|
+
set(EMSCRIPTEN_TOOL_SUFFIX "")
|
|
26
|
+
endif ()
|
|
27
|
+
|
|
28
|
+
set(CMAKE_C_COMPILER "${EMSCRIPTEN_ROOT}/emcc${EMSCRIPTEN_TOOL_SUFFIX}")
|
|
29
|
+
set(CMAKE_CXX_COMPILER "${EMSCRIPTEN_ROOT}/em++${EMSCRIPTEN_TOOL_SUFFIX}")
|
|
30
|
+
set(CMAKE_AR "${EMSCRIPTEN_ROOT}/emar${EMSCRIPTEN_TOOL_SUFFIX}")
|
|
31
|
+
set(CMAKE_RANLIB "${EMSCRIPTEN_ROOT}/emranlib${EMSCRIPTEN_TOOL_SUFFIX}")
|
|
32
|
+
|
|
33
|
+
# Required WASM SIMD flags.
|
|
34
|
+
set(WASM_SIMD_FLAGS "-msimd128 -mrelaxed-simd")
|
|
35
|
+
set(CMAKE_C_FLAGS_INIT "${WASM_SIMD_FLAGS}")
|
|
36
|
+
set(CMAKE_CXX_FLAGS_INIT "${WASM_SIMD_FLAGS}")
|
|
37
|
+
|
|
38
|
+
# Enable GNU extensions for EM_ASM support (required for runtime detection).
|
|
39
|
+
set(CMAKE_C_EXTENSIONS ON CACHE BOOL "" FORCE)
|
|
40
|
+
set(CMAKE_CXX_EXTENSIONS ON CACHE BOOL "" FORCE)
|
|
41
|
+
|
|
42
|
+
# Optimization.
|
|
43
|
+
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG -flto")
|
|
44
|
+
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -flto")
|
|
45
|
+
set(CMAKE_C_FLAGS_DEBUG "-O0 -g -s ASSERTIONS=2")
|
|
46
|
+
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -s ASSERTIONS=2")
|
|
47
|
+
|
|
48
|
+
# Linker flags for Node.js execution.
|
|
49
|
+
set(CMAKE_EXE_LINKER_FLAGS_INIT
|
|
50
|
+
"-sALLOW_MEMORY_GROWTH=1 \
|
|
51
|
+
-sIMPORTED_MEMORY=1 \
|
|
52
|
+
-sINITIAL_MEMORY=64MB \
|
|
53
|
+
-sMAXIMUM_MEMORY=2GB \
|
|
54
|
+
-sSTACK_SIZE=5MB \
|
|
55
|
+
-sEXPORTED_FUNCTIONS=['_main'] \
|
|
56
|
+
-sEXPORTED_RUNTIME_METHODS=['ccall','cwrap']"
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# Verify the Emscripten version (3.1.27+ recommended for relaxed SIMD).
|
|
60
|
+
execute_process(
|
|
61
|
+
COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE EMCC_VERSION_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
62
|
+
)
|
|
63
|
+
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" EMCC_VERSION "${EMCC_VERSION_OUTPUT}")
|
|
64
|
+
|
|
65
|
+
if (EMCC_VERSION VERSION_LESS "3.1.27")
|
|
66
|
+
message(WARNING "Emscripten ${EMCC_VERSION} < 3.1.27. Upgrade recommended for relaxed SIMD.")
|
|
67
|
+
endif ()
|
|
68
|
+
|
|
69
|
+
message(STATUS "NumKong WASM: Emscripten ${EMCC_VERSION}")
|
|
70
|
+
message(STATUS "NumKong WASM: Relaxed SIMD enabled")
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# WASM64/Emscripten Memory64 toolchain for NumKong.
|
|
2
|
+
# Usage: cmake -B build-wasm64 -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-wasm64.cmake
|
|
3
|
+
|
|
4
|
+
set(CMAKE_SYSTEM_NAME Emscripten)
|
|
5
|
+
set(CMAKE_SYSTEM_PROCESSOR wasm64)
|
|
6
|
+
|
|
7
|
+
# Verify the Emscripten SDK.
|
|
8
|
+
if (NOT DEFINED ENV{EMSDK})
|
|
9
|
+
message(
|
|
10
|
+
FATAL_ERROR
|
|
11
|
+
"EMSDK environment variable not set.\n"
|
|
12
|
+
"Install Emscripten: https://emscripten.org/docs/getting_started/downloads.html\n"
|
|
13
|
+
"Then run: source $EMSDK/emsdk_env.sh"
|
|
14
|
+
)
|
|
15
|
+
endif ()
|
|
16
|
+
|
|
17
|
+
# Set compilers.
|
|
18
|
+
set(EMSCRIPTEN_ROOT "$ENV{EMSDK}/upstream/emscripten")
|
|
19
|
+
set(CMAKE_C_COMPILER "${EMSCRIPTEN_ROOT}/emcc")
|
|
20
|
+
set(CMAKE_CXX_COMPILER "${EMSCRIPTEN_ROOT}/em++")
|
|
21
|
+
set(CMAKE_AR "${EMSCRIPTEN_ROOT}/emar")
|
|
22
|
+
set(CMAKE_RANLIB "${EMSCRIPTEN_ROOT}/emranlib")
|
|
23
|
+
|
|
24
|
+
# Required WASM SIMD flags and Memory64.
|
|
25
|
+
set(WASM_SIMD_FLAGS "-msimd128 -mrelaxed-simd")
|
|
26
|
+
set(CMAKE_C_FLAGS_INIT "${WASM_SIMD_FLAGS} -sMEMORY64=1")
|
|
27
|
+
set(CMAKE_CXX_FLAGS_INIT "${WASM_SIMD_FLAGS} -sMEMORY64=1")
|
|
28
|
+
|
|
29
|
+
# Enable GNU extensions for EM_ASM support (required for runtime detection).
|
|
30
|
+
set(CMAKE_C_EXTENSIONS ON CACHE BOOL "" FORCE)
|
|
31
|
+
set(CMAKE_CXX_EXTENSIONS ON CACHE BOOL "" FORCE)
|
|
32
|
+
|
|
33
|
+
# Optimization.
|
|
34
|
+
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG -flto")
|
|
35
|
+
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -flto")
|
|
36
|
+
set(CMAKE_C_FLAGS_DEBUG "-O0 -g -s ASSERTIONS=2")
|
|
37
|
+
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -s ASSERTIONS=2")
|
|
38
|
+
|
|
39
|
+
# Linker flags for Node.js execution (larger memory limits for 64-bit).
|
|
40
|
+
set(CMAKE_EXE_LINKER_FLAGS_INIT
|
|
41
|
+
"-s MEMORY64=1 \
|
|
42
|
+
-s ALLOW_MEMORY_GROWTH=1 \
|
|
43
|
+
-s IMPORTED_MEMORY=1 \
|
|
44
|
+
-s INITIAL_MEMORY=256MB \
|
|
45
|
+
-s MAXIMUM_MEMORY=16GB \
|
|
46
|
+
-s STACK_SIZE=5MB \
|
|
47
|
+
-s EXPORTED_FUNCTIONS='[\"_main\"]' \
|
|
48
|
+
-s EXPORTED_RUNTIME_METHODS='[\"ccall\",\"cwrap\"]'"
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
# Verify the Emscripten version (3.1.35+ recommended for Memory64).
|
|
52
|
+
execute_process(
|
|
53
|
+
COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE EMCC_VERSION_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
54
|
+
)
|
|
55
|
+
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" EMCC_VERSION "${EMCC_VERSION_OUTPUT}")
|
|
56
|
+
|
|
57
|
+
if (EMCC_VERSION VERSION_LESS "3.1.35")
|
|
58
|
+
message(WARNING "Emscripten ${EMCC_VERSION} < 3.1.35. Upgrade recommended for Memory64 support.")
|
|
59
|
+
endif ()
|
|
60
|
+
|
|
61
|
+
message(STATUS "NumKong WASM64: Emscripten ${EMCC_VERSION}")
|
|
62
|
+
message(STATUS "NumKong WASM64: Relaxed SIMD + Memory64 enabled")
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# x86_64 LLVM Clang toolchain for NumKong.
|
|
2
|
+
#
|
|
3
|
+
# Native x86_64 hosts use this as a pinned LLVM toolchain.
|
|
4
|
+
# Apple Silicon hosts use it to target x86_64 macOS via `-arch x86_64`.
|
|
5
|
+
|
|
6
|
+
if (NOT DEFINED LLVM_ROOT)
|
|
7
|
+
if (EXISTS "/opt/homebrew/opt/llvm/bin/clang")
|
|
8
|
+
set(LLVM_ROOT "/opt/homebrew/opt/llvm")
|
|
9
|
+
elseif (EXISTS "/usr/local/opt/llvm/bin/clang")
|
|
10
|
+
set(LLVM_ROOT "/usr/local/opt/llvm")
|
|
11
|
+
endif ()
|
|
12
|
+
endif ()
|
|
13
|
+
|
|
14
|
+
if (DEFINED LLVM_ROOT)
|
|
15
|
+
set(_NK_LLVM_BIN "${LLVM_ROOT}/bin")
|
|
16
|
+
set(CMAKE_C_COMPILER "${_NK_LLVM_BIN}/clang")
|
|
17
|
+
set(CMAKE_CXX_COMPILER "${_NK_LLVM_BIN}/clang++")
|
|
18
|
+
set(CMAKE_AR "${_NK_LLVM_BIN}/llvm-ar")
|
|
19
|
+
set(CMAKE_RANLIB "${_NK_LLVM_BIN}/llvm-ranlib")
|
|
20
|
+
if (EXISTS "${_NK_LLVM_BIN}/ld.lld")
|
|
21
|
+
set(CMAKE_LINKER "${_NK_LLVM_BIN}/ld.lld")
|
|
22
|
+
endif ()
|
|
23
|
+
else ()
|
|
24
|
+
find_program(CMAKE_C_COMPILER clang REQUIRED)
|
|
25
|
+
find_program(CMAKE_CXX_COMPILER clang++ REQUIRED)
|
|
26
|
+
find_program(CMAKE_AR llvm-ar REQUIRED)
|
|
27
|
+
find_program(CMAKE_RANLIB llvm-ranlib REQUIRED)
|
|
28
|
+
find_program(CMAKE_LINKER ld.lld)
|
|
29
|
+
endif ()
|
|
30
|
+
|
|
31
|
+
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
|
32
|
+
|
|
33
|
+
if (APPLE)
|
|
34
|
+
set(CMAKE_SYSTEM_NAME Darwin)
|
|
35
|
+
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Target macOS architecture" FORCE)
|
|
36
|
+
set(CMAKE_C_FLAGS_INIT "-arch x86_64")
|
|
37
|
+
set(CMAKE_CXX_FLAGS_INIT "-arch x86_64")
|
|
38
|
+
|
|
39
|
+
if (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64|aarch64")
|
|
40
|
+
find_program(_NK_ARCH_PROGRAM arch)
|
|
41
|
+
if (_NK_ARCH_PROGRAM)
|
|
42
|
+
set(CMAKE_CROSSCOMPILING_EMULATOR "${_NK_ARCH_PROGRAM};-x86_64")
|
|
43
|
+
endif ()
|
|
44
|
+
endif ()
|
|
45
|
+
else ()
|
|
46
|
+
set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
|
|
47
|
+
endif ()
|