2022-05-10 20:10:34 +00:00
# CPP App
## Setup dependencies
2022-07-21 18:04:11 +00:00
Note: if not stated otherwise the commands should be run from the root of the source tree
2022-05-10 20:10:34 +00:00
### 1. conancenter
Execute `conan remote list` . It should return this line among the results:
```bash
conancenter: https://center.conan.io [Verify SSL: True]
```
If it doesn't, consider upgrading conan with `pip install conan --upgrade` and then executing. `conan remote add -i 0 conancenter https://center.conan.io` . See [conan's documentation ](https://docs.conan.io/en/latest/uploading_packages/remotes.html#conancenter ) for more info.
### 2. conan libstdc++11
This applies to linux: the default conan profile does not work, since GCC uses the new C++ ABI since version 5.1 and conan, for compatibility purposes uses the old C++ ABI.
Execute this to update the profile:
```bash
conan profile update settings.compiler.libcxx=libstdc++11 default
```
### 2. Install dependencies
2022-07-21 18:04:11 +00:00
Install latest Qt release 6.3.X
2022-05-10 20:10:34 +00:00
Platform specific conan profile
- Macos:
2022-07-21 18:04:11 +00:00
- Apple silicon: `conan install . --profile=vendor/conan-configs/apple-arm64.ini -s build_type=Release --build=missing -if=build/conan -of=build`
- Intel: `conan install . --profile=vendor/conan-configs/apple-x86_64.ini -s build_type=Release --build=missing -if=build/conan -of=build`
2022-05-10 20:10:34 +00:00
- Windows: TODO
2022-07-21 18:04:11 +00:00
- Linux: `conan install . --profile=./vendor/conan-configs/linux.ini -s build_type=Release --build=missing -if=build/conan -of=build`
2022-05-10 20:10:34 +00:00
2022-06-07 10:58:06 +00:00
## Buid, test & run
2022-05-10 20:10:34 +00:00
2022-07-21 18:04:11 +00:00
Update `CMake` to the [Latest Release ](https://cmake.org/download/ ) or use the Qt's "$QTBASE/Tools/CMake/..."
2022-05-10 20:10:34 +00:00
### Build with cmake
```bash
2022-06-07 10:58:06 +00:00
# linux
2022-07-21 18:04:11 +00:00
cmake -B build -S . -DCMAKE_PREFIX_PATH="$HOME/Qt/6.3.2/gcc_64" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=build/conan/conan_toolchain.cmake
2022-06-07 10:58:06 +00:00
2022-07-21 18:04:11 +00:00
# MacOS: cmake -B build -S . -DCMAKE_PREFIX_PATH="$HOME/Qt/6.3.2/macos" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=build/conan/conan_toolchain.cmake
2022-06-07 10:58:06 +00:00
2022-07-21 18:04:11 +00:00
# Windows: cmake -B build -S . -DCMAKE_PREFIX_PATH="$HOME/Qt/6.3.2/mingw_64" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=build/conan/conan_toolchain.cmake
2022-06-07 10:58:06 +00:00
2022-07-26 11:49:03 +00:00
cmake --build build
2022-05-10 20:10:34 +00:00
```
2022-07-21 18:04:11 +00:00
### Run tests
```bash
ctest --test-dir ./build
```
2022-08-10 10:08:21 +00:00
### Build with QtCreator
If go is installed with brew use the following configuration otherwise adapt the configuration.
Go to QtCreator's preferences navigate to Environment -> System -> Environment -> Change and paste
```ini
GOBIN=${GOPATH}/bin
GOPATH=${HOME}/go
PATH=${PATH}:${GOBIN}:/opt/homebrew/bin:/opt/homebrew/sbin
```