Package: acoustic-odometry
Acoustic OdometryA standalone C++ library with dependencies managed byvcpkgaccessible through Python usingpybind11.Example usageCreate a clean Python virtual environmentpython -m venv venvActivate it on Windows.\venv\Scripts\activateotherwisesource ./venv/bin/activateInstall this projectpip install git+https://github.com/AcousticOdometry/AO.gitorpip install git+ssh://git@github.com/AcousticOdometry/AO.gitIt will take a while to build as it will build the C++ dependencies as well,
but it will work. It is definitely not the most optimal way of installing a
package as we are installing as well thevcpkgpackage manager and building
from source dependencies that might as well be installed on the system. But
this allows a fast development environment where adding or removing C++
dependencies should be easy.Test that the C++ code is working in the Python packageTODOSetupInstall the requirementsInstallvcpkgrequirements with the
addition ofcmakeand Python. It could be summarized as:gitBuild tools (Visual
Studioon Windows orgccon Linux for example)cmakePython. Make sure to have development tools installed (python3.X-devon
Linux, beingXyour version of Python).If running on a clean linux environment (like a container or Windows Subsystem
for Linux) you will need to install some additional tools as it is stated invcpkg.sudo apt-get install build-essential curl zip unzip tar pkg-config libssl-dev python3-devThis library is additionally based on modern C++17 with some C++20 features.
Therefore it requires a C++ compiler that supports C++20. In linux,gccversion 11 is recommended. Fortunately,several versions ofgcccan co-live
together.sudo apt install software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-11 g++-11
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 \
    --slave /usr/bin/g++ g++ /usr/bin/g++-11Git Large File SystemNeeded for the model fileshttps://git-lfs.github.com/CMakeFollow theofficial instructions.The requiredcmakeversion is quite high, if you are using a Linux
distribution and installingcmakefrom the repositories take into account
that they might not be updated to the latest version. However there are options
toinstall the latest version ofcmakefrom the command
line.Make sure that when you runcmake --versionthe output is3.21or higher.
The reason for this is that we are using some of the3.21features to install
runtime dependencies (managed withvcpkg) together with our project so they
are available to Python when using its API.Clone this repository withvcpkgCone this repository withvcpkgas a submodule and navigate into it.git clone --recursive git@github.com:esdandreu/python-extension-cpp.git
cd python-extension-cppBootstrapvcpkgin Windows. Make sure you haveinstalled the
prerequisites..\vcpkg\bootstrap-vcpkg.batOr in Linux/MacOS. Make sure you haveinstalled developer
tools./vcpkg/bootstrap-vcpkg.shBuildingBuild locally with CMakeNavigate to the root of the repository and create a build directory.mkdir buildConfigurecmaketo usevcpkg.cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE="$pwd/vcpkg/scripts/buildsystems/vcpkg.cmake"Build the project.cmake --build buildBuild locally with PythonIt is recommended to use aclean virtual
environment.scikit-buildis required before running the installer, as it is the package
that takes care of the installation. The rest of dependencies will be installed
automatically.pip install scikit-buildInstall the repository. By adding[test]to our install command we can
install additionally the test dependencies.pip install .[test]TestingTest the C++ library with Google Testctest --test-dir build/testsTest the python extensionpytestDevelopmentWe try to use the following style guide forpybind11https://developer.lsst.io/pybind11/style.htmlMount Google Drive in Windows Subsystem for Linuxsudo mount -t drvfs G: /mnt/g