# An algorithm library {#mainpage}
[![docs](https://github.com/tqfx/liba/actions/workflows/docs.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/docs.yml)
[![conan](https://github.com/tqfx/liba/actions/workflows/conan.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/conan.yml)
[![xmake](https://github.com/tqfx/liba/actions/workflows/xmake.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/xmake.yml)
[![meson](https://github.com/tqfx/liba/actions/workflows/meson.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/meson.yml)
[![wasm](https://github.com/tqfx/liba/actions/workflows/wasm.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/wasm.yml)
[![msvc](https://github.com/tqfx/liba/actions/workflows/msvc.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/msvc.yml)
[![linux](https://github.com/tqfx/liba/actions/workflows/linux.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/linux.yml)
[![macos](https://github.com/tqfx/liba/actions/workflows/macos.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/macos.yml)
[![mingw](https://github.com/tqfx/liba/actions/workflows/mingw.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/mingw.yml)
[![msys2](https://github.com/tqfx/liba/actions/workflows/msys2.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/msys2.yml)
[![freebsd](https://github.com/tqfx/liba/actions/workflows/freebsd.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/freebsd.yml)
## documentation
- [C/C++](https://tqfx.org/liba/)
- [Lua](https://tqfx.org/liba/lua/)
- [Java](https://tqfx.org/liba/java/)
- [Rust](https://tqfx.org/liba/rust/liba/)
## required tools
- C/C++ compiler: [tcc](https://bellard.org/tcc) or [gnu](https://gcc.gnu.org) or [llvm](https://clang.llvm.org) or [msvc](https://visualstudio.microsoft.com/visual-cpp-build-tools) etc
## optional tools
- [lua](https://www.lua.org)
- [java](https://www.oracle.com/java)
- [rust](https://www.rust-lang.org)
- [emsdk](https://emscripten.org)
- [xmake](https://xmake.io)
- [cmake](https://cmake.org)
- [conan](https://conan.io)
- [vcpkg](https://vcpkg.io)
- [meson](https://mesonbuild.com)
- [python](https://www.python.org)
- [quickjs](https://github.com/bellard/quickjs)
## build
### xmake
```bash
xmake f
xmake
xmake i
```
### cmake
```bash
cmake -S . -B build
cmake --build build
cmake --install build
```
### meson
```bash
meson setup build
meson install -C build
```
### vcpkg
```bash
cmake -S . -B build -DLIBA_VCPKG=1
```
```bash
cp -r build/vcpkg/* $VCPKG_INSTALLATION_ROOT
```
```pwsh
cp -r -Force build/vcpkg/* $ENV:VCPKG_INSTALLATION_ROOT
```
### conan
```bash
conan create .
```
### cargo
```bash
cargo build --release
```
### cython
```bash
python setup.py build_ext --inplace
```
## usage
### C/C++
#### xmake.lua
```lua
add_requires("alib") -- static
add_requires("liba") -- shared
```
#### CMakeLists.txt
```cmake
find_package(liba CONFIG REQUIRED)
target_link_libraries(<TARGET> PRIVATE alib) # static
target_link_libraries(<TARGET> PRIVATE liba) # shared
```
#### conanfile.txt
```txt
[requires]
liba/[~0.1]
```
### Lua
```bash
luarocks install liba # release
```
```bash
luarocks install liba --dev # latest
```
#### main.lua
```lua
local liba = require("liba")
print("version", liba.VERSION)
```
### Java
#### Main.java
```java
public class Main {
public static void main(String[] args) {
System.out.println("version " + liba.VERSION);
}
}
```
### Rust
#### Cargo.toml
```bash
cargo add liba # release
```
```bash
cargo add --git https://github.com/tqfx/liba # latest
```
#### main.rs
```rs
use liba;
fn main() {
println!(
"version {}.{}.{}+{}",
liba::version::major(),
liba::version::minor(),
liba::version::patch(),
liba::version::tweak()
);
}
```
### Python
```bash
export LIBA_OPENMP=1
pip install liba # release
```
```bash
pip install git+https://github.com/tqfx/liba # latest
```
#### main.py
```py
import liba
print("version", liba.VERSION)
```
### JavaScript
```bash
npm i @tqfx/liba
```
#### index.js
```js
import liba from "@tqfx/liba";
console.log("version", liba.VERSION);
```
### QuickJS
#### main.js
```js
import * as liba from "liba.so";
console.log("version", liba.VERSION);
```
## Copyright {#copyright}
Copyright (C) 2020-present tqfx, All rights reserved.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
Raw data
{
"_id": null,
"home_page": "https://github.com/tqfx/liba",
"name": "liba",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "algorithms",
"author": "tqfx",
"author_email": "tqfx@tqfx.org",
"download_url": "https://files.pythonhosted.org/packages/91/c7/172a51a0887517191e5292f320d21f93410d1b7c540a0e6447dca496d48e/liba-0.1.12.tar.gz",
"platform": "CPython",
"description": "# An algorithm library {#mainpage}\n\n[![docs](https://github.com/tqfx/liba/actions/workflows/docs.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/docs.yml)\n[![conan](https://github.com/tqfx/liba/actions/workflows/conan.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/conan.yml)\n[![xmake](https://github.com/tqfx/liba/actions/workflows/xmake.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/xmake.yml)\n[![meson](https://github.com/tqfx/liba/actions/workflows/meson.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/meson.yml)\n[![wasm](https://github.com/tqfx/liba/actions/workflows/wasm.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/wasm.yml)\n[![msvc](https://github.com/tqfx/liba/actions/workflows/msvc.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/msvc.yml)\n[![linux](https://github.com/tqfx/liba/actions/workflows/linux.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/linux.yml)\n[![macos](https://github.com/tqfx/liba/actions/workflows/macos.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/macos.yml)\n[![mingw](https://github.com/tqfx/liba/actions/workflows/mingw.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/mingw.yml)\n[![msys2](https://github.com/tqfx/liba/actions/workflows/msys2.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/msys2.yml)\n[![freebsd](https://github.com/tqfx/liba/actions/workflows/freebsd.yml/badge.svg)](https://github.com/tqfx/liba/actions/workflows/freebsd.yml)\n\n## documentation\n\n- [C/C++](https://tqfx.org/liba/)\n- [Lua](https://tqfx.org/liba/lua/)\n- [Java](https://tqfx.org/liba/java/)\n- [Rust](https://tqfx.org/liba/rust/liba/)\n\n## required tools\n\n- C/C++ compiler: [tcc](https://bellard.org/tcc) or [gnu](https://gcc.gnu.org) or [llvm](https://clang.llvm.org) or [msvc](https://visualstudio.microsoft.com/visual-cpp-build-tools) etc\n\n## optional tools\n\n- [lua](https://www.lua.org)\n- [java](https://www.oracle.com/java)\n- [rust](https://www.rust-lang.org)\n- [emsdk](https://emscripten.org)\n- [xmake](https://xmake.io)\n- [cmake](https://cmake.org)\n- [conan](https://conan.io)\n- [vcpkg](https://vcpkg.io)\n- [meson](https://mesonbuild.com)\n- [python](https://www.python.org)\n- [quickjs](https://github.com/bellard/quickjs)\n\n## build\n\n### xmake\n\n```bash\nxmake f\nxmake\nxmake i\n```\n\n### cmake\n\n```bash\ncmake -S . -B build\ncmake --build build\ncmake --install build\n```\n\n### meson\n\n```bash\nmeson setup build\nmeson install -C build\n```\n\n### vcpkg\n\n```bash\ncmake -S . -B build -DLIBA_VCPKG=1\n```\n\n```bash\ncp -r build/vcpkg/* $VCPKG_INSTALLATION_ROOT\n```\n\n```pwsh\ncp -r -Force build/vcpkg/* $ENV:VCPKG_INSTALLATION_ROOT\n```\n\n### conan\n\n```bash\nconan create .\n```\n\n### cargo\n\n```bash\ncargo build --release\n```\n\n### cython\n\n```bash\npython setup.py build_ext --inplace\n```\n\n## usage\n\n### C/C++\n\n#### xmake.lua\n\n```lua\nadd_requires(\"alib\") -- static\nadd_requires(\"liba\") -- shared\n```\n\n#### CMakeLists.txt\n\n```cmake\nfind_package(liba CONFIG REQUIRED)\ntarget_link_libraries(<TARGET> PRIVATE alib) # static\ntarget_link_libraries(<TARGET> PRIVATE liba) # shared\n```\n\n#### conanfile.txt\n\n```txt\n[requires]\nliba/[~0.1]\n```\n\n### Lua\n\n```bash\nluarocks install liba # release\n```\n\n```bash\nluarocks install liba --dev # latest\n```\n\n#### main.lua\n\n```lua\nlocal liba = require(\"liba\")\nprint(\"version\", liba.VERSION)\n```\n\n### Java\n\n#### Main.java\n\n```java\npublic class Main {\n public static void main(String[] args) {\n System.out.println(\"version \" + liba.VERSION);\n }\n}\n```\n\n### Rust\n\n#### Cargo.toml\n\n```bash\ncargo add liba # release\n```\n\n```bash\ncargo add --git https://github.com/tqfx/liba # latest\n```\n\n#### main.rs\n\n```rs\nuse liba;\nfn main() {\n println!(\n \"version {}.{}.{}+{}\",\n liba::version::major(),\n liba::version::minor(),\n liba::version::patch(),\n liba::version::tweak()\n );\n}\n```\n\n### Python\n\n```bash\nexport LIBA_OPENMP=1\npip install liba # release\n```\n\n```bash\npip install git+https://github.com/tqfx/liba # latest\n```\n\n#### main.py\n\n```py\nimport liba\nprint(\"version\", liba.VERSION)\n```\n\n### JavaScript\n\n```bash\nnpm i @tqfx/liba\n```\n\n#### index.js\n\n```js\nimport liba from \"@tqfx/liba\";\nconsole.log(\"version\", liba.VERSION);\n```\n\n### QuickJS\n\n#### main.js\n\n```js\nimport * as liba from \"liba.so\";\nconsole.log(\"version\", liba.VERSION);\n```\n\n## Copyright {#copyright}\n\nCopyright (C) 2020-present tqfx, All rights reserved.\n\nThis Source Code Form is subject to the terms of the Mozilla Public\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\nfile, You can obtain one at <https://mozilla.org/MPL/2.0/>.\n",
"bugtrack_url": null,
"license": "MPL-2.0",
"summary": "An algorithm library based on C/C++",
"version": "0.1.12",
"project_urls": {
"Homepage": "https://github.com/tqfx/liba"
},
"split_keywords": [
"algorithms"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "91c7172a51a0887517191e5292f320d21f93410d1b7c540a0e6447dca496d48e",
"md5": "134bf7b24eb6f5b68245cca35d905fbf",
"sha256": "bb05dd400505742ddd410eefc9b68aa18b9f268ef9de7352f2692c0be322cb88"
},
"downloads": -1,
"filename": "liba-0.1.12.tar.gz",
"has_sig": false,
"md5_digest": "134bf7b24eb6f5b68245cca35d905fbf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 341473,
"upload_time": "2024-04-20T11:49:45",
"upload_time_iso_8601": "2024-04-20T11:49:45.390283Z",
"url": "https://files.pythonhosted.org/packages/91/c7/172a51a0887517191e5292f320d21f93410d1b7c540a0e6447dca496d48e/liba-0.1.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-20 11:49:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tqfx",
"github_project": "liba",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "setuptools",
"specs": []
},
{
"name": "cython",
"specs": []
}
],
"lcname": "liba"
}