61 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			CMake
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			CMake
		
	
	
	
	
	
| # Copyright (c) 2023 Dominic Msters
 | |
| # 
 | |
| # This software is released under the MIT License.
 | |
| # https://opensource.org/licenses/MIT
 | |
| 
 | |
| # Texture Build Tool
 | |
| project(scenetool VERSION 1.0)
 | |
| add_executable(scenetool)
 | |
| 
 | |
| # Subdirs
 | |
| 
 | |
| # Sources
 | |
| target_sources(scenetool
 | |
|   PRIVATE
 | |
|     ${DAWN_SHARED_SOURCES}
 | |
|     ${DAWN_TOOL_SOURCES}
 | |
|     SceneTool.cpp
 | |
|     SceneGen.cpp
 | |
| )
 | |
| 
 | |
| # Includes
 | |
| target_include_directories(scenetool
 | |
|   PUBLIC
 | |
|     ${DAWN_SHARED_INCLUDES}
 | |
|     ${DAWN_TOOL_INCLUDES}
 | |
|     ${CMAKE_CURRENT_LIST_DIR}
 | |
| )
 | |
| 
 | |
| # Definitions
 | |
| target_compile_definitions(scenetool
 | |
|   PUBLIC
 | |
|     ${DAWN_SHARED_DEFINITIONS}
 | |
|     DAWN_TOOL_INSTANCE=SceneTool
 | |
|     DAWN_TOOL_HEADER="SceneTool.hpp"
 | |
| )
 | |
| 
 | |
| # Libraries
 | |
| target_link_libraries(scenetool
 | |
|   PUBLIC
 | |
|     ${DAWN_BUILD_HOST_LIBS}
 | |
| )
 | |
| 
 | |
| # Tool Function
 | |
| function(tool_scene in)
 | |
|   set(DEPS "")
 | |
|   if(DAWN_BUILD_TOOLS)
 | |
|     set(DEPS scenetool)
 | |
|   endif()
 | |
| 
 | |
|   STRING(REGEX REPLACE "[\.|\\|\/|\:]" "-" scene_name ${in})
 | |
|   add_custom_target(scene_${scene_name}
 | |
|     COMMAND scenetool --input="${in}" --output="${DAWN_GENERATED_DIR}/generatedscenes" --sources="${DAWN_SOURCES_DIR}"
 | |
|     COMMENT "Generating scene from ${in}"
 | |
|     DEPENDS ${DEPS}
 | |
|   )
 | |
|   target_include_directories(${DAWN_TARGET_NAME}
 | |
|     PUBLIC
 | |
|       ${DAWN_GENERATED_DIR}/generatedscenes
 | |
|   )
 | |
|   add_dependencies(${DAWN_TARGET_NAME} scene_${scene_name})
 | |
| endfunction() |