Dawn/src/dawntools/texturetool/CMakeLists.txt

53 lines
1.1 KiB
CMake

# Copyright (c) 2021 Dominic Msters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
# Texture Build Tool
project(texturetool VERSION 1.0)
add_executable(texturetool)
target_sources(texturetool
PRIVATE
${DAWN_SHARED_SOURCES}
${DAWN_TOOL_SOURCES}
TextureTool.cpp
../util/Image.cpp
)
target_include_directories(texturetool
PUBLIC
${DAWN_SHARED_INCLUDES}
${DAWN_TOOL_INCLUDES}
${CMAKE_CURRENT_LIST_DIR}
)
# Definitions
target_compile_definitions(texturetool
PUBLIC
${DAWN_SHARED_DEFINITIONS}
DAWN_TOOL_INSTANCE=TextureTool
DAWN_TOOL_HEADER="TextureTool.hpp"
)
# Libraries
target_link_libraries(texturetool
PUBLIC
${DAWN_BUILD_HOST_LIBS}
stb
)
# Tool Function
function(tool_texture target in)
set(DEPS "")
if(DAWN_BUILD_TOOLS)
set(DEPS texturetool)
endif()
add_custom_target(${target}
COMMAND texturetool --input="${DAWN_ASSETS_SOURCE_DIR}/${in}" --output="${DAWN_ASSETS_BUILD_DIR}/${target}"
COMMENT "Generating texture ${target} from ${in}"
DEPENDS ${DEPS}
)
add_dependencies(${DAWN_TARGET_NAME} ${target})
endfunction()