Fix tool on different platforms.

This commit is contained in:
2024-12-24 23:41:27 -06:00
parent fe69d85fab
commit afa6a1a036
4 changed files with 20 additions and 9 deletions

View File

@ -12,6 +12,9 @@ add_custom_target(dawnassets
--input=${DAWN_ASSETS_BUILD_DIR}
--output=${DAWN_BUILD_DIR}/dawn.tar
COMMENT "Bundling assets..."
USES_TERMINAL
DEPENDS ${DAWN_ASSETS}
USES_TERMINAL
DEPENDS
${DAWN_ASSETS}
${DAWN_TOOLS_DIR}/assetstool/assetstool.py
${Python3_EXECUTABLE}
)

1
tools/assetstool/assetstool.py Executable file → Normal file
View File

@ -1,4 +1,3 @@
#!/usr/bin/env python
# Copyright (c) 2023 Dominic Masters
#
# This software is released under the MIT License.

View File

@ -1,6 +1,6 @@
find_package(Python3 REQUIRED COMPONENTS Interpreter)
function(tool_texture target file)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
# Defaults
set(FILTER_MIN "")
set(FILTER_MAG "")
@ -27,7 +27,9 @@ function(tool_texture target file)
endif()
add_custom_target(${target}_texture
COMMAND ${DAWN_TOOLS_DIR}/texturetool/texturetool.py
COMMAND
${Python3_EXECUTABLE}
${DAWN_TOOLS_DIR}/texturetool/texturetool.py
--input="${DAWN_ASSETS_SOURCE_DIR}/${file}"
--output="${DAWN_ASSETS_BUILD_DIR}/${target}.texture"
--wrap-x="${WRAP_X}"
@ -39,7 +41,14 @@ function(tool_texture target file)
--crop-start-y="${CROP_START_Y}"
--crop-end-x="${CROP_END_X}"
--crop-end-y="${CROP_END_Y}"
COMMENT "Generating texture ${target} from ${FILE}"
COMMENT
"Generating texture ${target} from ${FILE}"
DEPENDS
${DAWN_TOOLS_DIR}/texturetool/texturetool.py
${DAWN_ASSETS_SOURCE_DIR}/${file}
${Python3_EXECUTABLE}
USES_TERMINAL
)
add_dependencies(dawnassets ${target}_texture)
endfunction()

2
tools/texturetool/texturetool.py Executable file → Normal file
View File

@ -1,9 +1,9 @@
#!/usr/bin/env python
# Copyright (c) 2023 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
from PIL import Image
import argparse
import os