summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindTexturePacker.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/FindTexturePacker.cmake')
-rw-r--r--cmake/modules/FindTexturePacker.cmake41
1 files changed, 41 insertions, 0 deletions
diff --git a/cmake/modules/FindTexturePacker.cmake b/cmake/modules/FindTexturePacker.cmake
new file mode 100644
index 0000000..aa6fd3a
--- /dev/null
+++ b/cmake/modules/FindTexturePacker.cmake
@@ -0,0 +1,41 @@
1#.rst:
2# FindTexturePacker
3# -----------------
4# Finds the TexturePacker
5#
6# If WITH_TEXTUREPACKER is defined and points to a directory,
7# this path will be used to search for the Texturepacker binary
8#
9#
10# This will define the following (imported) targets::
11#
12# TexturePacker::TexturePacker - The TexturePacker executable
13
14if(NOT TARGET TexturePacker::TexturePacker)
15 if(KODI_DEPENDSBUILD)
16 add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL)
17 set_target_properties(TexturePacker::TexturePacker PROPERTIES
18 IMPORTED_LOCATION "${NATIVEPREFIX}/bin/TexturePacker")
19 elseif(WIN32)
20 add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL)
21 set_target_properties(TexturePacker::TexturePacker PROPERTIES
22 IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/tools/TexturePacker/TexturePacker.exe")
23 else()
24 if(WITH_TEXTUREPACKER)
25 get_filename_component(_tppath ${WITH_TEXTUREPACKER} ABSOLUTE)
26 find_program(TEXTUREPACKER_EXECUTABLE TexturePacker PATHS ${_tppath})
27
28 include(FindPackageHandleStandardArgs)
29 find_package_handle_standard_args(TexturePacker DEFAULT_MSG TEXTUREPACKER_EXECUTABLE)
30 if(TEXTUREPACKER_FOUND)
31 add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL)
32 set_target_properties(TexturePacker::TexturePacker PROPERTIES
33 IMPORTED_LOCATION "${TEXTUREPACKER_EXECUTABLE}")
34 endif()
35 mark_as_advanced(TEXTUREPACKER)
36 else()
37 add_subdirectory(${CMAKE_SOURCE_DIR}/tools/depends/native/TexturePacker build/texturepacker)
38 add_executable(TexturePacker::TexturePacker ALIAS TexturePacker)
39 endif()
40 endif()
41endif()