diff options
| author | Přemysl Eric Janouch <p@janouch.name> | 2021-10-27 09:48:57 +0200 | 
|---|---|---|
| committer | Přemysl Eric Janouch <p@janouch.name> | 2021-10-27 09:48:57 +0200 | 
| commit | 46e9b7b5843b130094212cb5f693e90488a53d50 (patch) | |
| tree | 1abfa31658920f16ef7b0e7ae1540faddda3d263 | |
| parent | 0eb935ad9f23856cafafafdf80a6a33afe31a63c (diff) | |
| download | tdv-46e9b7b5843b130094212cb5f693e90488a53d50.tar.gz tdv-46e9b7b5843b130094212cb5f693e90488a53d50.tar.xz tdv-46e9b7b5843b130094212cb5f693e90488a53d50.zip | |
sdgui: rasterize some icons, including for Windows
| -rw-r--r-- | CMakeLists.txt | 46 | ||||
| -rw-r--r-- | README.adoc | 4 | 
2 files changed, 47 insertions, 3 deletions
| diff --git a/CMakeLists.txt b/CMakeLists.txt index 6080d32..3c119b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -188,10 +188,51 @@ endif (NOT WIN32)  # The same for the alternative GTK+ UI  if (WITH_GUI) -	add_executable (sdgui WIN32 +	find_program (rsvg_convert_EXECUTABLE rsvg-convert REQUIRED) +	set (icon_svg ${PROJECT_SOURCE_DIR}/sdgui.svg) +	set (icon_base ${PROJECT_BINARY_DIR}/icons) +	set (icon_png_list) + +	# The largest size is mainly for an appropriately sized Windows icon +	foreach (icon_number 16 32 48 256) +		set (icon_size ${icon_number}x${icon_number}) +		set (icon_png_path ${icon_base}/hicolor/${icon_size}/apps) +		set (icon_png ${icon_png_path}/sdgui.png) +		list (APPEND icon_png_list ${icon_png}) + +		add_custom_command (OUTPUT ${icon_png} +			COMMAND ${CMAKE_COMMAND} -E make_directory ${icon_png_path} +			COMMAND ${rsvg_convert_EXECUTABLE} --output=${icon_png} +				--width=${icon_number} --height=${icon_number} ${icon_svg} +			DEPENDS ${icon_svg} +			COMMENT "Generating ${icon_size} application icon" VERBATIM) +	endforeach (icon_number) + +	add_custom_target (sdgui-icons ALL DEPENDS ${icon_png_list}) + +	set (sdgui_sources  		src/sdgui.c  		src/stardict-view.c  		${project_common_sources}) + +	if (WIN32) +		find_program (icotool_EXECUTABLE icotool REQUIRED) +		set (icon_ico ${PROJECT_BINARY_DIR}/sdgui.ico) +		add_custom_command (OUTPUT ${icon_ico} +			COMMAND ${icotool_EXECUTABLE} -c -o ${icon_ico} ${icon_png_list} +			DEPENDS ${icon_png_list} +			COMMENT "Generating Windows program icon" VERBATIM) + +		set (resource_file ${PROJECT_BINARY_DIR}/sdgui.rc) +		list (APPEND sdgui_sources ${resource_file}) +		add_custom_command (OUTPUT ${resource_file} +			COMMAND ${CMAKE_COMMAND} -E echo "1 ICON \"sdgui.ico\"" +				> ${resource_file} VERBATIM) +		set_property (SOURCE ${resource_file} +			APPEND PROPERTY OBJECT_DEPENDS ${icon_ico}) +	endif () + +	add_executable (sdgui WIN32 ${sdgui_sources})  	target_include_directories (sdgui PUBLIC ${gtk_INCLUDE_DIRS})  	target_link_libraries (sdgui ${project_common_libraries} ${gtk_LIBRARIES})  endif () @@ -231,6 +272,8 @@ if (NOT WIN32)  		install (TARGETS sdgui DESTINATION ${CMAKE_INSTALL_BINDIR})  		install (FILES sdgui.svg  			DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps) +		install (DIRECTORY ${PROJECT_BINARY_DIR}/icons +			DESTINATION ${CMAKE_INSTALL_DATADIR})  		install (FILES sdgui.desktop  			DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)  		install (FILES sdgui.xml @@ -266,6 +309,7 @@ elseif (WITH_GUI)  	install (FILES  		${WIN32_DEPENDS_PATH}/share/icons/hicolor/index.theme  		DESTINATION share/icons/hicolor) +	install (DIRECTORY ${icon_base} DESTINATION share)  	install (SCRIPT cmake/Win32Cleanup.cmake)  	install (CODE "execute_process (COMMAND diff --git a/README.adoc b/README.adoc index d6bfc50..543e179 100644 --- a/README.adoc +++ b/README.adoc @@ -28,10 +28,10 @@ The rest of this README will concern itself with externalities.  Building and Running  -------------------- -Build dependencies: CMake, pkg-config, asciidoctor + +Build dependencies: CMake, pkg-config, asciidoctor, librsvg (for the GUI) +  Runtime dependencies: ncursesw, zlib, ICU, termo (included), glib-2.0 >= 2.38,   pango, xcb, xcb-xfixes (the latter two optional for the TUI), - gtk+-3.0 (for the alternative graphical UI) + gtk+-3.0 (for the GUI)   $ git clone --recursive https://git.janouch.name/p/sdtui.git   $ mkdir sdtui/build | 
