Skip to content
René Fonseca edited this page Mar 10, 2020 · 7 revisions

Make sure GIT, cmake, make, and compiler (e.g. g++) are installed.

Debug build

git clone https://dev.azure.com/renefonseca/base/_git/base
cd base
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug
cmake --build .. --config Debug --target install -- -j 4
./testing/unittesting
ctest . -C Debug

Release build

git clone https://dev.azure.com/renefonseca/base/_git/base
cd base
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .. --config Release --target install -- -j 4
./testing/unittesting
ctest . -C Release

Debug build with Ninja on Windows

git clone https://dev.azure.com/renefonseca/base/_git/base
cd base
mkdir build
cd build
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=install -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" -DCMAKE_C_COMPILER="C:/Program Files/LLVM/bin/clang.exe" -DCMAKE_RC_COMPILER="C:/Program Files/LLVM/bin/llvm-rc.exe"'
cmake --build .. --config Debug --target install -- -j 4
testing\unittesting
ctest . -C Debug

Debug and Release conflicts

Debug and release builds are NOT compatible. This is because a few classes (e.g. DynamicObject) have extra data members to simplify issue diagnostics.

The framework is set up to automatically detect conflicts at runtime such that you generally cannot by accident use a wrong library.

The runtime checks are done in the application stub that is run when you use APPLICATION_STUB to tell which entry function to run. However, you can call the checks explicitly also. Which is relevant when you are developing a library rather than an executable.

The macro _COM_AZURE_DEV__BASE__CHECK_SHARED_STATIC() ensures that you link against a matching shared/static build. If you get a linking error with missing symbol "_COM_AZURE_DEV__BASE__BUILD_SHARED" you are likely trying to use the static build of the framework instead of the dynamic/shared build. And if the missing symbol is "_COM_AZURE_DEV__BASE__BUILD_STATIC" then you are trying to use the dynamic/shared build instead of the expected static build.

_COM_AZURE_DEV__BASE__CHECK_VERSION() validates that the framework has a compatible major version from what was expected at compile time for your project.

And _COM_AZURE_DEV__BASE__CHECK_DEBUG_RELEASE() ensure that you do not mix debug and release builds. If you get a system error with missing symbol "_COM_AZURE_DEV__BASE__BUILD_RELEASE" you are likely trying to use the debug build of the framework instead of the release build. And if the missing symbol is "_COM_AZURE_DEV__BASE__BUILD_DEBUG" then you are trying to use the release build instead of the expected debug build.

Clone this wiki locally