Skip to content

Too slow build in compare with Qt/qmake #50

@Dushistov

Description

@Dushistov

If I change one line of C++ code in my project and then run
ninja project_apk it takes 39s, gradle output looks like this:

❯ grep Took /tmp/apk-build.log  | grep -v 'Took 0'
:mergeDebugAssets (Thread[Execution worker for ':' Thread 30,5,main]) completed. Took 3.964 secs.
:mergeDebugJniLibFolders (Thread[Execution worker for ':' Thread 30,5,main]) completed. Took 15.387 secs.
:mergeDebugNativeLibs (Thread[Execution worker for ':' Thread 30,5,main]) completed. Took 15.046 secs.
:stripDebugDebugSymbols (Thread[Execution worker for ':' Thread 30,5,main]) completed. Took 3.243 secs.

as you can see the most time is spend during mergeDebug* tasks.
In my ./project/project-arm64-v8a/libs/arm64-v8a/ there are 91 libraries from Qt,
one my library and libc++_shared.

So the most of the time I supposed is spend during handling of Qt libraries.

The most strange part is that Qt libraries recreated every build.
I disable this:

@@ -303,8 +306,8 @@ macro(add_qt_android_apk TARGET SOURCE_TARGET)
         DEPENDS ${SOURCE_TARGET}
         ${QT_ANDROID_PRE_COMMANDS}
         # it seems that recompiled libraries are not copied if we don't remove them first
-        COMMAND ${CMAKE_COMMAND} -E remove_directory ${QT_ANDROID_APP_BINARY_DIR}/libs/${ANDROID_ABI}
-        COMMAND ${CMAKE_COMMAND} -E make_directory ${QT_ANDROID_APP_BINARY_DIR}/libs/${ANDROID_ABI}
+#        COMMAND ${CMAKE_COMMAND} -E remove_directory ${QT_ANDROID_APP_BINARY_DIR}/libs/${ANDROID_ABI}
+#        COMMAND ${CMAKE_COMMAND} -E make_directory ${QT_ANDROID_APP_BINARY_DIR}/libs/${ANDROID_ABI}
         COMMAND ${CMAKE_COMMAND} -E copy ${QT_ANDROID_APP_PATH} ${QT_ANDROID_APP_BINARY_DIR}/libs/${ANDROID_ABI}
         COMMAND ${QT_ANDROID_QT_ROOT}/bin/androiddeployqt
         --verbose

and build time changed to (editing the same file and rebuild project_apk):

❯ grep Took /tmp/apk-build2.log  | grep -v 'Took 0'
:mergeDebugAssets (Thread[Execution worker for ':' Thread 13,5,main]) completed. Took 3.985 secs.
:mergeDebugJniLibFolders (Thread[Execution worker for ':' Thread 13,5,main]) completed. Took 3.987 secs.
:mergeDebugNativeLibs (Thread[Execution worker for ':' Thread 13,5,main]) completed. Took 3.994 secs.
:javaPreCompileDebug (Thread[Execution worker for ':' Thread 12,5,main]) completed. Took 12.674 secs.

So total gradle time changed from 39s to 14s.

I read comment:

it seems that recompiled libraries are not copied if we don't remove them first

But my libproject_arm64-v8a.so updated even after commenting this lines,
while "Qt libraries" not updated, and this is good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions