Some additions for QCoreApplication, QGuiApplication and QApplication.
List of commits and CI pipeline status
This library is composed of some components:
Component | Description | Main dependency |
---|---|---|
CoreApplicationForNonQtUsage | Provide a QCoreApplication for a non Qt application | QtCore |
GuiApplicationForNonQtUsage | Provide a QGuiApplication for a non Qt application | QtGui |
ConsoleApplication | Helpers to create console application with Qt | QtCore |
CommandLineArguments | Helper class to init and copy command line arguments | None |
This example will use ConsoleApplication. The principle is the same for the other components.
For the usage of classes and functions for all components, see the API documentation
Update your CMakeLists.txt to use the required libraries:
cmake_minimum_required(VERSION 3.15)
project(MyApp)
find_package(Threads REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Core)
find_package(Mdt0 REQUIRED COMPONENTS ConsoleApplication )
add_executable(myApp myApp.cpp)
target_link_libraries(myApp Mdt0::ConsoleApplication)
If you use Conan,
add MdtConsoleApplication as requirement in your conanfile.txt
:
[requires]
mdtconsoleapplication/x.y.z@scandyna/testing
[generators]
CMakeDeps
CMakeToolchain
VirtualBuildEnv
Add the remote:
conan remote add gitlab https://gitlab.com/api/v4/projects/25668674/packages/conan
Install the dependencies:
mkdir build && cd build
conan install .. --profile your_profile -s build_type=Debug
If you don't use the native compiler, and your Conan profile defines one (or it defines some other environments), bring the required environment to the current shell:
source conanbuild.sh
On Windows:
.\conanbuild.bat
Configure your project:
cmake -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake ..
Maybe adjust some settings:
cmake-gui .
Build:
cmake --build . --config Debug
To run the tests:
ctest --output-on-failure -C Debug -j4 .
If applicable, restore the previous shell environment:
source deactivate_conanbuild.sh
On Windows:
.\deactivate_conanbuild.bat
For a list of available packages, and also some other details, see Conan packages README.
For more details about conan install and build options, see the BUILD documentation.
It is also possible to install MdtApplication locally. See INSTALL.
Then, configure your project and specify the path of the installed MdtApplication and the dependencies:
cmake -DCMAKE_PREFIX_PATH="/some/path/MdtApplication;/some/path/MdtCMakeConfig;/some/path/MdtCMakeModules;/some/path/qt/Qt5/5.15.2/gcc_64" ..
See BUILD.
See README in the conan packaging folder.