root: recreate the qml engine on reload instead of clearing it

This causes singletons to be recreated instead of kept alive.
This commit is contained in:
outfoxxed 2024-03-12 14:55:51 -07:00
parent 9f6ef37f61
commit 463f9a297f
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
9 changed files with 109 additions and 78 deletions

View file

@ -70,21 +70,26 @@ file(GENERATE
CONTENT ""
)
add_library(qt-pch ${CMAKE_CURRENT_BINARY_DIR}/pchstub.cpp)
target_link_libraries(qt-pch PRIVATE ${QT_DEPS})
target_precompile_headers(qt-pch PUBLIC
<memory>
<qobject.h>
<qqmlengine.h>
<qlist.h>
<qcolor.h>
<qquickitem.h>
<qevent.h>
)
# pch breaks clang-tidy..... somehow
if (NOT NO_PCH)
add_library(qt-pch ${CMAKE_CURRENT_BINARY_DIR}/pchstub.cpp)
target_link_libraries(qt-pch PRIVATE ${QT_DEPS})
target_precompile_headers(qt-pch PUBLIC
<memory>
<qobject.h>
<qqmlengine.h>
<qlist.h>
<qcolor.h>
<qquickitem.h>
<qevent.h>
)
endif()
function (qs_pch target)
target_precompile_headers(${target} REUSE_FROM qt-pch)
target_link_libraries(${target} PRIVATE ${QT_DEPS}) # required for gcc to accept the pch on plugin targets
if (NOT NO_PCH)
target_precompile_headers(${target} REUSE_FROM qt-pch)
target_link_libraries(${target} PRIVATE ${QT_DEPS}) # required for gcc to accept the pch on plugin targets
endif()
endfunction()
add_subdirectory(src)