900f215858 | ||
---|---|---|
.gitignore | ||
CMakeLists.txt | ||
LICENSE | ||
README.md | ||
clang_windows_toolchain.cmake | ||
main.cpp |
README.md
Cross Compiling a Qt5 App using Clang and CMake
Example that uses CMake, Clang, and Qt to cross compile a simple application for Windows with MSVC compatibility.
Parts of it based on: https://gist.github.com/HiImJulien/3eb47d7d874fe5483810bd77940e74c0
Requirements
- Clang Version 10
- Visual Studio Build Tools: https://visualstudio.microsoft.com/downloads/
- Qt5: https://download.qt.io/official_releases/qt
Instructions Linux
Requirements:
- Qt5 development packages
- Clang 10
Steps
- Copy MSVC build tools into the project directory:
- Copy
C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/<MSVC Version>
tomsvc_build_tools/MSVC
- Copy
- Copy Windows SDK into the project directory:
- From
C:/Program Files (x86)/Windows Kits/10
copy the foldersInclude
tomsvc_build_tools/Kit
Lib
tomsvc_build_tools/Kit
- Both directories have sub directories with the Windows SDK Version as name.
- Adjust
clang_windows_toolchain.cmake
to use the proper Windows SDK Version in variableWINSDK_VER
- From
- Copy the Qt5 msvc development files into the project directory:
- Copy
C:/Qt/Qt5.12.10/5.12.10/msvc2017_64
toqt5_msvc2017_64
- Copy
- Configure project using:
cmake -DCMAKE_TOOLCHAIN_FILE=clang_windows_toolchain.cmake <project dir>
Instructions Windows with JetBrains CLion
Requirements:
- Download and Install Qt5 (MinGW libraries not needed)
- Clang 10 (https://releases.llvm.org/download.html)
- Install MinGW Make
- Install JetBrains CLion (https://jetbrains.com/clion)
Steps
- Open project
- Adjust Toolchain
- Go to Toolchain Settings
- Remove existing Toolchains
- Add MinGW Toolchain
- Adjust CMake Profiles
- Add
-DCMAKE_TOOLCHAIN_FILE=clang_windows_toolchain.cmake
as CMake parameters
- Add