Skip to content

Commit f48bee4

Browse files
committed
implement cmake switch for qml hot reload (AlpineMapsOrg#184)
1 parent 7358878 commit f48bee4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

app/CMakeLists.txt

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
project(alpine-renderer-app LANGUAGES CXX)
2121

22+
option(ALP_ENABLE_QML_HOT_RELOAD "Enables hot-reloading of qml files (which slows down compilation)" OFF)
23+
2224
qt_add_executable(alpineapp
2325
main.cpp
2426
RenderThreadNotifier.h RenderThreadNotifier.cpp
@@ -119,8 +121,9 @@ set_target_properties(alpineapp PROPERTIES
119121
QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android
120122
)
121123
target_link_libraries(alpineapp PUBLIC gl_engine Qt::Quick Qt::QuickControls2)
122-
if (ALP_ENABLE_DEV_TOOLS)
123-
message(WARNING "building alpine app with dev tools. this will increase the build size. It'll also slow incremental building due to a fix for hotreload.")
124+
125+
if (ALP_ENABLE_QML_HOT_RELOAD)
126+
message(WARNING "building alpine app with qml-hot-reload. It'll slow incremental building due to a fix for hotreload.")
124127

125128
# change prefer to project dir, as per https://bugreports.qt.io/browse/QTBUG-120435
126129
# otherwise we can't hotreload files in app when there is "import app" in the qml file.
@@ -132,7 +135,10 @@ if (ALP_ENABLE_DEV_TOOLS)
132135
-DSOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
133136
-P "${CMAKE_SOURCE_DIR}/cmake/alp_fix_qmldir_for_hotreload.cmake"
134137
)
138+
endif()
135139

140+
if (ALP_ENABLE_DEV_TOOLS)
141+
message(WARNING "building alpine app with dev tools. this will increase the build size.")
136142
qt_target_qml_sources(alpineapp
137143
QML_FILES
138144
StatsWindow.qml

0 commit comments

Comments
 (0)