Failed to build QML project with error MSB8013
Unsolved
Installation and Deployment
-
Hello, I am trying to build the QML app for Windows on github actions with msvc2019_64 compiler.
The workflow is follows
on: release: types: [created] env: QT_VERSION: "6.5.1" COMPILER_PATH: "msvc2019_64" BUILD_TYPE: Release jobs: build: runs-on: windows-latest steps: - uses: actions/checkout@v2 with: submodules: true - name: Install Qt if: steps.cache-qt.outputs.cache-hit != 'true' uses: jurplel/install-qt-action@v3 with: aqtversion: '==3.1.*' version: ${{ env.QT_VERSION }} host: 'windows' target: 'desktop' arch: 'win64_msvc2019_64' dir: '${{ github.workspace }}' modules: 'qtconnectivity' tools: 'tools_cmake tools_ifw' - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.1 with: msbuild-architecture: x64 - name: Configure CMake and Build run: | mkdir build cmake -S . -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -A x64 cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
So I have provided the Release and x64 flags to the cmake.
My cmake file iscmake_minimum_required(VERSION 3.21.1) set(BUILD_QDS_COMPONENTS ON CACHE BOOL "Build design studio components") project(myApp LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) find_package(QT NAMES Qt6 COMPONENTS Gui Qml Quick) find_package(Qt6 REQUIRED COMPONENTS Core Qml Quick Bluetooth) if (Qt6_VERSION VERSION_LESS 6.5.0) message(FATAL_ERROR "You need Qt 6.5.0 or newer to build the application.") endif() qt_add_executable(${CMAKE_PROJECT_NAME} src/main.cpp src/searchhighlighter.h src/searchhighlighter.cpp src/searchcomponent.h src/searchcomponent.cpp src/loghighlighter.h src/loghighlighter.cpp src/linemanager.h src/linemanager.cpp src/filehandler.h src/filehandler.cpp src/bluetooth.h src/bluetooth.cpp src/deviceinfo.h src/deviceinfo.cpp src/messagemodel.h src/messagemodel.cpp src/devicemodel.h src/devicemodel.cpp ) if(WIN32) if(CMAKE_SIZEOF_VOID_P MATCHES 8) target_link_directories(${CMAKE_PROJECT_NAME} PRIVATE lib/jlink/windows) target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE JLink_x64) else() target_link_directories(${CMAKE_PROJECT_NAME} PRIVATE lib/jlink/windows) target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE JLinkARM) endif() elseif(APPLE) target_link_directories(${CMAKE_PROJECT_NAME} PRIVATE lib/jlink/macos) target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE jlinkarm) elseif(UNIX) target_link_directories(${CMAKE_PROJECT_NAME} PRIVATE lib/jlink/linux) target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE jlinkarm) endif() target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_DL_LIBS}) set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES AUTOMOC TRUE AUTOUIC TRUE AUTORCC TRUE INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/src" ) target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/jlink ) # qt_standard_project_setup() requires Qt 6.3 or higher. See https://doc.qt.io/qt-6/qt-standard-project-setup.html for details. if (${QT_VERSION_MINOR} GREATER_EQUAL 3) qt6_standard_project_setup() endif() qt_add_resources(${CMAKE_PROJECT_NAME} "configuration" PREFIX "/" FILES qtquickcontrols2.conf ) qt_add_resources(${CMAKE_PROJECT_NAME} "res" PREFIX "/" FILES qml.qrc ) target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Quick Qt${QT_VERSION_MAJOR}::Qml Qt${QT_VERSION_MAJOR}::Bluetooth ) if (${BUILD_QDS_COMPONENTS}) include(${CMAKE_CURRENT_SOURCE_DIR}/qmlcomponents) endif () include(${CMAKE_CURRENT_SOURCE_DIR}/qmlmodules)
My qml files are placed in separate folder where I have the next CmakeList.txt
### This file is automatically generated by Qt Design Studio. ### Do not change set_source_files_properties(AppSettings.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE ) qt_add_library(content STATIC) qt6_add_qml_module(content URI "content" VERSION 1.0 QML_FILES App.qml ToolPanel.qml PagePanel.qml SideButton.qml ConsolePage.qml DeviceLog.qml InteractiveShell.qml CommandHistory.qml BluetoothWelcome.qml ConsoleWelcome.qml TextView.qml TextLabel.qml Bluetooth.qml AppNotification.qml AppSettings.qml LoadingIndicator.qml Search.qml BtDeviceInfo.qml RESOURCES fonts/fonts.txt )
I can compile perfectly fine on my Windows machine with Qt Creator, however as the build and deploy comes to the automation I am not able to build my application. My build step fails with error:
-- Configuring done (69.4s) -- Generating done (1.5s) -- Build files have been written to: D:/a/qmlqt/qmlqt/build MSBuild version 17.6.3+07e294721 for .NET Framework C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(452,5): error MSB8013: This project doesn't contain the Configuration and Platform combination of Release|x64. [D:\a\qmlqt\qmlqt\build\ZERO_CHECK.vcxproj]
I do not want to omit the Release flag, because I do not want to lose optimization step for my app. Any ideas what am I doing wrong?