xT: produce an Android icon
This commit is contained in:
@@ -156,8 +156,8 @@ running `make generate` first.
|
||||
xT
|
||||
~~
|
||||
The Qt Widgets frontend is a separate CMake subproject. It generally supports
|
||||
all desktop operating systems. To avoid having to specify the relay address
|
||||
each time you run it, pass it on the command line.
|
||||
all desktop operating systems, Android is technically usable. To avoid having
|
||||
to specify the relay address each time you run it, pass it on the command line.
|
||||
|
||||
xW
|
||||
~~
|
||||
|
||||
@@ -48,7 +48,32 @@ foreach (icon xT xT-highlighted)
|
||||
list (APPEND icon_rsrc_list "${icon_png}")
|
||||
endforeach ()
|
||||
|
||||
if (APPLE)
|
||||
function (android_mipmap_icon svg density size output_dir output)
|
||||
set (_mipmap_dir "${output_dir}/res/mipmap-${density}")
|
||||
set (_png "${_mipmap_dir}/ic_launcher.png")
|
||||
set (${output} "${_png}" PARENT_SCOPE)
|
||||
|
||||
find_program (rsvg_convert_EXECUTABLE rsvg-convert REQUIRED)
|
||||
add_custom_command (OUTPUT "${_png}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${_mipmap_dir}"
|
||||
COMMAND ${rsvg_convert_EXECUTABLE} "--output=${_png}"
|
||||
"--width=${size}" "--height=${size}" -- "${svg}"
|
||||
DEPENDS "${svg}"
|
||||
COMMENT "Generating Android ${density} application icon" VERBATIM)
|
||||
endfunction ()
|
||||
|
||||
if (ANDROID)
|
||||
set (android_base "${PROJECT_BINARY_DIR}/android")
|
||||
set (android_icon_list)
|
||||
foreach (density_size
|
||||
ldpi:36 mdpi:48 hdpi:72 xhdpi:96 xxhdpi:144 xxxhdpi:192)
|
||||
string (REPLACE ":" ";" density_size "${density_size}")
|
||||
android_mipmap_icon ("${PROJECT_SOURCE_DIR}/xT.svg"
|
||||
${density_size} "${android_base}" android_icon)
|
||||
list (APPEND android_icon_list "${android_icon}")
|
||||
endforeach ()
|
||||
add_custom_target (android-icons ALL DEPENDS ${android_icon_list})
|
||||
elseif (APPLE)
|
||||
set (MACOSX_BUNDLE_ICON_FILE xT.icns)
|
||||
icon_to_icns ("${PROJECT_SOURCE_DIR}/xT.svg"
|
||||
"${MACOSX_BUNDLE_ICON_FILE}" icon_icns)
|
||||
@@ -79,7 +104,7 @@ else ()
|
||||
endif ()
|
||||
|
||||
# Build the main executable and link it
|
||||
find_program (awk_EXECUTABLE awk ${find_program_REQUIRE})
|
||||
find_program (awk_EXECUTABLE awk REQUIRED)
|
||||
add_custom_command (OUTPUT xC-proto.cpp
|
||||
COMMAND ${CMAKE_COMMAND} -E env LC_ALL=C ${awk_EXECUTABLE}
|
||||
-f ${root}/liberty/tools/lxdrgen.awk
|
||||
@@ -99,8 +124,17 @@ qt_add_executable (xT
|
||||
add_dependencies (xT xC-proto)
|
||||
qt_add_resources (xT "rsrc" PREFIX / FILES "${beep}" ${icon_rsrc_list})
|
||||
target_link_libraries (xT PRIVATE Qt6::Widgets Qt6::Network Qt6::Multimedia)
|
||||
set_target_properties (xT PROPERTIES WIN32_EXECUTABLE ON MACOSX_BUNDLE ON
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER name.janouch.xT)
|
||||
set_target_properties (xT PROPERTIES
|
||||
WIN32_EXECUTABLE ON
|
||||
MACOSX_BUNDLE ON
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER name.janouch.xT
|
||||
QT_ANDROID_APP_NAME xT
|
||||
QT_ANDROID_APP_ICON "@mipmap/ic_launcher"
|
||||
QT_ANDROID_PACKAGE_NAME name.janouch.xT
|
||||
QT_ANDROID_PACKAGE_SOURCE_DIR "${android_base}")
|
||||
if (ANDROID)
|
||||
add_dependencies (xT android-icons)
|
||||
endif ()
|
||||
|
||||
# https://stackoverflow.com/questions/79079161 and resolved in Qt Creator 16.
|
||||
set (QT_QML_GENERATE_QMLLS_INI ON)
|
||||
|
||||
Reference in New Issue
Block a user