Warning, /plasma/oxygen/cursors/src/cursors.cmake is written in an unsupported language. File is not indexed.
0001 # This macro produces a "themed" version of the SVG, using the spcified colors. 0002 # Than, it renders this themed SVG to PNG files. 0003 # You can specify one or more dpi values when you call this macro. 0004 macro(add_cursor cursor color theme dpi) 0005 # Produce a "themed" SVG 0006 add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/oxy-${theme}/svg/${cursor}.svg 0007 DEPENDS ${MAKE_SVG} ${CMAKE_CURRENT_SOURCE_DIR}/colors.in ${SVGDIR}/${cursor}.svg 0008 COMMAND ${CMAKE_COMMAND} -Dconfig=${CMAKE_CURRENT_SOURCE_DIR}/colors.in 0009 -Dinput=${SVGDIR}/${cursor}.svg 0010 -Doutput=${CMAKE_BINARY_DIR}/oxy-${theme}/svg/${cursor}.svg 0011 -P ${MAKE_SVG} 0012 ) 0013 # Prepare a list of resolutions in dpi 0014 set(resolutions ${ARGV}) 0015 list(REMOVE_AT resolutions 0) 0016 list(REMOVE_AT resolutions 0) 0017 list(REMOVE_AT resolutions 0) 0018 # Render the SVG 0019 foreach(resolution ${resolutions}) 0020 add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/oxy-${theme}/png/${resolution}/${cursor}.png 0021 DEPENDS ${CMAKE_BINARY_DIR}/oxy-${theme}/svg/${cursor}.svg 0022 COMMAND ${INKSCAPE} --without-gui --export-dpi=${resolution} 0023 --export-png=${CMAKE_BINARY_DIR}/oxy-${theme}/png/${resolution}/${cursor}.png 0024 ${CMAKE_BINARY_DIR}/oxy-${theme}/svg/${cursor}.svg 0025 ) 0026 endforeach(resolution) 0027 endmacro(add_cursor) 0028 0029 macro(add_x_cursor theme cursor dpi) 0030 # Prepare a list of resolutions in dpi 0031 set(resolutions ${ARGV}) 0032 list(REMOVE_AT resolutions 0) 0033 list(REMOVE_AT resolutions 0) 0034 # Prepare a list of the png files that are necessary 0035 set(inputs) 0036 foreach(png ${${cursor}_inputs}) 0037 foreach(resolution ${resolutions}) 0038 list(APPEND inputs ${CMAKE_BINARY_DIR}/oxy-${theme}/png/${resolution}/${png}) 0039 endforeach(resolution) 0040 endforeach(png) 0041 # Make a coma-separated list (normal lists can't be passed as argument) 0042 string(REPLACE ";" "," resolutions_coma_separated "${resolutions}") 0043 # Adopt the x cursor config file to the requested resolutions 0044 add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/oxy-${theme}/config/${cursor}.in 0045 DEPENDS ${MAKE_CONFIG} ${CONFIGDIR}/${cursor}.in 0046 COMMAND ${CMAKE_COMMAND} -Dconfig=${CONFIGDIR}/${cursor}.in 0047 -Doutput=${CMAKE_BINARY_DIR}/oxy-${theme}/config/${cursor}.in 0048 -Dresolutions=${resolutions_coma_separated} 0049 -P ${MAKE_CONFIG} 0050 ) 0051 # Use the adopted x cursor config file and the png files to produce the cursor file 0052 if(NOT WIN32) 0053 add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/oxy-${theme}/cursors/${cursor} 0054 DEPENDS ${inputs} ${CMAKE_BINARY_DIR}/oxy-${theme}/config/${cursor}.in 0055 COMMAND ${XCURSORGEN} -p ${CMAKE_BINARY_DIR}/oxy-${theme}/png 0056 ${CMAKE_BINARY_DIR}/oxy-${theme}/config/${cursor}.in 0057 ${CMAKE_BINARY_DIR}/oxy-${theme}/cursors/${cursor} 0058 ) 0059 else(NOT WIN32) 0060 add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/oxy-${theme}/cursors/${cursor} 0061 DEPENDS ${inputs} ${CMAKE_BINARY_DIR}/oxy-${theme}/config/${cursor}.in 0062 COMMAND "${CMAKE_SOURCE_DIR}/wincursor.py" ${CMAKE_BINARY_DIR}/oxy-${theme}/png 0063 ${CMAKE_BINARY_DIR}/oxy-${theme}/config/${cursor}.in 0064 ${CMAKE_BINARY_DIR}/wincursors/oxy-${theme} 0065 ${CMAKE_BINARY_DIR}/oxy-${theme}/cursors/${cursor} 0066 ) 0067 endif(NOT WIN32) 0068 endmacro(add_x_cursor) 0069 0070 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/packages) 0071 0072 # Macro that adds a theme. You can specify more than one dpi value (overloaded macro). 0073 macro(add_theme color theme dpi) 0074 # Prepare a list of resolutions in dpi 0075 set(resolutions ${ARGV}) 0076 list(REMOVE_AT resolutions 0) 0077 list(REMOVE_AT resolutions 0) 0078 # Make missing directories 0079 foreach (resolution ${resolutions}) 0080 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/oxy-${theme}/png/${resolution}) 0081 endforeach(resolution) 0082 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/oxy-${theme}/svg) 0083 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/oxy-${theme}/config) 0084 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/oxy-${theme}/cursors) 0085 if(WIN32) 0086 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/wincursors/oxy-${theme}) 0087 endif(WIN32) 0088 set(${theme}_cursors) 0089 # render SVG to PNG files 0090 foreach(svg ${SVGS}) 0091 string(REGEX REPLACE ".*/" "" cursor ${svg}) # use relative paths 0092 string(REGEX REPLACE "[.]svg" "" cursor ${cursor}) # remove ".svg" from the path 0093 add_cursor(${cursor} ${color} ${theme} ${resolutions}) # Render a "themed" version of the SVG to PNG files. 0094 endforeach(svg) 0095 # produce cursor files from the png files 0096 foreach(cursor ${CURSORS}) 0097 add_x_cursor(${theme} ${cursor} ${resolutions}) 0098 list(APPEND ${theme}_cursors ${CMAKE_BINARY_DIR}/oxy-${theme}/cursors/${cursor}) 0099 endforeach(cursor) 0100 # add the symbolic links 0101 foreach(symlink ${SYMLINKS_PATHS}) 0102 file(COPY ${symlink} DESTINATION ${CMAKE_BINARY_DIR}/oxy-${theme}/cursors) 0103 endforeach(symlink) 0104 # packaging 0105 add_custom_target(theme-${theme} ALL DEPENDS ${${theme}_cursors}) 0106 add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/oxy-${theme}/index.theme 0107 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/index.theme 0108 COMMAND ${CMAKE_COMMAND} -E copy 0109 ${CMAKE_CURRENT_SOURCE_DIR}/index.theme 0110 ${CMAKE_BINARY_DIR}/oxy-${theme}/index.theme 0111 ) 0112 add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/packages/oxy-${theme}.tar.bz2 0113 DEPENDS ${${theme}_cursors} ${CMAKE_BINARY_DIR}/oxy-${theme}/index.theme 0114 COMMAND ${TAR} cjf ${CMAKE_BINARY_DIR}/packages/oxy-${theme}.tar.bz2 0115 oxy-${theme}/cursors 0116 oxy-${theme}/index.theme 0117 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 0118 ) 0119 add_custom_target(package-${theme} ALL DEPENDS ${CMAKE_BINARY_DIR}/packages/oxy-${theme}.tar.bz2) 0120 endmacro(add_theme)