With Botfather one can write crossplatform bots for Android, Desktop and Web (browser) applications in JavaScript. For this purpose Botfather provides several JavaScript APIs featuring image matching and more. Furthermore scripts can be turned into crossplatform binaries using the Botfather Binary Generator Tool (bingen for short).
- Install gcc and cmake (e.g.
sudo pacman -S gcc cmake
) - Install
Qt5
, including the Qt5Script module (e.g.sudo pacman -S qt5
) - Install
libgit2
(e.g.sudo pacman -S libgit2
) - Install
opencv
(e.g.sudo pacman -S opencv
) - Download the CEF binary distribution and point
CEF_ROOT
to itwget https://cef-builds.spotifycdn.com/cef_binary_3.3578.1861.g1992780_linux64.tar.bz2
tar -xvf cef_binary_3.3578.1861.g1992780_linux64.tar.bz2
export CEF_ROOT=$(pwd)/cef_binary_3.3578.1861.g1992780_linux64
- Clone the repository and enter the directory
- Build the project
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
We use these builds for testing Flatpak runtimes and to pre-build the binaries we later ship to Flathub.
- Install the runtime and matching SDK:
flatpak install flathub org.kde.Platform//5.15-23.08 org.kde.Sdk//5.15-23.08
- Build the app and put it in a repository:
flatpak-builder --repo=flatpak/repo --force-clean flatpak/build-dir flatpak/io.botfather.Nightly.yaml
- Install and run the app for testing:
flatpak --user install ./flatpak/repo io.botfather.Nightly
flatpak run io.botfather.Nightly
- Install Visual Studio including the
Desktop development with C++
option - Install CMake
- Install Qt 5.15.2
- Enable the
Archive
version filter to list Qt 5 releases - Make sure to install the
Qt Script
module - Add
C:\Qt\5.15.2\msvc2015_64
to theCMAKE_PREFIX_PATH
environment variable
- Enable the
- Set up Chromium Embedded Framework (CEF)
- Download https://cef-builds.spotifycdn.com/cef_binary_3.3578.1861.g1992780_windows64.tar.bz2
- Extract the archive to a persistent location
- Set the
CEF_ROOT
environment variable to the extracted directory
- Set up OpenCV 4
- Download and run the OpenCV installer for Windows
- Select the OpenCV directory and a build directory in CMake
- Configure and make sure
opencv_world
is selected - Generate and open the project
- Build
ALL_BUILD
in the Release configuration - Point the
OPENCV_ROOT
environment variable to the build directory
- Set up libgit2
- Download and extract the latest libgit2 release
- Select the libgit2 directory and a build directory in CMake
- Configure, generate, and open the project
- Build
ALL_BUILD
in the Release configuration - Add the libgit2 source and
build/Release
directories to theCMAKE_PREFIX_PATH
environment variable
- Build Botfather
- Clone the
botfather
repository - Select the
botfather
directory and a build directory in CMake - Configure, generate, and open the project
- Build
ALL_BUILD
in the Release configuration - Copy
git2.dll
andopencv_world4xxx.dll
to thebuild/bin/Release
directory
- Clone the
-
Install the C/C++ VSCode Extension
-
Update the extension's IntelliSense configuration
-
Open the Command Palette (
Ctrl+Shift+P
) -
Search for
>C/C++: Edit Configurations (UI)
-
Add third-party dependencies to the
Include path
sectionOn Arch Linux, the following should be sufficient:
${workspaceFolder}/** /usr/include/qt/** /usr/include/opencv4/** /path/to/cef_binary_3.3578.1861.g1992780_linux64/**
On Windows, something like this should work:
${workspaceFolder}/** C:\Qt\5.15.2\msvc2015_64\include\** C:\LIBGIT2\libgit2-1.8.2\include\** C:\OPENCV\4.10.0\build\include\** C:\CEF\cef_binary_3.3578.1861.g1992780_windows64\**
-
This means there's no webhelper
binary next to the botfather
binary.
Fix this problem by placing a webhelper
binary next to the botfather
binary matching the platform and build type.
Rebuild the both webhelper
and botfather
.
Look up the latest supported CEF Release Branches and attempt to use it. In case the version appears unstable, use the release CefSharp is based on.
Add the following build options to the io.botfather.Nightly.yaml
to prevent the builder from stipping debug symbols from the build.
"build-options": {
"no-debuginfo": true,
"strip": false
}
Then start a shell in the sandbox using flatpak-builder --run <build-dir> <manifest> sh
.
Now use gdb
, strace
, ldd
and so on to debug.
More infos can be found in the Flatpak documentation on debugging.