Skip to content

Getting started

tqfx edited this page May 4, 2024 · 1 revision

Getting started

Please install any of the following C/C++ compilers:

First obtain the source code, you can choose to use git to clone or download the compressed package.

git clone https://github.com/tqfx/liba
cd liba
curl -LOC- https://github.com/tqfx/liba/archive/main.zip
unzip main.zip
cd liba-main

C

cmake

If you use cmake, you need at least 2.8.12 installed.

Installation

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DBUILD_TESTING=0
cmake --build . --target install

Demonstration

├──CMakeLists.txt
└──main.c

mkdir build
cd build
cmake ..
cmake --build .

meson

Installation

meson setup build --prefix=$PREFIX
meson install -C build

xmake

Installation

xmake f
xmake
xmake i -o $PREIFX

conan with cmake

Installation

conan export .

Demonstration

├──CMakeLists.txt
└──conanfile.txt
└──main.c

conan install . -of build -b missing
cmake --preset conan-release
cmake --build --preset conan-release

vcpkg with cmake

Installation

mkdir build
cd build
cmake .. -DLIBA_VCPKG=1
cp -r vcpkg/* path/to/vcpkg

Demonstration

├──CMakeLists.txt
└──main.c
└──vcpkg.json

mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=path/to/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build .

autoconf

curl -LOC- https://github.com/tqfx/liba/releases/download/0.1.12/liba-0.1.12.tar.gz
tar -xf liba-0.1.12.tar.gz
cd liba-0.1.12

Installation

./configure --prefix=$PREFIX
make install

Java

Install using cmake

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DBUILD_TESTING=0 -DLIBA_JAVA=1
cmake --build . --target install

Install using meson

meson setup build --prefix=$PREFIX -Djava=$JAVA_HOME
meson install -C build

Install using xmake

xmake f --liba-java=y
xmake
xmake i -o $PREFIX

Demonstration

├──example.java
└──manifest

cp $PREFIX/lib/jni/* .
cp $PREFIX/share/java/liba.jar .
javac -cp liba.jar example.java
jar -cfem example.jar example manifest example.class liba.*
java -jar example.jar

JavaScript

npm

Installation

npm i @tqfx/liba

Demonstration

├──index.js
└──package.json

node .

Lua

luarocks

Installation

release

luarocks install liba

latest

luarocks install liba --dev

Demonstration

└──main.lua

lua main.lua

cmake

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DBUILD_TESTING=0 -DLIBA_LUA=1 -DLua_FIND_VERSION=5.1
cmake --build . --target install

meson

meson setup build --prefix=$PREFIX -Dlua=lua5.1
meson install -C build

meson

xmake f --liba-lua=lua5.1
xmake
xmake i -o $PREFIX

Python

pip

Installation

release

export LIBA_OPENMP=1
pip install liba

latest

export LIBA_OPENMP=1
pip install git+https://github.com/tqfx/liba

Demonstration

└──main.py

python main.py

QuickJS

cmake

Install using cmake

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DBUILD_TESTING=0 -DLIBA_QUICKJS=1
cmake --build . --target install

Install using meson

meson setup build --prefix=$PREFIX -Dquickjs=path/to/quickjs
meson install -C build

Install using xmake

xmake f --liba-quickjs=y
xmake
xmake i -o $PREFIX

Demonstration

cp $PREFIX/lib/quickjs/liba.so .

├──main.js
└──liba.so

qjs main.js

Rust

cargo

Installation

release

cargo add liba

latest

cargo add --git https://github.com/tqfx/liba

Demonstration

├──Cargo.toml
└──src/main.rs

cargo run