Generate more icons.

* Add automatic icon generation to CMakeLists.txt.
  These icons are generated from the scalable SVG image.
* Add pregenerated icons to the tree.
* Link an icon to the Windows binary.
This commit is contained in:
Přemysl Eric Janouch 2011-01-22 17:13:56 +01:00
parent 2f5f87119d
commit 37e2c5f01f
6 changed files with 45 additions and 0 deletions

View File

@ -53,6 +53,35 @@ if (WIN32)
remove_directory ${WIN32_DEPENDS_PATH}) remove_directory ${WIN32_DEPENDS_PATH})
endif (WIN32) endif (WIN32)
# Generate icons
find_program (CONVERT_EXECUTABLE convert)
mark_as_advanced (CONVERT_EXECUTABLE)
if (CONVERT_EXECUTABLE AND NOT WIN32)
set (icon_base ${CMAKE_CURRENT_SOURCE_DIR}/share/icons/hicolor)
set (icon_svg ${icon_base}/scalable/apps/logdiag.svg)
set (icon_size_list 16x16 32x32 48x48)
set (icon_png_list)
foreach (icon_size ${icon_size_list})
set (icon_png_path ${icon_base}/${icon_size}/apps)
set (icon_png ${icon_png_path}/logdiag.png)
list (APPEND icon_png_list ${icon_png})
add_custom_command (OUTPUT ${icon_png}
COMMAND ${CMAKE_COMMAND} -E make_directory ${icon_png_path}
COMMAND ${CONVERT_EXECUTABLE} -background none
-resize ${icon_size} ${icon_svg} ${icon_png}
DEPENDS ${icon_svg})
endforeach (icon_size)
set (icon_ico ${CMAKE_CURRENT_SOURCE_DIR}/share/logdiag.ico)
add_custom_command (OUTPUT ${icon_ico}
COMMAND ${CONVERT_EXECUTABLE} ${icon_png_list} ${icon_ico}
DEPENDS ${icon_png_list})
add_custom_target (logdiag_icons DEPENDS ${icon_ico})
endif (CONVERT_EXECUTABLE AND NOT WIN32)
# Dependencies # Dependencies
find_package (GTK2 2.12 REQUIRED gtk) find_package (GTK2 2.12 REQUIRED gtk)
find_package (Lua51 REQUIRED) find_package (Lua51 REQUIRED)
@ -116,6 +145,21 @@ set (logdiag_HEADERS
${liblogdiag_HEADERS} ${liblogdiag_HEADERS}
src/ld-window-main.h) src/ld-window-main.h)
# Resource compilation for MinGW
if (MINGW)
set (CMAKE_RC_COMPILER_INIT windres)
enable_language (RC)
set (CMAKE_RC_FLAGS "-O coff")
set (CMAKE_RC_COMPILE_OBJECT
"<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -o <OBJECT> <SOURCE>")
endif (MINGW)
if (WIN32)
set (logdiag_SOURCES
${logdiag_SOURCES}
share/logdiag.rc)
endif (WIN32)
# Generate a configure file # Generate a configure file
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h) ${CMAKE_CURRENT_BINARY_DIR}/config.h)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
share/logdiag.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

1
share/logdiag.rc Normal file
View File

@ -0,0 +1 @@
LD_ICON ICON "logdiag.ico"