Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. how to run windeployqt automaticaly after project build via cmake?
Forum Updated to NodeBB v4.3 + New Features

how to run windeployqt automaticaly after project build via cmake?

Scheduled Pinned Locked Moved Solved Installation and Deployment
5 Posts 2 Posters 2.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shokarta
    wrote on 13 Oct 2023, 10:01 last edited by
    #1

    Hello Gurus,

    tho there are milions of example online, i tried most of them and nothing either works (cmake syntax O.o) or it just dont do anything.

    Therefore if I can only ask for the very basic hello world example which uppon build of project, it would just run the the standard command for windeployqt, something like if i would manualy do:

    c:\Qt\6.6.0\mingw_64\bin\windeployqt6.exe --qmldir c:\Qt\Projects\Sources\game_test c:\Qt\Projects\Builds\build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release\appgame_test.exe --compiler-runtime
    

    i tried realy everything how to make it from the CMAKE of my project... tho out of luck...
    Can I kindly ask for the very basic example?

    Thank you

    J 1 Reply Last reply 13 Oct 2023, 20:29
    0
    • S shokarta
      16 Oct 2023, 09:16

      Hello @jsulm ,

      great, thank you for the link... i did read it through and i see i can do the only top part before "Under the hood",

      I very much like this sentense "Say you have just started with Qt.".
      Which I havent just started, but doing some advanced JS/QML and basics c++ stuff does not mean i understand the process of compilation and how to set up the QT/system for working the way I need, this is a bit od advance which I learn step by step by needing stuff and of course from your help...

      • therefore please appology for the questions you my find "wtf how come this guy asks question when already working with Qt?"

      So, this is my cmake:

      cmake_minimum_required(VERSION 3.16)
      
      set(APPNAME "game_test")
      set(PROJECT "app${APPNAME}")
      
      project(${APPNAME} LANGUAGES CXX)
      
      set(CMAKE_AUTOMOC ON)
      set(CMAKE_AUTOUIC ON)
      set(CMAKE_AUTORCC ON)
      set(CMAKE_CXX_STANDARD_REQUIRED ON)
      set(CMAKE_INCLUDE_CURRENT_DIR ON)
      
      find_package(Qt6 COMPONENTS Quick REQUIRED)
      qt_standard_project_setup()
      
      qt_add_executable(${PROJECT}
          main.cpp
      # in theory if i add here third party lib files, then will they be ported automaticaly?
      )
      
      qt_add_qml_module(${PROJECT}
          URI ${APPNAME}
          VERSION 1.0
          RESOURCE_PREFIX /
          QML_FILES
              main.qml
              JavaScript.js
      
          RESOURCES
      #        android/AndroidManifest.xml
      #		 some other image files
      
      )
      
      set_target_properties(${PROJECT} PROPERTIES
          WIN32_EXECUTABLE TRUE
      )
      
      target_link_libraries(${PROJECT}
          PRIVATE Qt6::Quick)
      
      
      if(ANDROID)
          set_target_properties(${PROJECT} PROPERTIES
              QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android"
          )
      endif()
      
      
      install(TARGETS ${PROJECT}
          BUNDLE DESTINATION .
          LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
          RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
      )
      
      # also tried qt_generate_deploy_qml_app_script() but makes no difference
      qt_generate_deploy_app_script(
          TARGET ${PROJECT}
          OUTPUT_SCRIPT deploy_script
          NO_UNSUPPORTED_PLATFORM_ERROR
      )
      install(SCRIPT ${deploy_script})
      

      so QT does not report any error/warning in this cmake, so upon compile, the build dir is created, lots of stuff are being created (as usual) and exe file is generated... however the dlls are not copied as if i would run windeployqt.exe myself after the build:
      9b262bd6-7fc4-4e99-8ca7-7edb33247e61-image.png

      General Messages:

      Running C:\Qt\Tools\CMake_64\bin\cmake.exe -S C:/Qt/Projects/Sources/game_test -B C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release "-DCMAKE_GENERATOR:STRING=Ninja" "-DCMAKE_BUILD_TYPE:STRING=Release" "-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=C:\Qt\Projects\Builds\build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/.qtc/package-manager/auto-setup.cmake" "-DQT_QMAKE_EXECUTABLE:FILEPATH=C:/Qt/6.6.0/mingw_64/bin/qmake.exe" "-DCMAKE_PREFIX_PATH:PATH=C:/Qt/6.6.0/mingw_64" "-DCMAKE_C_COMPILER:FILEPATH=C:/Qt/Tools/mingw1120_64/bin/gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:/Qt/Tools/mingw1120_64/bin/g++.exe" "-DCMAKE_CXX_FLAGS_INIT:STRING=" in C:\Qt\Projects\Builds\build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release.
      -- The CXX compiler identification is GNU 11.2.0
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: C:/Qt/Tools/mingw1120_64/bin/g++.exe - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
      -- Found Threads: TRUE  
      -- Performing Test HAVE_STDATOMIC
      -- Performing Test HAVE_STDATOMIC - Success
      -- Found WrapAtomic: TRUE  
      -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) 
      -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) 
      -- Configuring done
      -- Generating done
      -- Build files have been written to: C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release
      Elapsed time: 00:06.
      

      Compile Output:

      15:37:57: Running steps for project game_test...
      15:37:57: Starting: "C:\Qt\Tools\CMake_64\bin\cmake.exe" --build C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release --target all
      [1/41 7.0/sec] Copying Main.qml to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/Main.qml
      [2/41 13.0/sec] Copying JavaScript.js to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/JavaScript.js
      [3/41 18.5/sec] Copying images/sprite_white.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/sprite_white.png
      [4/41 21.8/sec] Copying images/background_waterfall.jpg to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/background_waterfall.jpg
      [5/41 25.9/sec] Copying images/sprite_pink.jpg to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/sprite_pink.jpg
      [6/41 29.7/sec] Copying images/sprite_blue.jpg to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/sprite_blue.jpg
      [7/41 32.7/sec] Generating .rcc/qmlcache/game_test_qmlcache_loader.cpp
      [8/41 37.3/sec] Copying images/land_03.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_03.png
      [9/41 41.9/sec] Copying images/land_08.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_08.png
      [10/41 46.4/sec] Copying images/coin.gif to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/coin.gif
      [11/41 51.0/sec] Copying images/land_05.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_05.png
      [12/41 55.5/sec] Copying images/land_07.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_07.png
      [13/41 56.6/sec] Copying images/ladder.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/ladder.png
      [14/41 59.1/sec] Copying images/land_06.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_06.png
      [15/41 58.9/sec] Copying images/land_04.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_04.png
      [16/41 62.7/sec] Copying images/land_02.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_02.png
      [17/41 65.2/sec] Copying images/parachute.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/parachute.png
      [18/41 66.9/sec] Copying images/gate.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/gate.png
      [19/41 66.8/sec] Copying images/land_01.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_01.png
      [20/41 66.4/sec] Copying images/life_empty.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/life_empty.png
      [21/41 69.0/sec] Copying images/life_full.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/life_full.png
      [22/41 70.9/sec] Copying images/key.gif to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/key.gif
      [23/41 72.1/sec] Running qmlimportscanner for game_test
      [24/41 75.0/sec] Copying images/enemy.gif to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/enemy.gif
      [25/41 33.7/sec] Automatic MOC and UIC for target game_test
      [26/41 33.9/sec] Running rcc for resource qmake_game_test
      [27/41 32.9/sec] Running AUTOMOC file extraction for target game_test
      [28/41 33.4/sec] Running rcc for resource game_test_raw_qml_0
      [29/41 31.0/sec] Running moc --collect-json for target game_test
      [30/41 25.9/sec] Automatic QML type registration for target game_test
      [31/41 24.4/sec] Generating .rcc/qmlcache/game_test_JavaScript_js.cpp
      [32/41 23.3/sec] Generating .rcc/qmlcache/game_test_Main_qml.cpp
      [33/41 21.9/sec] Building CXX object CMakeFiles/game_test.dir/game_test_autogen/mocs_compilation.cpp.obj
      [34/41 22.2/sec] Building CXX object CMakeFiles/game_test.dir/.rcc/qrc_qmake_game_test.cpp.obj
      [35/41 13.5/sec] Building CXX object CMakeFiles/game_test.dir/game_test_qmltyperegistrations.cpp.obj
      [36/41 13.4/sec] Building CXX object CMakeFiles/game_test.dir/.rcc/qmlcache/game_test_JavaScript_js.cpp.obj
      [37/41 13.2/sec] Building CXX object CMakeFiles/game_test.dir/main.cpp.obj
      [38/41 11.6/sec] Building CXX object CMakeFiles/game_test.dir/.rcc/qmlcache/game_test_qmlcache_loader.cpp.obj
      [39/41 9.7/sec] Building CXX object CMakeFiles/game_test.dir/.rcc/qmlcache/game_test_Main_qml.cpp.obj
      [40/41 9.6/sec] Building CXX object CMakeFiles/game_test.dir/.rcc/qrc_game_test_raw_qml_0.cpp.obj
      [41/41 9.4/sec] Linking CXX executable game_test.exe
      15:38:01: The process "C:\Qt\Tools\CMake_64\bin\cmake.exe" exited normally.
      15:38:01: Elapsed time: 00:05.
      
      

      so am I doing something wrong?
      Does this work only for release, not debug?
      how properly build the project?

      • normaly when usualy just run clean (even when its done automaticaly upon build) and then either Run it as debug so i can see, or if i want to have the proper way then i right click on the project and do "build"...
      • for this case to see if deployment works i tried Debug as well ad Release, and also this option of "Deploy" (upon right lcicking on the project)

      So, what do I do wrong or what do I miss?

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 17 Oct 2023, 05:36 last edited by
      #4

      @shokarta You need to execute the "install" step like shown in the link I posted:

      ninja install
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply 17 Oct 2023, 09:21
      0
      • S shokarta
        13 Oct 2023, 10:01

        Hello Gurus,

        tho there are milions of example online, i tried most of them and nothing either works (cmake syntax O.o) or it just dont do anything.

        Therefore if I can only ask for the very basic hello world example which uppon build of project, it would just run the the standard command for windeployqt, something like if i would manualy do:

        c:\Qt\6.6.0\mingw_64\bin\windeployqt6.exe --qmldir c:\Qt\Projects\Sources\game_test c:\Qt\Projects\Builds\build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release\appgame_test.exe --compiler-runtime
        

        i tried realy everything how to make it from the CMAKE of my project... tho out of luck...
        Can I kindly ask for the very basic example?

        Thank you

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 13 Oct 2023, 20:29 last edited by
        #2

        @shokarta Take a look at https://www.qt.io/blog/cmake-deployment-api

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • S Offline
          S Offline
          shokarta
          wrote on 16 Oct 2023, 09:16 last edited by shokarta
          #3

          Hello @jsulm ,

          great, thank you for the link... i did read it through and i see i can do the only top part before "Under the hood",

          I very much like this sentense "Say you have just started with Qt.".
          Which I havent just started, but doing some advanced JS/QML and basics c++ stuff does not mean i understand the process of compilation and how to set up the QT/system for working the way I need, this is a bit od advance which I learn step by step by needing stuff and of course from your help...

          • therefore please appology for the questions you my find "wtf how come this guy asks question when already working with Qt?"

          So, this is my cmake:

          cmake_minimum_required(VERSION 3.16)
          
          set(APPNAME "game_test")
          set(PROJECT "app${APPNAME}")
          
          project(${APPNAME} LANGUAGES CXX)
          
          set(CMAKE_AUTOMOC ON)
          set(CMAKE_AUTOUIC ON)
          set(CMAKE_AUTORCC ON)
          set(CMAKE_CXX_STANDARD_REQUIRED ON)
          set(CMAKE_INCLUDE_CURRENT_DIR ON)
          
          find_package(Qt6 COMPONENTS Quick REQUIRED)
          qt_standard_project_setup()
          
          qt_add_executable(${PROJECT}
              main.cpp
          # in theory if i add here third party lib files, then will they be ported automaticaly?
          )
          
          qt_add_qml_module(${PROJECT}
              URI ${APPNAME}
              VERSION 1.0
              RESOURCE_PREFIX /
              QML_FILES
                  main.qml
                  JavaScript.js
          
              RESOURCES
          #        android/AndroidManifest.xml
          #		 some other image files
          
          )
          
          set_target_properties(${PROJECT} PROPERTIES
              WIN32_EXECUTABLE TRUE
          )
          
          target_link_libraries(${PROJECT}
              PRIVATE Qt6::Quick)
          
          
          if(ANDROID)
              set_target_properties(${PROJECT} PROPERTIES
                  QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android"
              )
          endif()
          
          
          install(TARGETS ${PROJECT}
              BUNDLE DESTINATION .
              LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
              RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
          )
          
          # also tried qt_generate_deploy_qml_app_script() but makes no difference
          qt_generate_deploy_app_script(
              TARGET ${PROJECT}
              OUTPUT_SCRIPT deploy_script
              NO_UNSUPPORTED_PLATFORM_ERROR
          )
          install(SCRIPT ${deploy_script})
          

          so QT does not report any error/warning in this cmake, so upon compile, the build dir is created, lots of stuff are being created (as usual) and exe file is generated... however the dlls are not copied as if i would run windeployqt.exe myself after the build:
          9b262bd6-7fc4-4e99-8ca7-7edb33247e61-image.png

          General Messages:

          Running C:\Qt\Tools\CMake_64\bin\cmake.exe -S C:/Qt/Projects/Sources/game_test -B C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release "-DCMAKE_GENERATOR:STRING=Ninja" "-DCMAKE_BUILD_TYPE:STRING=Release" "-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=C:\Qt\Projects\Builds\build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/.qtc/package-manager/auto-setup.cmake" "-DQT_QMAKE_EXECUTABLE:FILEPATH=C:/Qt/6.6.0/mingw_64/bin/qmake.exe" "-DCMAKE_PREFIX_PATH:PATH=C:/Qt/6.6.0/mingw_64" "-DCMAKE_C_COMPILER:FILEPATH=C:/Qt/Tools/mingw1120_64/bin/gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:/Qt/Tools/mingw1120_64/bin/g++.exe" "-DCMAKE_CXX_FLAGS_INIT:STRING=" in C:\Qt\Projects\Builds\build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release.
          -- The CXX compiler identification is GNU 11.2.0
          -- Detecting CXX compiler ABI info
          -- Detecting CXX compiler ABI info - done
          -- Check for working CXX compiler: C:/Qt/Tools/mingw1120_64/bin/g++.exe - skipped
          -- Detecting CXX compile features
          -- Detecting CXX compile features - done
          -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
          -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
          -- Found Threads: TRUE  
          -- Performing Test HAVE_STDATOMIC
          -- Performing Test HAVE_STDATOMIC - Success
          -- Found WrapAtomic: TRUE  
          -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) 
          -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) 
          -- Configuring done
          -- Generating done
          -- Build files have been written to: C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release
          Elapsed time: 00:06.
          

          Compile Output:

          15:37:57: Running steps for project game_test...
          15:37:57: Starting: "C:\Qt\Tools\CMake_64\bin\cmake.exe" --build C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release --target all
          [1/41 7.0/sec] Copying Main.qml to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/Main.qml
          [2/41 13.0/sec] Copying JavaScript.js to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/JavaScript.js
          [3/41 18.5/sec] Copying images/sprite_white.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/sprite_white.png
          [4/41 21.8/sec] Copying images/background_waterfall.jpg to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/background_waterfall.jpg
          [5/41 25.9/sec] Copying images/sprite_pink.jpg to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/sprite_pink.jpg
          [6/41 29.7/sec] Copying images/sprite_blue.jpg to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/sprite_blue.jpg
          [7/41 32.7/sec] Generating .rcc/qmlcache/game_test_qmlcache_loader.cpp
          [8/41 37.3/sec] Copying images/land_03.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_03.png
          [9/41 41.9/sec] Copying images/land_08.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_08.png
          [10/41 46.4/sec] Copying images/coin.gif to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/coin.gif
          [11/41 51.0/sec] Copying images/land_05.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_05.png
          [12/41 55.5/sec] Copying images/land_07.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_07.png
          [13/41 56.6/sec] Copying images/ladder.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/ladder.png
          [14/41 59.1/sec] Copying images/land_06.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_06.png
          [15/41 58.9/sec] Copying images/land_04.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_04.png
          [16/41 62.7/sec] Copying images/land_02.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_02.png
          [17/41 65.2/sec] Copying images/parachute.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/parachute.png
          [18/41 66.9/sec] Copying images/gate.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/gate.png
          [19/41 66.8/sec] Copying images/land_01.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_01.png
          [20/41 66.4/sec] Copying images/life_empty.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/life_empty.png
          [21/41 69.0/sec] Copying images/life_full.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/life_full.png
          [22/41 70.9/sec] Copying images/key.gif to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/key.gif
          [23/41 72.1/sec] Running qmlimportscanner for game_test
          [24/41 75.0/sec] Copying images/enemy.gif to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/enemy.gif
          [25/41 33.7/sec] Automatic MOC and UIC for target game_test
          [26/41 33.9/sec] Running rcc for resource qmake_game_test
          [27/41 32.9/sec] Running AUTOMOC file extraction for target game_test
          [28/41 33.4/sec] Running rcc for resource game_test_raw_qml_0
          [29/41 31.0/sec] Running moc --collect-json for target game_test
          [30/41 25.9/sec] Automatic QML type registration for target game_test
          [31/41 24.4/sec] Generating .rcc/qmlcache/game_test_JavaScript_js.cpp
          [32/41 23.3/sec] Generating .rcc/qmlcache/game_test_Main_qml.cpp
          [33/41 21.9/sec] Building CXX object CMakeFiles/game_test.dir/game_test_autogen/mocs_compilation.cpp.obj
          [34/41 22.2/sec] Building CXX object CMakeFiles/game_test.dir/.rcc/qrc_qmake_game_test.cpp.obj
          [35/41 13.5/sec] Building CXX object CMakeFiles/game_test.dir/game_test_qmltyperegistrations.cpp.obj
          [36/41 13.4/sec] Building CXX object CMakeFiles/game_test.dir/.rcc/qmlcache/game_test_JavaScript_js.cpp.obj
          [37/41 13.2/sec] Building CXX object CMakeFiles/game_test.dir/main.cpp.obj
          [38/41 11.6/sec] Building CXX object CMakeFiles/game_test.dir/.rcc/qmlcache/game_test_qmlcache_loader.cpp.obj
          [39/41 9.7/sec] Building CXX object CMakeFiles/game_test.dir/.rcc/qmlcache/game_test_Main_qml.cpp.obj
          [40/41 9.6/sec] Building CXX object CMakeFiles/game_test.dir/.rcc/qrc_game_test_raw_qml_0.cpp.obj
          [41/41 9.4/sec] Linking CXX executable game_test.exe
          15:38:01: The process "C:\Qt\Tools\CMake_64\bin\cmake.exe" exited normally.
          15:38:01: Elapsed time: 00:05.
          
          

          so am I doing something wrong?
          Does this work only for release, not debug?
          how properly build the project?

          • normaly when usualy just run clean (even when its done automaticaly upon build) and then either Run it as debug so i can see, or if i want to have the proper way then i right click on the project and do "build"...
          • for this case to see if deployment works i tried Debug as well ad Release, and also this option of "Deploy" (upon right lcicking on the project)

          So, what do I do wrong or what do I miss?

          J 1 Reply Last reply 17 Oct 2023, 05:36
          0
          • S shokarta
            16 Oct 2023, 09:16

            Hello @jsulm ,

            great, thank you for the link... i did read it through and i see i can do the only top part before "Under the hood",

            I very much like this sentense "Say you have just started with Qt.".
            Which I havent just started, but doing some advanced JS/QML and basics c++ stuff does not mean i understand the process of compilation and how to set up the QT/system for working the way I need, this is a bit od advance which I learn step by step by needing stuff and of course from your help...

            • therefore please appology for the questions you my find "wtf how come this guy asks question when already working with Qt?"

            So, this is my cmake:

            cmake_minimum_required(VERSION 3.16)
            
            set(APPNAME "game_test")
            set(PROJECT "app${APPNAME}")
            
            project(${APPNAME} LANGUAGES CXX)
            
            set(CMAKE_AUTOMOC ON)
            set(CMAKE_AUTOUIC ON)
            set(CMAKE_AUTORCC ON)
            set(CMAKE_CXX_STANDARD_REQUIRED ON)
            set(CMAKE_INCLUDE_CURRENT_DIR ON)
            
            find_package(Qt6 COMPONENTS Quick REQUIRED)
            qt_standard_project_setup()
            
            qt_add_executable(${PROJECT}
                main.cpp
            # in theory if i add here third party lib files, then will they be ported automaticaly?
            )
            
            qt_add_qml_module(${PROJECT}
                URI ${APPNAME}
                VERSION 1.0
                RESOURCE_PREFIX /
                QML_FILES
                    main.qml
                    JavaScript.js
            
                RESOURCES
            #        android/AndroidManifest.xml
            #		 some other image files
            
            )
            
            set_target_properties(${PROJECT} PROPERTIES
                WIN32_EXECUTABLE TRUE
            )
            
            target_link_libraries(${PROJECT}
                PRIVATE Qt6::Quick)
            
            
            if(ANDROID)
                set_target_properties(${PROJECT} PROPERTIES
                    QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android"
                )
            endif()
            
            
            install(TARGETS ${PROJECT}
                BUNDLE DESTINATION .
                LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
                RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
            )
            
            # also tried qt_generate_deploy_qml_app_script() but makes no difference
            qt_generate_deploy_app_script(
                TARGET ${PROJECT}
                OUTPUT_SCRIPT deploy_script
                NO_UNSUPPORTED_PLATFORM_ERROR
            )
            install(SCRIPT ${deploy_script})
            

            so QT does not report any error/warning in this cmake, so upon compile, the build dir is created, lots of stuff are being created (as usual) and exe file is generated... however the dlls are not copied as if i would run windeployqt.exe myself after the build:
            9b262bd6-7fc4-4e99-8ca7-7edb33247e61-image.png

            General Messages:

            Running C:\Qt\Tools\CMake_64\bin\cmake.exe -S C:/Qt/Projects/Sources/game_test -B C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release "-DCMAKE_GENERATOR:STRING=Ninja" "-DCMAKE_BUILD_TYPE:STRING=Release" "-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=C:\Qt\Projects\Builds\build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/.qtc/package-manager/auto-setup.cmake" "-DQT_QMAKE_EXECUTABLE:FILEPATH=C:/Qt/6.6.0/mingw_64/bin/qmake.exe" "-DCMAKE_PREFIX_PATH:PATH=C:/Qt/6.6.0/mingw_64" "-DCMAKE_C_COMPILER:FILEPATH=C:/Qt/Tools/mingw1120_64/bin/gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:/Qt/Tools/mingw1120_64/bin/g++.exe" "-DCMAKE_CXX_FLAGS_INIT:STRING=" in C:\Qt\Projects\Builds\build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release.
            -- The CXX compiler identification is GNU 11.2.0
            -- Detecting CXX compiler ABI info
            -- Detecting CXX compiler ABI info - done
            -- Check for working CXX compiler: C:/Qt/Tools/mingw1120_64/bin/g++.exe - skipped
            -- Detecting CXX compile features
            -- Detecting CXX compile features - done
            -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
            -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
            -- Found Threads: TRUE  
            -- Performing Test HAVE_STDATOMIC
            -- Performing Test HAVE_STDATOMIC - Success
            -- Found WrapAtomic: TRUE  
            -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) 
            -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) 
            -- Configuring done
            -- Generating done
            -- Build files have been written to: C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release
            Elapsed time: 00:06.
            

            Compile Output:

            15:37:57: Running steps for project game_test...
            15:37:57: Starting: "C:\Qt\Tools\CMake_64\bin\cmake.exe" --build C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release --target all
            [1/41 7.0/sec] Copying Main.qml to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/Main.qml
            [2/41 13.0/sec] Copying JavaScript.js to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/JavaScript.js
            [3/41 18.5/sec] Copying images/sprite_white.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/sprite_white.png
            [4/41 21.8/sec] Copying images/background_waterfall.jpg to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/background_waterfall.jpg
            [5/41 25.9/sec] Copying images/sprite_pink.jpg to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/sprite_pink.jpg
            [6/41 29.7/sec] Copying images/sprite_blue.jpg to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/sprite_blue.jpg
            [7/41 32.7/sec] Generating .rcc/qmlcache/game_test_qmlcache_loader.cpp
            [8/41 37.3/sec] Copying images/land_03.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_03.png
            [9/41 41.9/sec] Copying images/land_08.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_08.png
            [10/41 46.4/sec] Copying images/coin.gif to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/coin.gif
            [11/41 51.0/sec] Copying images/land_05.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_05.png
            [12/41 55.5/sec] Copying images/land_07.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_07.png
            [13/41 56.6/sec] Copying images/ladder.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/ladder.png
            [14/41 59.1/sec] Copying images/land_06.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_06.png
            [15/41 58.9/sec] Copying images/land_04.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_04.png
            [16/41 62.7/sec] Copying images/land_02.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_02.png
            [17/41 65.2/sec] Copying images/parachute.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/parachute.png
            [18/41 66.9/sec] Copying images/gate.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/gate.png
            [19/41 66.8/sec] Copying images/land_01.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/land_01.png
            [20/41 66.4/sec] Copying images/life_empty.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/life_empty.png
            [21/41 69.0/sec] Copying images/life_full.png to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/life_full.png
            [22/41 70.9/sec] Copying images/key.gif to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/key.gif
            [23/41 72.1/sec] Running qmlimportscanner for game_test
            [24/41 75.0/sec] Copying images/enemy.gif to C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/game_test/images/enemy.gif
            [25/41 33.7/sec] Automatic MOC and UIC for target game_test
            [26/41 33.9/sec] Running rcc for resource qmake_game_test
            [27/41 32.9/sec] Running AUTOMOC file extraction for target game_test
            [28/41 33.4/sec] Running rcc for resource game_test_raw_qml_0
            [29/41 31.0/sec] Running moc --collect-json for target game_test
            [30/41 25.9/sec] Automatic QML type registration for target game_test
            [31/41 24.4/sec] Generating .rcc/qmlcache/game_test_JavaScript_js.cpp
            [32/41 23.3/sec] Generating .rcc/qmlcache/game_test_Main_qml.cpp
            [33/41 21.9/sec] Building CXX object CMakeFiles/game_test.dir/game_test_autogen/mocs_compilation.cpp.obj
            [34/41 22.2/sec] Building CXX object CMakeFiles/game_test.dir/.rcc/qrc_qmake_game_test.cpp.obj
            [35/41 13.5/sec] Building CXX object CMakeFiles/game_test.dir/game_test_qmltyperegistrations.cpp.obj
            [36/41 13.4/sec] Building CXX object CMakeFiles/game_test.dir/.rcc/qmlcache/game_test_JavaScript_js.cpp.obj
            [37/41 13.2/sec] Building CXX object CMakeFiles/game_test.dir/main.cpp.obj
            [38/41 11.6/sec] Building CXX object CMakeFiles/game_test.dir/.rcc/qmlcache/game_test_qmlcache_loader.cpp.obj
            [39/41 9.7/sec] Building CXX object CMakeFiles/game_test.dir/.rcc/qmlcache/game_test_Main_qml.cpp.obj
            [40/41 9.6/sec] Building CXX object CMakeFiles/game_test.dir/.rcc/qrc_game_test_raw_qml_0.cpp.obj
            [41/41 9.4/sec] Linking CXX executable game_test.exe
            15:38:01: The process "C:\Qt\Tools\CMake_64\bin\cmake.exe" exited normally.
            15:38:01: Elapsed time: 00:05.
            
            

            so am I doing something wrong?
            Does this work only for release, not debug?
            how properly build the project?

            • normaly when usualy just run clean (even when its done automaticaly upon build) and then either Run it as debug so i can see, or if i want to have the proper way then i right click on the project and do "build"...
            • for this case to see if deployment works i tried Debug as well ad Release, and also this option of "Deploy" (upon right lcicking on the project)

            So, what do I do wrong or what do I miss?

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 17 Oct 2023, 05:36 last edited by
            #4

            @shokarta You need to execute the "install" step like shown in the link I posted:

            ninja install
            

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            S 1 Reply Last reply 17 Oct 2023, 09:21
            0
            • J jsulm
              17 Oct 2023, 05:36

              @shokarta You need to execute the "install" step like shown in the link I posted:

              ninja install
              
              S Offline
              S Offline
              shokarta
              wrote on 17 Oct 2023, 09:21 last edited by shokarta
              #5

              @jsulm thank you, so this is not that fully automated process i was hoping for...

              however, if I do that, then when I run:

              c:\Qt\6.6.0\mingw_64\bin\qt-cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=c:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/final
              

              then I have the error:

              '"cmake"' is not recognized as an internal or external command,
              operable program or batch file.
              

              which is very weird, my Cmake is definitely not in any global variables, neither in PATH, i realy wonder why when i installed Qt via standard online installer.
              However, I have modified the c:\Qt\6.6.0\mingw_64\bin\qt-cmake.bat and changed the cmake way to:

              set cmake_path=C:/Qt/Tools/CMake_64/bin/cmake.exe
              

              now it gives me this error:

              CMake Warning:
                No source or binary directory provided.  Both will be assumed to be the
                same as the current working directory, but note that this warning will
                become a fatal error in future CMake releases.
              
              
              CMake Error: The source directory "C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release" does not appear to contain CMakeLists.txt.
              Specify --help for usage, or press the help button on the CMake GUI.
              

              So after a bit of googling i found a proper way to set the source dir, acually with no preffix, so now when i run:
              c:\Qt\6.6.0\mingw_64\bin\qt-cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=c:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release/final c:/Qt/Projects/Sources/game_test

              i have quite a good progress:

              -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR)
              -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR)
              -- Configuring done
              -- Generating done
              CMake Warning:
                Manually-specified variables were not used by the project:
              
                  CMAKE_TOOLCHAIN_FILE
              
              
              -- Build files have been written to: C:/Qt/Projects/Builds/build-game_test-Desktop_Qt_6_6_0_MinGW_64_bit-Release
              

              so then when i again add Ninja to PATH:

              set PATH=%PATH%;c:\Qt\Tools\Ninja\
              

              ot ouputs only:

              ninja: no work to do.
              

              FINALLY:
              even when ninja has nothing to do, ninja install did make it all :)
              Thank you for your support, i consider this solved

              1 Reply Last reply
              0
              • S shokarta has marked this topic as solved on 17 Oct 2023, 10:22

              1/5

              13 Oct 2023, 10:01

              • Login

              • Login or register to search.
              1 out of 5
              • First post
                1/5
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved