Add DEPFILE for asset command

This commit is contained in:
Christian Semmler 2025-08-10 17:37:51 -07:00
parent 08f75d19aa
commit e4566bb93d
No known key found for this signature in database
GPG Key ID: 086DAA1360BEEE5C
2 changed files with 10 additions and 2 deletions

View File

@ -650,6 +650,7 @@ endif()
if(ISLE_BUILD_ASSETS)
message(STATUS "Asset building is enabled")
set(GENERATED_ASSETS_DIR "${CMAKE_BINARY_DIR}/assets")
set(GENERATED_ASSETS_DEPFILE "${GENERATED_ASSETS_DIR}/.d")
add_executable(asset_generator EXCLUDE_FROM_ALL
assets/main.cpp
@ -659,8 +660,9 @@ if(ISLE_BUILD_ASSETS)
add_custom_command(
OUTPUT ${GENERATED_ASSETS_DIR}/.stamp
DEPFILE ${GENERATED_ASSETS_DEPFILE}
COMMAND ${CMAKE_COMMAND} -E make_directory ${GENERATED_ASSETS_DIR}
COMMAND $<TARGET_FILE:asset_generator> ${GENERATED_ASSETS_DIR}
COMMAND $<TARGET_FILE:asset_generator> ${GENERATED_ASSETS_DIR} ${GENERATED_ASSETS_DEPFILE}
COMMAND ${CMAKE_COMMAND} -E touch ${GENERATED_ASSETS_DIR}/.stamp
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/assets
DEPENDS asset_generator

View File

@ -1,6 +1,8 @@
#include "mxdsaction.h"
#include <file.h>
#include <filesystem>
#include <fstream>
#include <interleaf.h>
#include <object.h>
@ -9,11 +11,13 @@ uint32_t bufferSize = 65536;
uint32_t bufferCount = 8;
std::string out;
std::ofstream depfile;
si::MemoryBuffer mxHd;
void CreateWidescreen()
{
si::Interleaf si;
std::string file = out + "/widescreen.si";
mxHd.seek(0, si::MemoryBuffer::SeekStart);
si.Read(&mxHd);
@ -33,13 +37,15 @@ void CreateWidescreen()
GaraDoor_Wide.up_.y = 1.0;
GaraDoor_Wide.ReplaceWithFile("widescreen/garadoor.bmp");
si.AppendChild(&GaraDoor_Wide);
depfile << file << ": " << (std::filesystem::current_path() / "widescreen/garadoor.bmp").string() << std::endl;
si.Write((out + "/widescreen.si").c_str());
si.Write(file.c_str());
}
int main(int argc, char* argv[])
{
out = argv[1];
depfile = std::ofstream(argv[2]);
mxHd.WriteU32(si::RIFF::MxHd);
mxHd.WriteU32(3 * sizeof(uint32_t));