aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/FindTexturePacker.cmake
blob: 874a8f675b2d8110ff5760b79f180ee102abf0a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#.rst:
# FindTexturePacker
# -----------------
# Finds the TexturePacker
#
# If WITH_TEXTUREPACKER is defined and points to a directory,
# this path will be used to search for the Texturepacker binary
#
#
# This will define the following (imported) targets::
#
#   TexturePacker::TexturePacker   - The TexturePacker executable

if(NOT TARGET TexturePacker::TexturePacker)
  if(KODI_DEPENDSBUILD)
    add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL)
    set_target_properties(TexturePacker::TexturePacker PROPERTIES
                                                       IMPORTED_LOCATION "${NATIVEPREFIX}/bin/TexturePacker")
  elseif(WIN32)
    add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL)
    set_target_properties(TexturePacker::TexturePacker PROPERTIES
                                                       IMPORTED_LOCATION "${DEPENDENCIES_DIR}/tools/TexturePacker/TexturePacker.exe")
  else()
    if(WITH_TEXTUREPACKER)
      get_filename_component(_tppath ${WITH_TEXTUREPACKER} ABSOLUTE)
      find_program(TEXTUREPACKER_EXECUTABLE TexturePacker PATHS ${_tppath})

      include(FindPackageHandleStandardArgs)
      find_package_handle_standard_args(TexturePacker DEFAULT_MSG TEXTUREPACKER_EXECUTABLE)
      if(TEXTUREPACKER_FOUND)
        add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL)
        set_target_properties(TexturePacker::TexturePacker PROPERTIES
                                                           IMPORTED_LOCATION "${TEXTUREPACKER_EXECUTABLE}")
      endif()
      mark_as_advanced(TEXTUREPACKER)
    else()
      add_subdirectory(${CMAKE_SOURCE_DIR}/tools/depends/native/TexturePacker build/texturepacker)
      add_executable(TexturePacker::TexturePacker ALIAS TexturePacker)
    endif()
  endif()
endif()