This is an adaptation of the parrot groundsdk https://github.com/Parrot-Developers to run on Windows, but as CMake is used it, compiles on Linux too. This has been done:
- Some code fixes
- Most of the work has been to translate the
atom.mk
files toCMakeLists.txt
build files.
git clone [path-to-this-repo]
git submodule update --init --recursive
git submodule foreach "git switch master"
Mingw-x64 gcc must be installed and used, MSVC does not work! Below is a good guide to follow. Consider installing VSCode too. https://code.visualstudio.com/docs/cpp/config-mingw
- Get the latest version of Mingw-w64 via MSYS2, which provides up-to-date native builds of GCC, Mingw-w64, and other helpful C++ tools and libraries. You can download the latest installer from the MSYS2 page or use this link to the installer.
- Follow the Installation instructions on the MSYS2 website to install Mingw-w64. Take care to run each required Start menu and pacman command.
- Install the Mingw-w64 toolchain
pacman -S --needed base-devel mingw-w64-x86_64-toolchain
Run the pacman command in a MSYS2 terminal. Accept the default to install all the members in the toolchain group. - Add the path to your Mingw-w64 bin folder to the Windows PATH environment variable.
- You also need to add the MingW-CMake
pacman -S mingw-w64-x86_64-cmake
Then you need vcpkg and some packages. How to install vcpkg is described here but it is just a few powershell commands. https://learn.microsoft.com/en-us/vcpkg/users/platforms/mingw
Microsoft recommend vcpkg to be installed somewhere like C:\src\vcpkg or C:\dev\vcpkg, since otherwise you may run into path issues for some port build systems. Below the install is at C:\vcpkg
cd C:\
git clone https://github.com/microsoft/vcpkg
.\vcpkg\bootstrap-vcpkg.bat
$Env:VCPKG_DEFAULT_TRIPLET="x64-mingw-dynamic"
$Env:VCPKG_DEFAULT_HOST_TRIPLET="x64-mingw-dynamic"
.\vcpkg.exe install json-c eigen3 ffmpeg[avcodec,avdevice,avfilter,avformat,swresample,swscale,zlib] --triplet=x64-mingw-dynamic
Take some coffee as the above will take a while.
.\vcpkg.exe install protobuf-c[tools] --triplet=x64-mingw-dynamic
If it fails (see here: microsoft/vcpkg#29677)
Then do this patch in your vcpkg directory.
diff --git a/ports/protobuf-c/portfile.cmake b/ports/protobuf-c/portfile.cmake
index 0a972cb27..4bcce7017 100644
--- a/ports/protobuf-c/portfile.cmake
+++ b/ports/protobuf-c/portfile.cmake
@@ -26,7 +26,7 @@ vcpkg_copy_pdbs()
if("tools" IN_LIST FEATURES)
vcpkg_copy_tools(
- TOOL_NAMES protoc-gen-c protoc-c
+ TOOL_NAMES protoc-gen-c
AUTO_CLEAN
)
endif()
and run again
.\vcpkg.exe install protobuf-c[tools] --triplet=x64-mingw-dynamic
Then run
.\vcpkg.exe integrate install
To run on Linux it is only a few shell commands:
sudo apt install -y cmake gcc g++ gdb curl pkg-config ninja-build nasm
cd ~
git clone https://github.com/microsoft/vcpkg
./vcpkg/bootstrap-vcpkg.sh
./vcpkg/vcpkg install json-c eigen3 protobuf-c[tools] ffmpeg[avcodec,avdevice,avfilter,avformat,swresample,swscale,zlib] --triplet=x64-linux-dynamic
~/vcpkg integrate install
If you use VSCode, add this to your settings (press Ctrl+,
) to open settings in UI mode. Switch to json text mode by clickin the first of the 3 icons on the top right-hand side (the one looking like a file).
Add this to the settings.json
:
{
"cmake.configureSettings": {
"CMAKE_TOOLCHAIN_FILE": "[path to vcpkg]/scripts/buildsystems/vcpkg.cmake",
"CMAKE_INSTALL_PREFIX": "${workspaceFolder}/install"
}
}
To build with CMake manually do this in the workdirectory:
mkdir build
mkdir install
cd build
cmake "-DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_INSTALL_PREFIX=../install" "-DCMAKE_C_COMPILER:FILEPATH=C:/msys64/mingw64/bin/gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:/msys64\mingw64/bin/g++.exe" ..
cmake --build .
cmake --build . --target install
You may test the application with the following file https://drive.google.com/file/d/1FjdZM7qyQEJHX9SPQCBFUkr0ptrn5vO1/view?usp=sharing
./install/bin/parrot.exe P0260026.MP4