Installation
Note
Support for building from source on Windows is currently work in progress.
Prerequisites
Install the latest stable Rust. If Rust is already installed, please ensure you are using the latest stable version via:
rustup update stable
Install CMake.
Build Hyperon library from source
Clone the OpenCog Hyperon repository:
git clone https://github.com/trueagi-io/hyperon-experimental.git
Build and test the library:
cd ./lib
cargo build
cargo test
To enable logging during tests, execute this instead:
RUST_LOG=hyperon=debug cargo test
To generate the API docs, execute (under the lib directory):
cargo doc
Docs can then be found at ./lib/target/doc/hyperon/index.html.
Build C and Python API
Next, install the following Rust and Python libraries (must be executed in the root directory of the repository):
cargo install --force cbindgen
python -m pip install conan==1.47
python -m pip install -e ./python[dev]
Configure Conan for CMake:
On Linux, first find out your gcc version via:
gcc --version
Then, run the following command to configure Conan:
conan profile update settings.compiler=gcc default
conan profile update settings.compiler.version=<your gcc version> default
conan profile update settings.compiler.libcxx=libstdc++ default
On Mac OS, find out your clang version via:
clang --version
Then, run the following command to configure Conan:
conan profile update settings.compiler=clang default
conan profile update settings.compiler.version=<your clang version> default
conan profile update settings.compiler.libcxx=libc++ default
Then, setup the build via CMake:
mkdir -p build
cd build
cmake ..
Note
To run release build, use the following instead of cmake ..:
cmake -DCMAKE_BUILD_TYPE=Release ..
Build the API and run tests:
make
make check
Running Python examples from command line
In order to run Python examples, you need to add Python libraries into the PYTHONPATH environment variable after compilation:
cd build
export PYTHONPATH=$PYTHONPATH:`pwd`/python:`pwd`/../python
Language support for IDEs [Optional]
Different IDEs may require different tweaks to support the languages used in the codebase. The language servers which we use for development are:
clangd, generate compile commands for the
clangdusingcmakevariable:cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=Y ..
Docker Image
Alternatively, instead of building from source, a docker image can be used to run a reproducible environment. See instructions inside the Dockerfile. If the docker image doesn’t work, please raise an issue.