diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2011-01-22 17:13:56 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2011-01-22 18:07:12 +0100 |
commit | 37e2c5f01f2ee00af3a10311b69f66f8653b42db (patch) | |
tree | a0c5fec3de69f589f80a09dd58aecb8eae2b4409 /CMakeLists.txt | |
parent | 2f5f87119d4f9f3f2ccb177da1c0ac9da55611c8 (diff) | |
download | logdiag-37e2c5f01f2ee00af3a10311b69f66f8653b42db.tar.gz logdiag-37e2c5f01f2ee00af3a10311b69f66f8653b42db.tar.xz logdiag-37e2c5f01f2ee00af3a10311b69f66f8653b42db.zip |
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.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 72f975d..2e1675c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,35 @@ if (WIN32) remove_directory ${WIN32_DEPENDS_PATH}) 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 find_package (GTK2 2.12 REQUIRED gtk) find_package (Lua51 REQUIRED) @@ -116,6 +145,21 @@ set (logdiag_HEADERS ${liblogdiag_HEADERS} 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 configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) |