#################################################
#
#  (C) 2016 Alexander Golubev
#  fatzer2 (AT) gmail.com
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 2
#
#################################################

include_directories(
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
)

# add_definitions( -DUSE_LIBZ )

# FIXME: that should potentialy break the cross
#        compilation, If it is possible in
#        generall.

tde_add_executable( bin2c
  SOURCES bin2c.c
  LINK z
)

foreach( _img goal.png halfstone_1.png halfstone_2.png halfstone_3.png
    halfstone_4.png man.png object.png saveman.png stone_1.png stone_2.png
    stone_3.png stone_4.png stone_5.png stone_6.png treasure.png starfield.png
    )
  list( APPEND IMAGES "${CMAKE_CURRENT_SOURCE_DIR}/${_img}" )
endforeach( )

add_custom_command( OUTPUT  ${CMAKE_CURRENT_BINARY_DIR}/data.c
  COMMAND bin2c \"\" ${IMAGES}
  DEPENDS bin2c ${IMAGES}
  WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)

add_custom_target ( ksokoban_images_data_c
  DEPENDS data.c
)
