Qtstarter
C++/Qt5 Quick and Widgets starter project with cmake build system and macOS deployment
Install / Use
/learn @ArneGockeln/QtstarterREADME
qtstarter
C++/Qt5 starter project with cmake build system, QtQuick, QtWidgets, AppIcon, macOS bundle and macdeployqt support.
Usage
-
Clone the repository.
-
Add the path of your Qt installation to your
~/.bash_profile:
# there should be an entry like this:
export PATH="$PATH:~/sourcecode/sdk/QtLatest/5.12.0/clang_64/"
- Add the bin path of your CMake installation to your
~/.bash_profile:
# there should be an entry like this:
export PATH="$PATH:/Applications/CMake.app/Contents/bin"
-
If you want to make a QtQuick app use the
quick_appfolder. For a QtWidgets app use thewidgets_appfolder. -
Edit the
CMakeLists.txtfile and set theCMAKE_PREFIX_PATHvariable to your Qt bin path as described in 2.
Build a debug version
Just run ./build.sh in your app root directory. It will create a build directory and compile the app. On every run the script removes the build directory entirely. To prevent this, go to the build directory and run make.
Build a release version and deploy
- Check that the program
macdeployqtis within your PATH variable.
$ which macdeployqt
$ ~/sourcecode/sdk/QtLatest/5.13.0/clang_64/bin/macdeployqt
-
In the folder
res/there is a fileAppIcon.icnsandAppIcon.png. Replace these files with your AppIcon. -
In
CMakeLists.txton line 4-9 set the variables to your needs. -
Again run
./build.shin your app root directory but with parameterrelease:
$ ./build.sh release
When finished there is a bundle AppName.app and a AppName.dmg in the build folder ready to ship.
CLI / GUI Mode
You can run the app in cli or gui mode by using command line parameters:
$ ./quickapp -h
Usage: ./quickapp [options]
AppName
Options:
-h, --help Displays this help.
-v, --version Displays version information.
-c, --cli Run in cli mode only.
Or in the release bundle:
$ ./AppName.app/Contents/MacOS/AppName -h
Usage: ./AppName.app/Contents/MacOS/AppName [options]
AppName
Options:
-h, --help Displays this help.
-v, --version Displays version information.
-c, --cli Run in cli mode only.
Test
Tested with the following environment:
- macOS Mojave 10.14.3
- CLion 2019.2
- Qt 5.13 clang_64
- CMake 3.13.3
Related Skills
tmux
353.1kRemote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output.
diffs
353.1kUse the diffs tool to produce real, shareable diffs (viewer URL, file artifact, or both) instead of manual edit summaries.
terraform-provider-genesyscloud
Terraform Provider Genesyscloud
blogwatcher
353.1kMonitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.
