Warning, /games/skladnik/src/images/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2022 Friedrich W. H. Kossebau <kossebau@kde.org>
0002 #
0003 # SPDX-License-Identifier: BSD-3-Clause
0004
0005 find_package(POVRay)
0006 set_package_properties(POVRay PROPERTIES
0007 TYPE OPTIONAL
0008 PURPOSE "For rendering the games PNG images"
0009 )
0010
0011 if(NOT POVRay_FOUND)
0012 return()
0013 endif()
0014
0015
0016 function(add_rendered_png output)
0017 cmake_parse_arguments(ARGS "" "SOURCE;WORKING_DIRECTORY;RESOLUTION" "DEPENDS" ${ARGN})
0018
0019 if (NOT ARGS_SOURCE)
0020 message(FATAL_ERROR "SOURCE argument missing")
0021 endif()
0022
0023 if (NOT ARGS_RESOLUTION)
0024 set(resolution "+W192" "+H192")
0025 elseif (ARGS_RESOLUTION STREQUAL "STONE")
0026 set(resolution "+W192" "+H96")
0027 elseif (ARGS_RESOLUTION STREQUAL "HALFSTONE")
0028 set(resolution "+W96" "+H96")
0029 else()
0030 message(FATAL_ERROR "Unknown RESOLUTION value: ${ARGS_RESOLUTION}")
0031 endif()
0032
0033 # no antialias
0034 #set(antialias)
0035 # normal antialias
0036 #set(antialias "Antialias=on")
0037 # slow antialias
0038 set(antialias "Antialias=on" "Antialias_Threshold=0.0" "Antialias_Depth=9")
0039 # used version assumed by the creation date of the files
0040 set(versionhint "+MV3.0")
0041
0042 set(_workdir_arg)
0043 if(ARGS_WORKING_DIRECTORY)
0044 set(_workdir_arg "WORKING_DIRECTORY" ${ARGS_WORKING_DIRECTORY})
0045 endif()
0046
0047 if(NOT IS_ABSOLUTE output)
0048 string(PREPEND output "${CMAKE_CURRENT_SOURCE_DIR}/")
0049 endif()
0050
0051 set(source ${ARGS_SOURCE})
0052 if(NOT IS_ABSOLUTE source)
0053 string(PREPEND source "${CMAKE_CURRENT_SOURCE_DIR}/")
0054 endif()
0055
0056 get_filename_component(include ${source} DIRECTORY)
0057
0058 set(depends)
0059 foreach(d ${ARGS_DEPENDS})
0060 if(NOT IS_ABSOLUTE d)
0061 string(PREPEND d "${CMAKE_CURRENT_SOURCE_DIR}/")
0062 endif()
0063 list(APPEND depends ${d})
0064 endforeach()
0065
0066 # redirect all logging to file (openSUSE POV-Ray 3.7.0.10.unofficial fails to disable console though)
0067 get_filename_component(logbasename ${output} NAME)
0068 set(logredirect "-GA${logbasename}.log")
0069
0070 add_custom_command(OUTPUT ${output}
0071 COMMENT "Generating ${output}"
0072 ${_workdir_arg}
0073 COMMAND POVRay::POVRay ${antialias} ${versionhint} ${resolution} ${logredirect} +I${source} +L${include} +O${output}
0074 VERBATIM
0075 MAIN_DEPENDENCY ${sources}
0076 DEPENDS ${depends}
0077 )
0078 endfunction()
0079
0080 add_rendered_png(treasure.png SOURCE treasure.pov DEPENDS goal.pov floor_common.inc)
0081 add_rendered_png(object.png SOURCE object.pov DEPENDS floor_common.inc)
0082 add_rendered_png(goal.png SOURCE goal.pov DEPENDS floor_common.inc)
0083
0084 add_rendered_png(man.png SOURCE man.pov DEPENDS man_common.inc floor_common.inc)
0085 add_rendered_png(saveman.png SOURCE saveman.pov DEPENDS man_common.inc goal.pov floor_common.inc)
0086
0087 add_rendered_png(halfstone_1.png SOURCE halfstone_1.pov DEPENDS stone_common.inc RESOLUTION HALFSTONE)
0088 add_rendered_png(halfstone_2.png SOURCE halfstone_2.pov DEPENDS stone_common.inc RESOLUTION HALFSTONE)
0089 add_rendered_png(halfstone_3.png SOURCE halfstone_3.pov DEPENDS stone_common.inc RESOLUTION HALFSTONE)
0090 add_rendered_png(halfstone_4.png SOURCE halfstone_4.pov DEPENDS stone_common.inc RESOLUTION HALFSTONE)
0091
0092 add_rendered_png(stone_1.png SOURCE stone_1.pov DEPENDS stone_common.inc RESOLUTION STONE)
0093 add_rendered_png(stone_2.png SOURCE stone_2.pov DEPENDS stone_common.inc RESOLUTION STONE)
0094 add_rendered_png(stone_3.png SOURCE stone_3.pov DEPENDS stone_common.inc RESOLUTION STONE)
0095 add_rendered_png(stone_4.png SOURCE stone_4.pov DEPENDS stone_common.inc RESOLUTION STONE)
0096 add_rendered_png(stone_5.png SOURCE stone_5.pov DEPENDS stone_common.inc RESOLUTION STONE)
0097 add_rendered_png(stone_6.png SOURCE stone_6.pov DEPENDS stone_common.inc RESOLUTION STONE)