Moved C++ tools out
This commit is contained in:
50
tools/texturetool/CMakeLists.txt
Normal file
50
tools/texturetool/CMakeLists.txt
Normal file
@ -0,0 +1,50 @@
|
||||
# Copyright (c) 2021 Dominic Msters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Tool Function
|
||||
function(tool_texture target)
|
||||
# Defaults
|
||||
set(FILE "" )
|
||||
set(FILTER_MIN "")
|
||||
set(FILTER_MAG "")
|
||||
set(WRAP_X "")
|
||||
set(WRAP_Y "")
|
||||
set(SCALE "")
|
||||
set(CROP_START_X "")
|
||||
set(CROP_START_Y "")
|
||||
set(CROP_END_X "")
|
||||
set(CROP_END_Y "")
|
||||
|
||||
# Parse Args
|
||||
foreach(_PAIR IN LISTS ARGN)
|
||||
if (_PAIR MATCHES "^([^:]+)=(.*)$")
|
||||
set(${CMAKE_MATCH_1} ${CMAKE_MATCH_2})
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid pair: ${_PAIR}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Check for missing args
|
||||
if(NOT DEFINED FILE)
|
||||
message(FATAL_ERROR "Missing FILE input")
|
||||
endif()
|
||||
|
||||
add_custom_target(${target}
|
||||
COMMAND ${DAWN_TOOLS_DIR}/texturetool/texturetool.py
|
||||
--input="${FILE}"
|
||||
--output="${DAWN_ASSETS_BUILD_DIR}/${target}.texture"
|
||||
--wrap-x="${WRAP_X}"
|
||||
--wrap-y="${WRAP_Y}"
|
||||
--filter-min="${FILTER_MIN}"
|
||||
--filter-mag="${FILTER_MIN}"
|
||||
--scale="${SCALE}"
|
||||
--crop-start-x="${CROP_START_X}"
|
||||
--crop-start-y="${CROP_START_Y}"
|
||||
--crop-end-x="${CROP_END_X}"
|
||||
--crop-end-y="${CROP_END_Y}"
|
||||
COMMENT "Generating texture ${target} from ${FILE}"
|
||||
)
|
||||
add_dependencies(dawnassets ${target})
|
||||
endfunction()
|
Reference in New Issue
Block a user