Building QT 6.6.2 for Windows and Android

I installed MS Visual Studio, Android Studio and the following tools:

cmake-3.24.2-windows-x86_64
nasm-2.15.05
ninja-win
Python35
Strawberry
VulkanSDK
x86_64-12.2.0-release-win32-seh-rt_v10-rev0

and built QT for Windows with the following commands:

"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64

set MY_DRIVE=C:

%MY_DRIVE%
mkdir \dev\build\qt
cd \dev\build\qt
       
set "CMAKE_ROOT=%MY_DRIVE%\dev\tools\cmake-3.24.2-windows-x86_64\bin"
set "NINJA_ROOT=%MY_DRIVE%\dev\tools\ninja-win"
set "PERL_ROOT=%MY_DRIVE%\dev\tools\Strawberry\perl\bin"
set "PYTHON_ROOT=%MY_DRIVE%\dev\tools\Python35"
set VULKAN_SDK=%MY_DRIVE%/dev/tools/VulkanSDK/1.3.239.0
       
set PATH=%CMAKE_ROOT%;%PATH%
set PATH=%NINJA_ROOT%;%PATH%
set PATH=%PERL_ROOT%;%PATH%
set PATH=%PYTHON_ROOT%;%PATH%
       
rem Check if the tools are in PATH
where perl.exe
where python.exe
where cmake.exe
where ninja.exe
where powershell
       
set MY_INSTALL_PATH=%MY_DRIVE%/dev/libs/Qt6/windows
set MY_QT_SRC_DIR=%MY_DRIVE%\dev\repos\qt-everywhere-src-6.6.2
set MY_OPENSSL_DIR=%MY_DRIVE%/dev/libs/OpenSSL
set CL=/MP
 
%MY_QT_SRC_DIR%\configure.bat -prefix %MY_INSTALL_PATH% -DQT_NO_EXCEPTIONS=1 ^
  -debug-and-release -force-debug-info -platform win32-msvc -opensource -confirm-license ^
  -c++std c++20 -static -static-runtime -openssl-linked ^
  -skip qt3d -skip qt5compat -skip qtactiveqt -skip qtcharts -skip qtcoap -skip qtconnectivity ^
  -skip qtdatavis3d -skip qtdoc -skip qtlottie -skip qtmqtt -skip qtnetworkauth -skip qtopcua ^
  -skip qtserialport -skip qtpositioning -skip qtlocation -skip qtquicktimeline -skip qtquick3d -skip qtremoteobjects ^
  -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtvirtualkeyboard -skip qtwayland -skip qtgraphs ^
  -skip qtwebchannel -skip qtwebengine -skip qtwebview -skip qtquick3dphysics -skip qtspeech -skip qthttpserver ^
  -I %VULKAN_SDK%/Include -L %VULKAN_SDK%/Lib -feature-vulkan -make examples ^
  -- -D OPENSSL_ROOT_DIR=%MY_OPENSSL_DIR% -D OPENSSL_USE_STATIC_LIBS=ON ^
&& cmake --build . --parallel && ninja install

Then I built QT for Android with the following commands:

set MY_DRIVE=C:

%MY_DRIVE%
mkdir \dev\build\qta
cd \dev\build\qta
     
set "CMAKE_ROOT=%MY_DRIVE%\dev\tools\cmake-3.24.2-windows-x86_64\bin"
set "NINJA_ROOT=%MY_DRIVE%\dev\tools\ninja-win"
set "PERL_ROOT=%MY_DRIVE%\dev\tools\Strawberry\perl\bin"
set "MINGW_ROOT=%MY_DRIVE%\dev\tools\x86_64-12.2.0-release-win32-seh-rt_v10-rev0\mingw64\bin"
set "PYTHON_ROOT=%MY_DRIVE%\dev\tools\Python35"
set "JDK_ROOT=C:\Program Files\Android\Android Studio\jbr\bin"
             
rem set PATH=C:\WINDOWS\system32;C:\WINDOWS
set PATH=%CMAKE_ROOT%;%PATH%
set PATH=%NINJA_ROOT%;%PATH%
set PATH=%MINGW_ROOT%;%PATH%
set PATH=%PERL_ROOT%;%PATH%
set PATH=%PYTHON_ROOT%;%PATH%
set PATH=%JDK_ROOT%;%PATH%
               
rem Check if the tools are in PATH
where gcc
where mingw32-make.exe
where perl.exe
where python.exe
where cmake.exe
where ninja.exe
where javac.exe
where powershell
            
set MY_QT_SRC_DIR=%MY_DRIVE%\dev\repos\qt-everywhere-src-6.6.2
set MY_QT_HOST_PATH=%MY_DRIVE%/dev/libs/Qt6/windows
set MY_OPENSSL_DIR=%MY_DRIVE%/dev/libs/android_openssl/static
     
set "MY_ANDROID_SDK_ROOT=C:\Users\dmitr\AppData\Local\Android\Sdk"
set "MY_ANDROID_NDK_PATH=C:\Users\dmitr\AppData\Local\Android\Sdk\ndk\26.2.11394342"
set "MY_ANDROID_NDK_PLATFORM=android-23"
set "MY_ANDROID_BUILD_TOOLS_REVISION=34.0.0"

rem set "MY_ANDROID_BUILD_ABI=x86_64"
rem set "MY_ANDROID_BUILD_ABI=x86"
set "MY_ANDROID_BUILD_ABI=arm64-v8a"
rem set "MY_ANDROID_BUILD_ABI=armeabi-v7a"
 
set MY_MODE=release
rem set MY_MODE=debug
rem set MY_MODE=debug-and-release
    
%MY_QT_SRC_DIR%\configure.bat -prefix %MY_DRIVE%/dev/libs/Qt6/android/%MY_MODE%/%MY_ANDROID_BUILD_ABI% -qt-host-path %MY_QT_HOST_PATH% -%MY_MODE% ^
  -platform win32-msvc -xplatform android-clang -force-debug-info -opensource -confirm-license ^
  -c++std c++20 -DQT_NO_EXCEPTIONS=1 -openssl-runtime ^
  -android-sdk %MY_ANDROID_SDK_ROOT% -android-ndk %MY_ANDROID_NDK_PATH% -android-ndk-platform %MY_ANDROID_NDK_PLATFORM% -android-abis %MY_ANDROID_BUILD_ABI% ^
  -skip qt3d -skip qt5compat -skip qtactiveqt -skip qtcharts -skip qtcoap -skip qtconnectivity ^
  -skip qtdatavis3d -skip qtdoc -skip qtlottie -skip qtmqtt -skip qtnetworkauth -skip qtopcua ^
  -skip qtserialport -skip qtpositioning -skip qtlocation -skip qtquicktimeline -skip qtquick3d -skip qtremoteobjects ^
  -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtvirtualkeyboard -skip qtwayland -skip qtgraphs ^
  -skip qtwebchannel -skip qtwebengine -skip qtwebview -skip qtquick3dphysics -skip qtspeech -skip qthttpserver ^
  -- -D OPENSSL_ROOT_DIR=%MY_OPENSSL_DIR% ^
&& cmake --build . --parallel && cmake --install .

See Configuring QT Creator with QT 6.6.2.

Leave a Reply

Your email address will not be published. Required fields are marked *