include(qt-android-cmake/AddQtAndroidApk.cmake)
set(QT_ANDROID_APP_PACKAGE_NAME "net.sourceforge.kid3")
set(QT_ANDROID_APP_NAME "Kid3")
set(QT_ANDROID_BUILD_TOOLS_REVISION "23.0.1")
set(_androidPackageDir ${CMAKE_CURRENT_BINARY_DIR}/package)
configure_file(AndroidManifest.xml.in
               ${_androidPackageDir}/AndroidManifest.xml @ONLY)
add_custom_command(OUTPUT ${_androidPackageDir}/src/net/sourceforge/kid3/Kid3Activity.java
  COMMAND ${CMAKE_COMMAND} -E make_directory ${_androidPackageDir}/src/net/sourceforge/kid3
  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Kid3Activity.java
          ${_androidPackageDir}/src/net/sourceforge/kid3/Kid3Activity.java
  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Kid3Activity.java
)
set(_widths 32 48 64 128)
set(_densities ldpi mdpi hdpi xhdpi)
set(_icons)
list(LENGTH _widths _len)
math(EXPR _maxnr "${_len} - 1")
foreach(_nr RANGE ${_maxnr})
  list(GET _widths ${_nr} _width)
  list(GET _densities ${_nr} _dens)
  set(_icondir ${_androidPackageDir}/res/drawable-${_dens})
  set(_icon ${_icondir}/icon.png)
  list(APPEND _icons ${_icon})
  set(_png ${CMAKE_CURRENT_SOURCE_DIR}/../src/app/${_width}-apps-kid3.png)
  add_custom_command(OUTPUT ${_icon}
    COMMAND ${CMAKE_COMMAND} -E make_directory ${_icondir}
    COMMAND ${CMAKE_COMMAND} -E copy ${_png} ${_icon}
    DEPENDS ${_png}
  )
endforeach()

add_custom_target(android-package
  DEPENDS ${_icons}
          ${_androidPackageDir}/src/net/sourceforge/kid3/Kid3Activity.java)
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND ANDROID_KEYSTORE_PATH AND ANDROID_KEYSTORE_ALIAS)
  set(_keystorePathAlias ${ANDROID_KEYSTORE_PATH} ${ANDROID_KEYSTORE_ALIAS})
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
  set(_keystorePathAlias "UNSIGNED_RELEASE")
else()
  set(_keystorePathAlias)
endif()

set(_deploymentDepends
    lib/libQt${QT_VERSION_MAJOR}Core.so lib/libQt${QT_VERSION_MAJOR}Xml.so lib/libQt${QT_VERSION_MAJOR}Network.so lib/libQt${QT_VERSION_MAJOR}Gui.so
    plugins/bearer/libqandroidbearer.so plugins/platforms/android/libqtforandroid.so plugins/iconengines/libqsvgicon.so
#    plugins/imageformats/libqdds.so plugins/imageformats/libqgif.so plugins/imageformats/libqicns.so plugins/imageformats/libqico.so plugins/imageformats/libqjp2.so
    plugins/imageformats/libqjpeg.so
#    plugins/imageformats/libqmng.so
    plugins/imageformats/libqsvg.so
#    plugins/imageformats/libqtga.so plugins/imageformats/libqtiff.so plugins/imageformats/libqwbmp.so plugins/imageformats/libqwebp.so
    lib/libQt${QT_VERSION_MAJOR}Multimedia.so lib/libQt${QT_VERSION_MAJOR}Qml.so
#    plugins/qmltooling/libqmldbg_qtquick2.so plugins/qmltooling/libqmldbg_tcp.so
    lib/libQt${QT_VERSION_MAJOR}Quick.so lib/libQt${QT_VERSION_MAJOR}Widgets.so lib/libQt${QT_VERSION_MAJOR}Svg.so
    lib/libQt${QT_VERSION_MAJOR}QuickControls2.so lib/libQt${QT_VERSION_MAJOR}QuickTemplates2.so lib/libQt${QT_VERSION_MAJOR}AndroidExtras.so
#    lib/libQt${QT_VERSION_MAJOR}MultimediaQuick_p.so plugins/mediaservice/libqtmedia_android.so plugins/audio/libqtaudio_opensles.so plugins/video/videonode/libqtsgvideonode_android.so plugins/playlistformats/libqtmultimedia_m3u.so
#    qml/Enginio/libenginioplugin.so qml/Enginio/plugins.qmltypes qml/Enginio/qmldir
    qml/Qt/labs/folderlistmodel/libqmlfolderlistmodelplugin.so qml/Qt/labs/folderlistmodel/plugins.qmltypes qml/Qt/labs/folderlistmodel/qmldir
#    qml/Qt/labs/settings/libqmlsettingsplugin.so qml/Qt/labs/settings/plugins.qmltypes qml/Qt/labs/settings/qmldir
#    qml/Qt/WebSockets/qmldir
#    qml/Qt3D/Input/libquick3dinputplugin.so qml/Qt3D/Input/qmldir qml/Qt3D/libquick3dcoreplugin.so qml/Qt3D/qmldir qml/Qt3D/Renderer/libquick3drendererplugin.so qml/Qt3D/Renderer/qmldir
#    qml/QtBluetooth/libdeclarative_bluetooth.so qml/QtBluetooth/plugins.qmltypes qml/QtBluetooth/qmldir
#    qml/QtCanvas3D/designer/default/Canvas3D.qml qml/QtCanvas3D/designer/images/canvas3d-icon.png qml/QtCanvas3D/designer/images/canvas3d-icon16.png qml/QtCanvas3D/designer/qtcanvas3d.metainfo qml/QtCanvas3D/libqtcanvas3d.so qml/QtCanvas3D/plugins.qmltypes qml/QtCanvas3D/qmldir
#    qml/QtGraphicalEffects/Blend.qml qml/QtGraphicalEffects/BrightnessContrast.qml qml/QtGraphicalEffects/Colorize.qml qml/QtGraphicalEffects/ColorOverlay.qml qml/QtGraphicalEffects/ConicalGradient.qml qml/QtGraphicalEffects/Desaturate.qml qml/QtGraphicalEffects/DirectionalBlur.qml qml/QtGraphicalEffects/Displace.qml qml/QtGraphicalEffects/DropShadow.qml qml/QtGraphicalEffects/FastBlur.qml qml/QtGraphicalEffects/GammaAdjust.qml qml/QtGraphicalEffects/GaussianBlur.qml qml/QtGraphicalEffects/Glow.qml qml/QtGraphicalEffects/HueSaturation.qml qml/QtGraphicalEffects/InnerShadow.qml qml/QtGraphicalEffects/LevelAdjust.qml qml/QtGraphicalEffects/LinearGradient.qml qml/QtGraphicalEffects/MaskedBlur.qml qml/QtGraphicalEffects/OpacityMask.qml qml/QtGraphicalEffects/private/FastGlow.qml qml/QtGraphicalEffects/private/FastInnerShadow.qml qml/QtGraphicalEffects/private/FastMaskedBlur.qml qml/QtGraphicalEffects/private/GaussianDirectionalBlur.qml qml/QtGraphicalEffects/private/GaussianGlow.qml qml/QtGraphicalEffects/private/GaussianInnerShadow.qml qml/QtGraphicalEffects/private/GaussianMaskedBlur.qml qml/QtGraphicalEffects/private/SourceProxy.qml qml/QtGraphicalEffects/qmldir qml/QtGraphicalEffects/RadialBlur.qml qml/QtGraphicalEffects/RadialGradient.qml qml/QtGraphicalEffects/RectangularGlow.qml qml/QtGraphicalEffects/RecursiveBlur.qml qml/QtGraphicalEffects/ThresholdMask.qml qml/QtGraphicalEffects/ZoomBlur.qml
#    qml/QtLocation/libdeclarative_location.so qml/QtLocation/plugins.qmltypes qml/QtLocation/qmldir
#    qml/QtMultimedia/libdeclarative_multimedia.so qml/QtMultimedia/plugins.qmltypes qml/QtMultimedia/qmldir qml/QtMultimedia/Video.qml
#    qml/QtNfc/libdeclarative_nfc.so qml/QtNfc/plugins.qmltypes qml/QtNfc/qmldir
#    qml/QtPositioning/libdeclarative_positioning.so qml/QtPositioning/plugins.qmltypes qml/QtPositioning/qmldir
#    qml/QtQml/Models.2/libmodelsplugin.so qml/QtQml/Models.2/plugins.qmltypes qml/QtQml/Models.2/qmldir qml/QtQml/StateMachine/libqtqmlstatemachine.so qml/QtQml/StateMachine/plugins.qmltypes qml/QtQml/StateMachine/qmldir
#    qml/QtQuick/Controls/ApplicationWindow.qml qml/QtQuick/Controls/BusyIndicator.qml qml/QtQuick/Controls/Button.qml qml/QtQuick/Controls/Calendar.qml qml/QtQuick/Controls/CheckBox.qml qml/QtQuick/Controls/ComboBox.qml qml/QtQuick/Controls/GroupBox.qml qml/QtQuick/Controls/Label.qml qml/QtQuick/Controls/libqtquickcontrolsplugin.so qml/QtQuick/Controls/Menu.qml qml/QtQuick/Controls/MenuBar.qml qml/QtQuick/Controls/plugins.qmltypes qml/QtQuick/Controls/Private/AbstractCheckable.qml qml/QtQuick/Controls/Private/BasicButton.qml qml/QtQuick/Controls/Private/BasicTableView.qml qml/QtQuick/Controls/Private/CalendarHeaderModel.qml qml/QtQuick/Controls/Private/CalendarUtils.js qml/QtQuick/Controls/Private/ColumnMenuContent.qml qml/QtQuick/Controls/Private/ContentItem.qml qml/QtQuick/Controls/Private/Control.qml qml/QtQuick/Controls/Private/EditMenu.qml qml/QtQuick/Controls/Private/EditMenu_base.qml qml/QtQuick/Controls/Private/EditMenu_ios.qml qml/QtQuick/Controls/Private/FastGlow.qml qml/QtQuick/Controls/Private/FocusFrame.qml qml/QtQuick/Controls/Private/HoverButton.qml qml/QtQuick/Controls/Private/MenuContentItem.qml qml/QtQuick/Controls/Private/MenuContentScroller.qml qml/QtQuick/Controls/Private/MenuItemSubControls.qml qml/QtQuick/Controls/Private/ModalPopupBehavior.qml qml/QtQuick/Controls/Private/qmldir qml/QtQuick/Controls/Private/ScrollBar.qml qml/QtQuick/Controls/Private/ScrollViewHelper.qml qml/QtQuick/Controls/Private/SourceProxy.qml qml/QtQuick/Controls/Private/StackView.js qml/QtQuick/Controls/Private/StackViewSlideDelegate.qml qml/QtQuick/Controls/Private/style.js qml/QtQuick/Controls/Private/Style.qml qml/QtQuick/Controls/Private/SystemPaletteSingleton.qml qml/QtQuick/Controls/Private/TabBar.qml qml/QtQuick/Controls/Private/TableViewItemDelegateLoader.qml qml/QtQuick/Controls/Private/TableViewSelection.qml qml/QtQuick/Controls/Private/TextHandle.qml qml/QtQuick/Controls/Private/TextInputWithHandles.qml qml/QtQuick/Controls/Private/TextSingleton.qml qml/QtQuick/Controls/Private/ToolMenuButton.qml qml/QtQuick/Controls/Private/TreeViewItemDelegateLoader.qml qml/QtQuick/Controls/ProgressBar.qml qml/QtQuick/Controls/qmldir qml/QtQuick/Controls/RadioButton.qml qml/QtQuick/Controls/ScrollView.qml qml/QtQuick/Controls/Slider.qml qml/QtQuick/Controls/SpinBox.qml qml/QtQuick/Controls/SplitView.qml qml/QtQuick/Controls/StackView.qml qml/QtQuick/Controls/StackViewDelegate.qml qml/QtQuick/Controls/StackViewTransition.qml qml/QtQuick/Controls/StatusBar.qml qml/QtQuick/Controls/Styles/Android/AndroidStyle.qml qml/QtQuick/Controls/Styles/Android/ApplicationWindowStyle.qml qml/QtQuick/Controls/Styles/Android/BusyIndicatorStyle.qml qml/QtQuick/Controls/Styles/Android/ButtonStyle.qml qml/QtQuick/Controls/Styles/Android/CalendarStyle.qml qml/QtQuick/Controls/Styles/Android/CheckBoxStyle.qml qml/QtQuick/Controls/Styles/Android/ComboBoxStyle.qml qml/QtQuick/Controls/Styles/Android/CursorHandleStyle.qml qml/QtQuick/Controls/Styles/Android/drawables/AnimationDrawable.qml qml/QtQuick/Controls/Styles/Android/drawables/ClipDrawable.qml qml/QtQuick/Controls/Styles/Android/drawables/ColorDrawable.qml qml/QtQuick/Controls/Styles/Android/drawables/Drawable.qml qml/QtQuick/Controls/Styles/Android/drawables/DrawableLoader.qml qml/QtQuick/Controls/Styles/Android/drawables/GradientDrawable.qml qml/QtQuick/Controls/Styles/Android/drawables/ImageDrawable.qml qml/QtQuick/Controls/Styles/Android/drawables/LayerDrawable.qml qml/QtQuick/Controls/Styles/Android/drawables/NinePatchDrawable.qml qml/QtQuick/Controls/Styles/Android/drawables/RotateDrawable.qml qml/QtQuick/Controls/Styles/Android/drawables/StateDrawable.qml qml/QtQuick/Controls/Styles/Android/FocusFrameStyle.qml qml/QtQuick/Controls/Styles/Android/GroupBoxStyle.qml qml/QtQuick/Controls/Styles/Android/LabelStyle.qml qml/QtQuick/Controls/Styles/Android/libqtquickcontrolsandroidstyleplugin.so qml/QtQuick/Controls/Styles/Android/MenuBarStyle.qml qml/QtQuick/Controls/Styles/Android/MenuStyle.qml qml/QtQuick/Controls/Styles/Android/ProgressBarStyle.qml qml/QtQuick/Controls/Styles/Android/qmldir qml/QtQuick/Controls/Styles/Android/RadioButtonStyle.qml qml/QtQuick/Controls/Styles/Android/ScrollViewStyle.qml qml/QtQuick/Controls/Styles/Android/SliderStyle.qml qml/QtQuick/Controls/Styles/Android/SpinBoxStyle.qml qml/QtQuick/Controls/Styles/Android/StatusBarStyle.qml qml/QtQuick/Controls/Styles/Android/SwitchStyle.qml qml/QtQuick/Controls/Styles/Android/TableViewStyle.qml qml/QtQuick/Controls/Styles/Android/TabViewStyle.qml qml/QtQuick/Controls/Styles/Android/TextAreaStyle.qml qml/QtQuick/Controls/Styles/Android/TextFieldStyle.qml qml/QtQuick/Controls/Styles/Android/ToolBarStyle.qml qml/QtQuick/Controls/Styles/Android/ToolButtonStyle.qml qml/QtQuick/Controls/Styles/Base/ApplicationWindowStyle.qml qml/QtQuick/Controls/Styles/Base/BasicTableViewStyle.qml qml/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml qml/QtQuick/Controls/Styles/Base/ButtonStyle.qml qml/QtQuick/Controls/Styles/Base/CalendarStyle.qml qml/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml qml/QtQuick/Controls/Styles/Base/CircularButtonStyle.qml qml/QtQuick/Controls/Styles/Base/CircularGaugeStyle.qml qml/QtQuick/Controls/Styles/Base/CircularTickmarkLabelStyle.qml qml/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml qml/QtQuick/Controls/Styles/Base/CommonStyleHelper.qml qml/QtQuick/Controls/Styles/Base/DelayButtonStyle.qml qml/QtQuick/Controls/Styles/Base/DialStyle.qml qml/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml qml/QtQuick/Controls/Styles/Base/GaugeStyle.qml qml/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml qml/QtQuick/Controls/Styles/Base/HandleStyle.qml qml/QtQuick/Controls/Styles/Base/HandleStyleHelper.qml qml/QtQuick/Controls/Styles/Base/images/arrow-down.png qml/QtQuick/Controls/Styles/Base/images/arrow-down@2x.png qml/QtQuick/Controls/Styles/Base/images/arrow-left.png qml/QtQuick/Controls/Styles/Base/images/arrow-left@2x.png qml/QtQuick/Controls/Styles/Base/images/arrow-right.png qml/QtQuick/Controls/Styles/Base/images/arrow-right@2x.png qml/QtQuick/Controls/Styles/Base/images/arrow-up.png qml/QtQuick/Controls/Styles/Base/images/arrow-up@2x.png qml/QtQuick/Controls/Styles/Base/images/button.png qml/QtQuick/Controls/Styles/Base/images/button_down.png qml/QtQuick/Controls/Styles/Base/images/check.png qml/QtQuick/Controls/Styles/Base/images/check@2x.png qml/QtQuick/Controls/Styles/Base/images/editbox.png qml/QtQuick/Controls/Styles/Base/images/focusframe.png qml/QtQuick/Controls/Styles/Base/images/groupbox.png qml/QtQuick/Controls/Styles/Base/images/header.png qml/QtQuick/Controls/Styles/Base/images/knob.png qml/QtQuick/Controls/Styles/Base/images/leftanglearrow.png qml/QtQuick/Controls/Styles/Base/images/needle.png qml/QtQuick/Controls/Styles/Base/images/progress-indeterminate.png qml/QtQuick/Controls/Styles/Base/images/rightanglearrow.png qml/QtQuick/Controls/Styles/Base/images/scrollbar-handle-horizontal.png qml/QtQuick/Controls/Styles/Base/images/scrollbar-handle-transient.png qml/QtQuick/Controls/Styles/Base/images/scrollbar-handle-vertical.png qml/QtQuick/Controls/Styles/Base/images/slider-groove.png qml/QtQuick/Controls/Styles/Base/images/slider-handle.png qml/QtQuick/Controls/Styles/Base/images/spinner_large.png qml/QtQuick/Controls/Styles/Base/images/spinner_medium.png qml/QtQuick/Controls/Styles/Base/images/spinner_small.png qml/QtQuick/Controls/Styles/Base/images/tab.png qml/QtQuick/Controls/Styles/Base/images/tab_selected.png qml/QtQuick/Controls/Styles/Base/MenuBarStyle.qml qml/QtQuick/Controls/Styles/Base/MenuStyle.qml qml/QtQuick/Controls/Styles/Base/PieMenuStyle.qml qml/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml qml/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml qml/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml qml/QtQuick/Controls/Styles/Base/SliderStyle.qml qml/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml qml/QtQuick/Controls/Styles/Base/StatusBarStyle.qml qml/QtQuick/Controls/Styles/Base/StatusIndicatorStyle.qml qml/QtQuick/Controls/Styles/Base/SwitchStyle.qml qml/QtQuick/Controls/Styles/Base/TableViewStyle.qml qml/QtQuick/Controls/Styles/Base/TabViewStyle.qml qml/QtQuick/Controls/Styles/Base/TextAreaStyle.qml qml/QtQuick/Controls/Styles/Base/TextFieldStyle.qml qml/QtQuick/Controls/Styles/Base/ToggleButtonStyle.qml qml/QtQuick/Controls/Styles/Base/ToolBarStyle.qml qml/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml qml/QtQuick/Controls/Styles/Base/TreeViewStyle.qml qml/QtQuick/Controls/Styles/Base/TumblerStyle.qml qml/QtQuick/Controls/Styles/Flat/libqtquickextrasflatplugin.so qml/QtQuick/Controls/Styles/Flat/qmldir qml/QtQuick/Controls/Styles/qmldir qml/QtQuick/Controls/Switch.qml qml/QtQuick/Controls/Tab.qml qml/QtQuick/Controls/TableView.qml qml/QtQuick/Controls/TableViewColumn.qml qml/QtQuick/Controls/TabView.qml qml/QtQuick/Controls/TextArea.qml qml/QtQuick/Controls/TextField.qml qml/QtQuick/Controls/ToolBar.qml qml/QtQuick/Controls/ToolButton.qml qml/QtQuick/Controls/TreeView.qml
#    qml/QtQuick/Dialogs/libdialogplugin.so qml/QtQuick/Dialogs/plugins.qmltypes qml/QtQuick/Dialogs/Private/libdialogsprivateplugin.so qml/QtQuick/Dialogs/Private/qmldir qml/QtQuick/Dialogs/qmldir
#    qml/QtQuick/Extras/designer/CircularGaugeSpecifics.qml qml/QtQuick/Extras/designer/DelayButtonSpecifics.qml qml/QtQuick/Extras/designer/DialSpecifics.qml qml/QtQuick/Extras/designer/GaugeSpecifics.qml qml/QtQuick/Extras/designer/images/circulargauge-icon.png qml/QtQuick/Extras/designer/images/circulargauge-icon16.png qml/QtQuick/Extras/designer/images/delaybutton-icon.png qml/QtQuick/Extras/designer/images/delaybutton-icon16.png qml/QtQuick/Extras/designer/images/dial-icon.png qml/QtQuick/Extras/designer/images/dial-icon16.png qml/QtQuick/Extras/designer/images/gauge-icon.png qml/QtQuick/Extras/designer/images/gauge-icon16.png qml/QtQuick/Extras/designer/images/picture-icon.png qml/QtQuick/Extras/designer/images/picture-icon16.png qml/QtQuick/Extras/designer/images/piemenu-icon.png qml/QtQuick/Extras/designer/images/piemenu-icon16.png qml/QtQuick/Extras/designer/images/statusindicator-icon.png qml/QtQuick/Extras/designer/images/statusindicator-icon16.png qml/QtQuick/Extras/designer/images/togglebutton-icon.png qml/QtQuick/Extras/designer/images/togglebutton-icon16.png qml/QtQuick/Extras/designer/images/tumbler-icon.png qml/QtQuick/Extras/designer/images/tumbler-icon16.png qml/QtQuick/Extras/designer/PictureSpecifics.qml qml/QtQuick/Extras/designer/PieMenuSpecifics.qml qml/QtQuick/Extras/designer/qtquickextras.metainfo qml/QtQuick/Extras/designer/StatusIndicatorSpecifics.qml qml/QtQuick/Extras/designer/ToggleButtonSpecifics.qml qml/QtQuick/Extras/libqtquickextrasplugin.so qml/QtQuick/Extras/plugins.qmltypes qml/QtQuick/Extras/qmldir
    qml/QtQuick/Layouts/libqquicklayoutsplugin.so qml/QtQuick/Layouts/plugins.qmltypes qml/QtQuick/Layouts/qmldir
#    qml/QtQuick/LocalStorage/libqmllocalstorageplugin.so qml/QtQuick/LocalStorage/plugins.qmltypes qml/QtQuick/LocalStorage/qmldir
#    qml/QtQuick/Particles.2/libparticlesplugin.so qml/QtQuick/Particles.2/plugins.qmltypes qml/QtQuick/Particles.2/qmldir
#    qml/QtQuick/PrivateWidgets/libwidgetsplugin.so qml/QtQuick/PrivateWidgets/plugins.qmltypes qml/QtQuick/PrivateWidgets/qmldir
#    qml/QtQuick/Scene3D/libqtquickscene3dplugin.so qml/QtQuick/Scene3D/qmldir
    qml/QtQuick/Window.2/libwindowplugin.so qml/QtQuick/Window.2/plugins.qmltypes qml/QtQuick/Window.2/qmldir
    qml/QtQuick/Templates.2/libqtquicktemplates2plugin.so qml/QtQuick/Templates.2/plugins.qmltypes qml/QtQuick/Templates.2/qmldir
#    qml/QtQuick/XmlListModel/libqmlxmllistmodelplugin.so qml/QtQuick/XmlListModel/plugins.qmltypes qml/QtQuick/XmlListModel/qmldir
    qml/QtQuick.2/libqtquick2plugin.so qml/QtQuick.2/plugins.qmltypes qml/QtQuick.2/qmldir
#    qml/QtSensors/libdeclarative_sensors.so qml/QtSensors/plugins.qmltypes qml/QtSensors/qmldir
#    qml/QtTest/libqmltestplugin.so qml/QtTest/plugins.qmltypes qml/QtTest/qmldir qml/QtTest/SignalSpy.qml qml/QtTest/TestCase.qml qml/QtTest/testlogger.js
#    qml/QtWebChannel/libdeclarative_webchannel.so qml/QtWebChannel/plugins.qmltypes qml/QtWebChannel/qmldir
#    qml/QtWebSockets/libdeclarative_qmlwebsockets.so qml/QtWebSockets/plugins.qmltypes qml/QtWebSockets/qmldir
    qml/QtQuick/Controls.2/libqtquickcontrols2plugin.so qml/QtQuick/Controls.2/plugins.qmltypes qml/QtQuick/Controls.2/qmldir
    qml/QtQuick/Controls.2/AbstractButton.qml qml/QtQuick/Controls.2/ApplicationWindow.qml qml/QtQuick/Controls.2/BusyIndicator.qml qml/QtQuick/Controls.2/Button.qml qml/QtQuick/Controls.2/ButtonGroup.qml qml/QtQuick/Controls.2/CheckBox.qml qml/QtQuick/Controls.2/CheckDelegate.qml qml/QtQuick/Controls.2/ComboBox.qml qml/QtQuick/Controls.2/Container.qml qml/QtQuick/Controls.2/Control.qml qml/QtQuick/Controls.2/DelayButton.qml qml/QtQuick/Controls.2/Dial.qml qml/QtQuick/Controls.2/Dialog.qml qml/QtQuick/Controls.2/DialogButtonBox.qml qml/QtQuick/Controls.2/Drawer.qml qml/QtQuick/Controls.2/Frame.qml qml/QtQuick/Controls.2/GroupBox.qml qml/QtQuick/Controls.2/ItemDelegate.qml qml/QtQuick/Controls.2/Label.qml qml/QtQuick/Controls.2/Menu.qml qml/QtQuick/Controls.2/MenuItem.qml qml/QtQuick/Controls.2/MenuSeparator.qml qml/QtQuick/Controls.2/Page.qml qml/QtQuick/Controls.2/PageIndicator.qml qml/QtQuick/Controls.2/Pane.qml qml/QtQuick/Controls.2/Popup.qml qml/QtQuick/Controls.2/ProgressBar.qml qml/QtQuick/Controls.2/RadioButton.qml qml/QtQuick/Controls.2/RadioDelegate.qml qml/QtQuick/Controls.2/RangeSlider.qml qml/QtQuick/Controls.2/RoundButton.qml qml/QtQuick/Controls.2/ScrollBar.qml qml/QtQuick/Controls.2/ScrollIndicator.qml qml/QtQuick/Controls.2/ScrollView.qml qml/QtQuick/Controls.2/Slider.qml qml/QtQuick/Controls.2/SpinBox.qml qml/QtQuick/Controls.2/StackView.qml qml/QtQuick/Controls.2/SwipeDelegate.qml qml/QtQuick/Controls.2/SwipeView.qml qml/QtQuick/Controls.2/Switch.qml qml/QtQuick/Controls.2/SwitchDelegate.qml qml/QtQuick/Controls.2/TabBar.qml qml/QtQuick/Controls.2/TabButton.qml qml/QtQuick/Controls.2/TextArea.qml qml/QtQuick/Controls.2/TextField.qml qml/QtQuick/Controls.2/ToolBar.qml qml/QtQuick/Controls.2/ToolButton.qml qml/QtQuick/Controls.2/ToolSeparator.qml qml/QtQuick/Controls.2/ToolTip.qml qml/QtQuick/Controls.2/Tumbler.qml
    qml/QtQuick/Controls.2/Material/libqtquickcontrols2materialstyleplugin.so qml/QtQuick/Controls.2/Material/plugins.qmltypes qml/QtQuick/Controls.2/Material/qmldir
    qml/QtQuick/Controls.2/Material/ApplicationWindow.qml qml/QtQuick/Controls.2/Material/BoxShadow.qml qml/QtQuick/Controls.2/Material/BusyIndicator.qml qml/QtQuick/Controls.2/Material/Button.qml qml/QtQuick/Controls.2/Material/CheckBox.qml qml/QtQuick/Controls.2/Material/CheckDelegate.qml qml/QtQuick/Controls.2/Material/CheckIndicator.qml qml/QtQuick/Controls.2/Material/ComboBox.qml qml/QtQuick/Controls.2/Material/CursorDelegate.qml qml/QtQuick/Controls.2/Material/DelayButton.qml qml/QtQuick/Controls.2/Material/Dial.qml qml/QtQuick/Controls.2/Material/Dialog.qml qml/QtQuick/Controls.2/Material/DialogButtonBox.qml qml/QtQuick/Controls.2/Material/Drawer.qml qml/QtQuick/Controls.2/Material/ElevationEffect.qml qml/QtQuick/Controls.2/Material/Frame.qml qml/QtQuick/Controls.2/Material/GroupBox.qml qml/QtQuick/Controls.2/Material/ItemDelegate.qml qml/QtQuick/Controls.2/Material/Label.qml qml/QtQuick/Controls.2/Material/Menu.qml qml/QtQuick/Controls.2/Material/MenuItem.qml qml/QtQuick/Controls.2/Material/MenuSeparator.qml qml/QtQuick/Controls.2/Material/Page.qml qml/QtQuick/Controls.2/Material/PageIndicator.qml qml/QtQuick/Controls.2/Material/Pane.qml qml/QtQuick/Controls.2/Material/Popup.qml qml/QtQuick/Controls.2/Material/ProgressBar.qml qml/QtQuick/Controls.2/Material/RadioButton.qml qml/QtQuick/Controls.2/Material/RadioDelegate.qml qml/QtQuick/Controls.2/Material/RadioIndicator.qml qml/QtQuick/Controls.2/Material/RangeSlider.qml qml/QtQuick/Controls.2/Material/RectangularGlow.qml qml/QtQuick/Controls.2/Material/RoundButton.qml qml/QtQuick/Controls.2/Material/ScrollBar.qml qml/QtQuick/Controls.2/Material/ScrollIndicator.qml qml/QtQuick/Controls.2/Material/Slider.qml qml/QtQuick/Controls.2/Material/SliderHandle.qml qml/QtQuick/Controls.2/Material/SpinBox.qml qml/QtQuick/Controls.2/Material/StackView.qml qml/QtQuick/Controls.2/Material/SwipeDelegate.qml qml/QtQuick/Controls.2/Material/SwipeView.qml qml/QtQuick/Controls.2/Material/Switch.qml qml/QtQuick/Controls.2/Material/SwitchDelegate.qml qml/QtQuick/Controls.2/Material/SwitchIndicator.qml qml/QtQuick/Controls.2/Material/TabBar.qml qml/QtQuick/Controls.2/Material/TabButton.qml qml/QtQuick/Controls.2/Material/TextArea.qml qml/QtQuick/Controls.2/Material/TextField.qml qml/QtQuick/Controls.2/Material/ToolBar.qml qml/QtQuick/Controls.2/Material/ToolButton.qml qml/QtQuick/Controls.2/Material/ToolSeparator.qml qml/QtQuick/Controls.2/Material/ToolTip.qml qml/QtQuick/Controls.2/Material/Tumbler.qml
#    qml/QtQuick/Controls.2/Universal/libqtquickcontrols2universalstyleplugin.so qml/QtQuick/Controls.2/Universal/plugins.qmltypes qml/QtQuick/Controls.2/Universal/qmldir
#    qml/QtQuick/Controls.2/Universal/ApplicationWindow.qml qml/QtQuick/Controls.2/Universal/BusyIndicator.qml qml/QtQuick/Controls.2/Universal/Button.qml qml/QtQuick/Controls.2/Universal/CheckBox.qml qml/QtQuick/Controls.2/Universal/CheckDelegate.qml qml/QtQuick/Controls.2/Universal/CheckIndicator.qml qml/QtQuick/Controls.2/Universal/ComboBox.qml qml/QtQuick/Controls.2/Universal/DelayButton.qml qml/QtQuick/Controls.2/Universal/Dial.qml qml/QtQuick/Controls.2/Universal/Dialog.qml qml/QtQuick/Controls.2/Universal/DialogButtonBox.qml qml/QtQuick/Controls.2/Universal/Drawer.qml qml/QtQuick/Controls.2/Universal/Frame.qml qml/QtQuick/Controls.2/Universal/GroupBox.qml qml/QtQuick/Controls.2/Universal/ItemDelegate.qml qml/QtQuick/Controls.2/Universal/Label.qml qml/QtQuick/Controls.2/Universal/Menu.qml qml/QtQuick/Controls.2/Universal/MenuItem.qml qml/QtQuick/Controls.2/Universal/MenuSeparator.qml qml/QtQuick/Controls.2/Universal/Page.qml qml/QtQuick/Controls.2/Universal/PageIndicator.qml qml/QtQuick/Controls.2/Universal/Pane.qml qml/QtQuick/Controls.2/Universal/Popup.qml qml/QtQuick/Controls.2/Universal/ProgressBar.qml qml/QtQuick/Controls.2/Universal/RadioButton.qml qml/QtQuick/Controls.2/Universal/RadioDelegate.qml qml/QtQuick/Controls.2/Universal/RadioIndicator.qml qml/QtQuick/Controls.2/Universal/RangeSlider.qml qml/QtQuick/Controls.2/Universal/RoundButton.qml qml/QtQuick/Controls.2/Universal/ScrollBar.qml qml/QtQuick/Controls.2/Universal/ScrollIndicator.qml qml/QtQuick/Controls.2/Universal/Slider.qml qml/QtQuick/Controls.2/Universal/SpinBox.qml qml/QtQuick/Controls.2/Universal/StackView.qml qml/QtQuick/Controls.2/Universal/SwipeDelegate.qml qml/QtQuick/Controls.2/Universal/Switch.qml qml/QtQuick/Controls.2/Universal/SwitchDelegate.qml qml/QtQuick/Controls.2/Universal/SwitchIndicator.qml qml/QtQuick/Controls.2/Universal/TabBar.qml qml/QtQuick/Controls.2/Universal/TabButton.qml qml/QtQuick/Controls.2/Universal/TextArea.qml qml/QtQuick/Controls.2/Universal/TextField.qml qml/QtQuick/Controls.2/Universal/ToolBar.qml qml/QtQuick/Controls.2/Universal/ToolButton.qml qml/QtQuick/Controls.2/Universal/ToolSeparator.qml qml/QtQuick/Controls.2/Universal/ToolTip.qml qml/QtQuick/Controls.2/Universal/Tumbler.qml
#    qml/QtQuick/Controls.2/designer/AbstractButtonSection.qml qml/QtQuick/Controls.2/designer/BusyIndicatorSpecifics.qml qml/QtQuick/Controls.2/designer/ButtonSection.qml qml/QtQuick/Controls.2/designer/ButtonSpecifics.qml qml/QtQuick/Controls.2/designer/CheckBoxSpecifics.qml qml/QtQuick/Controls.2/designer/CheckDelegateSpecifics.qml qml/QtQuick/Controls.2/designer/CheckSection.qml qml/QtQuick/Controls.2/designer/ComboBoxSpecifics.qml qml/QtQuick/Controls.2/designer/ContainerSection.qml qml/QtQuick/Controls.2/designer/ControlSection.qml qml/QtQuick/Controls.2/designer/ControlSpecifics.qml qml/QtQuick/Controls.2/designer/DelayButtonSpecifics.qml qml/QtQuick/Controls.2/designer/DialSpecifics.qml qml/QtQuick/Controls.2/designer/FrameSpecifics.qml qml/QtQuick/Controls.2/designer/GroupBoxSpecifics.qml qml/QtQuick/Controls.2/designer/ItemDelegateSection.qml qml/QtQuick/Controls.2/designer/ItemDelegateSpecifics.qml qml/QtQuick/Controls.2/designer/LabelSpecifics.qml qml/QtQuick/Controls.2/designer/PaddingSection.qml qml/QtQuick/Controls.2/designer/PageIndicatorSpecifics.qml qml/QtQuick/Controls.2/designer/PageSpecifics.qml qml/QtQuick/Controls.2/designer/PaneSection.qml qml/QtQuick/Controls.2/designer/PaneSpecifics.qml qml/QtQuick/Controls.2/designer/ProgressBarSpecifics.qml qml/QtQuick/Controls.2/designer/RadioButtonSpecifics.qml qml/QtQuick/Controls.2/designer/RadioDelegateSpecifics.qml qml/QtQuick/Controls.2/designer/RangeSliderSpecifics.qml qml/QtQuick/Controls.2/designer/RoundButtonSpecifics.qml qml/QtQuick/Controls.2/designer/ScrollViewSpecifics.qml qml/QtQuick/Controls.2/designer/SliderSpecifics.qml qml/QtQuick/Controls.2/designer/SpinBoxSpecifics.qml qml/QtQuick/Controls.2/designer/StackViewSpecifics.qml qml/QtQuick/Controls.2/designer/SwipeDelegateSpecifics.qml qml/QtQuick/Controls.2/designer/SwipeViewSpecifics.qml qml/QtQuick/Controls.2/designer/SwitchDelegateSpecifics.qml qml/QtQuick/Controls.2/designer/SwitchSpecifics.qml qml/QtQuick/Controls.2/designer/TabBarSpecifics.qml qml/QtQuick/Controls.2/designer/TabButtonSpecifics.qml qml/QtQuick/Controls.2/designer/TextAreaSpecifics.qml qml/QtQuick/Controls.2/designer/TextFieldSpecifics.qml qml/QtQuick/Controls.2/designer/ToolBarSpecifics.qml qml/QtQuick/Controls.2/designer/ToolButtonSpecifics.qml qml/QtQuick/Controls.2/designer/ToolSeparatorSpecifics.qml qml/QtQuick/Controls.2/designer/TumblerSpecifics.qml
#    lib/libQt${QT_VERSION_MAJOR}QuickParticles.so
)
if(EXISTS "${QT_ANDROID_QT_ROOT}/jar/QtAndroid-bundled.jar")
  set(_deploymentDepends jar/QtAndroid-bundled.jar jar/QtAndroidBearer-bundled.jar jar/QtMultimedia-bundled.jar ${_deploymentDepends})
else()
  set(_deploymentDepends jar/QtAndroid.jar jar/QtAndroidBearer.jar jar/QtAndroidExtras.jar jar/QtMultimedia.jar ${_deploymentDepends})
endif()
foreach(_qmlFile CheckIndicator.qml RadioIndicator.qml SwitchIndicator.qml)
  if(EXISTS "${QT_ANDROID_QT_ROOT}/qml/QtQuick/Controls.2/${_qmlFile}")
    set(_deploymentDepends ${_deploymentDepends} qml/QtQuick/Controls.2/${_qmlFile})
  endif()
endforeach()

add_qt_android_apk(apk kid3-qml
  NAME Kid3
  PACKAGE_NAME "net.sourceforge.kid3"
  DEPENDS kid3-core kid3-gui
          musicbrainzimport discogsimport freedbimport amazonimport
          taglibmetadata kid3qml Qt${QT_VERSION_MAJOR}::Svg
          ${ANDROID_EXTRA_LIBS_DIR}/libssl_1_1.so ${ANDROID_EXTRA_LIBS_DIR}/libcrypto_1_1.so
  DEPLOYMENT_DEPENDS ${_deploymentDepends}
  PACKAGE_SOURCES ${_androidPackageDir}
  KEYSTORE ${_keystorePathAlias}
)

# Unfortunately, androiddeployqt performs the library stripping before copying
# the android-extra-libs (after DEPENDS in the command above). The external
# libraries have to be stripped by the linker before the package is built.
set_property(TARGET musicbrainzimport APPEND PROPERTY LINK_FLAGS_RELEASE -s)
set_property(TARGET discogsimport APPEND PROPERTY LINK_FLAGS_RELEASE -s)
set_property(TARGET freedbimport APPEND PROPERTY LINK_FLAGS_RELEASE -s)
set_property(TARGET amazonimport APPEND PROPERTY LINK_FLAGS_RELEASE -s)
set_property(TARGET taglibmetadata APPEND PROPERTY LINK_FLAGS_RELEASE -s)
set_property(TARGET kid3qml APPEND PROPERTY LINK_FLAGS_RELEASE -s)
set_property(TARGET kid3-core APPEND PROPERTY LINK_FLAGS_RELEASE -s)
set_property(TARGET kid3-gui APPEND PROPERTY LINK_FLAGS_RELEASE -s)

add_dependencies(apk android-package musicbrainzimport discogsimport
                 freedbimport amazonimport taglibmetadata kid3qml)
