Deploy CamiTK with your extensions
Once your extension has reached a stable state, the next step is often to give it to another user or developer so that it can test it. This is what we call “distribute and deploy your CamiTK extensions”.
The dependency chain might be quite fragile when it comes to C++ where there is not (yet) an official package manager, especially on Windows.
This page provides a recipe to easily get all you need to run CamiTK and your extensions (called mycep
henceforward) on another computer (called the target computer henceforward) than the one you used to develop (called the developer computer henceforward).
The steps heavily depends on your operating system.
Distribute and deploy on Windows
On Windows, the most difficult part is to list and get all the DLL dependencies that were used to build your package.
If the developer computer is not cluttered with tons of software and libraries, deploying is easy thanks to four tools that are automatically installed during the [Windows setup]/docs/install/windows-setup/ : bash
, copypedeps
, windeployqt
and 7z
.
- on the developer computer
- build and install your extension in
%CAMITK_INSTALL_DRIVE%\%CAMITK_INSTALL_ROOT%
(see [Windows setup]/docs/install/windows-setup/). In Microsoft Visual Studio, this is done for instance by building theINSTALL
target inDebug
andRelease
version. - Open a git bash prompt, change directory to
%CAMITK_INSTALL_DRIVE%\%CAMITK_INSTALL_ROOT%\..
and run the following script:
- build and install your extension in
#!/bin/bash
echo "Preparing..."
# assuming that %CAMITK_INSTALL_DRIVE%\%CAMITK_INSTALL_ROOT% ends with /install, change if needed
INSTALL_DIR=$(pwd)/install
SHORT_VERSION=$(ls $INSTALL_DIR/lib | cut -f2 -d-)
if [ ! -d "$INSTALL_DIR" ]; then
echo "Install directory $INSTALL_DIR not found"
exit
fi
echo "Creating package deployment directory"
PACKAGE_NAME=camitk-$SHORT_VERSION
PACKAGE_DIR=$(pwd)/$PACKAGE_NAME
rm -rf $PACKAGE_NAME
mkdir $PACKAGE_NAME
cd $PACKAGE_NAME
echo "Copying basic dependencies..."
copypedeps.exe -r $INSTALL_DIR/bin/camitk-imp.exe $PACKAGE_DIR
echo "Copying Qt dependencies..."
windeployqt.exe --release $INSTALL_DIR/bin/camitk-imp.exe --dir $PACKAGE_DIR
echo "Copying CamiTK libraries, extensions and user executables..."
cp -pR $INSTALL_DIR/lib $PACKAGE_DIR
cp -p $INSTALL_DIR/bin/camitk-config.exe $PACKAGE_DIR
cp -p $INSTALL_DIR/bin/camitk-actionstatemachine.exe $PACKAGE_DIR
cp -pR $INSTALL_DIR/bin/monitoring.dll $PACKAGE_DIR # specific case not detected by copypedeps
echo "Copying CamiTK extensions dependencies..."
for i in $INSTALL_DIR/lib/camitk-$SHORT_VERSION/*/*.dll; do
echo "- copying $i dependencies..."
copypedeps.exe -r -n $i $PACKAGE_DIR;
done
echo "- cleaning up..."
for i in $INSTALL_DIR/lib/camitk-$SHORT_VERSION/*/*.dll; do rm -f $(basename $i); done # to remove the extension dll themselves
find $PACKAGE_DIR -name "*.lib" -exec rm {} \;
echo "Creating camitk5.zip..."
cd ..
rm -rf camitk-$SHORT_VERSION.zip
7z a -tzip camitk-$SHORT_VERSION.zip $PACKAGE_NAME
- on the target computer
- extracted the
camitk-$SHORT_VERSION.zip
archive - run the application from the extracted directory
- extracted the
Distribute and deploy on Linux
Option 1 : build from source (recommended)
This is the most universal way of distributing your code. As the CamiTK setup on Linux is really simple thanks to Linux package manager, this is also quite fast although it requires access to the target computer.
- on the developer computer
- build the
camitk-mycep-package-source
target. This will generate a source package archive ready to use.
- build the
- on the target computer
- follow the the setup guide and installation guide
- extract your source package archive ready
- build it as you would do on the developer computer (add any specific dependencies if required)
Option 2 : using the official package version
On Linux, if you are using the official package for your distribution, these are the steps to follow on the other machine:
- on the developer computer
- configure your CEP so that it is going to install in a specific isolated directory. This is done setting the
CMAKE_INSTALL_PREFIX
to an empty directory (e.g.,cmake path/to/src -DCMAKE_INSTALL_PREFIX=/opt/mycep
) - build the global install target (i.e.,
cmake --build --target camitk-mycep-global-install
). This will install all your build objects in the isolated directory - create an archive of this directory (e.g.,
mycep.tar.gz
)
- configure your CEP so that it is going to install in a specific isolated directory. This is done setting the
- on the target computer
- install
camitk-imp
orcamitk-actionstatemachine
using the official package version - extract the archive
- change directory to the top level extracted directory and run
camitk-imp
orcamitk-actionstatemachine
- install
Note on multiplatform support
CamiTK Community Edition uses the exact same source code to build executable on Windows, Linux and MacOS.
This should also be the case for your extension projects (providing that you respect the header filenames caps, did not use hard path and managed DLL import/export).
Having a source code that is build using more than one compiler on more than one platform is an good way to improve its quality as it will benefit from different warning messages and becomes more hardware/installation independent.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.