mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 08:47:34 +00:00
LibGfx/TIFF: Introduce a code generator
This will allow us to generate code that handle and provide easy access to metadata stored in TIFF's tags. The generator is a Python script, and it output both TIFFMetadata.h and TIFFTagHandler.cpp files. The generator will definitely need some update to support all TIFF and EXIF tags, but that will still be easier than writing everything ourselves. Some small modifications are needed in TIFFLoader.cpp to make it compatible with the new `Metadata` class.
This commit is contained in:
parent
8c65cc185a
commit
9836a9ad0e
5 changed files with 372 additions and 251 deletions
|
@ -36,7 +36,6 @@ set(SOURCES
|
|||
ImageFormats/BMPWriter.cpp
|
||||
ImageFormats/BooleanDecoder.cpp
|
||||
ImageFormats/TIFFLoader.cpp
|
||||
ImageFormats/TIFFTagHandler.cpp
|
||||
ImageFormats/DDSLoader.cpp
|
||||
ImageFormats/GIFLoader.cpp
|
||||
ImageFormats/ICOLoader.cpp
|
||||
|
@ -79,3 +78,22 @@ set(SOURCES
|
|||
|
||||
serenity_lib(LibGfx gfx)
|
||||
target_link_libraries(LibGfx PRIVATE LibCompress LibCore LibCrypto LibFileSystem LibTextCodec LibIPC LibUnicode)
|
||||
|
||||
set(generated_sources TIFFMetadata.h TIFFTagHandler.cpp)
|
||||
list(TRANSFORM generated_sources PREPEND "ImageFormats/")
|
||||
|
||||
find_package(Python COMPONENTS Interpreter REQUIRED)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${generated_sources}
|
||||
COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/TIFFGenerator.py" -o "${CMAKE_CURRENT_BINARY_DIR}/ImageFormats"
|
||||
DEPENDS "TIFFGenerator.py"
|
||||
VERBATIM
|
||||
)
|
||||
target_sources(LibGfx PRIVATE ${generated_sources})
|
||||
add_custom_target(generate_tiff_files_handler DEPENDS ${generated_sources})
|
||||
add_dependencies(all_generated generate_tiff_files_handler)
|
||||
add_dependencies(LibGfx generate_tiff_files_handler)
|
||||
|
||||
list(TRANSFORM generated_sources PREPEND "${CMAKE_CURRENT_BINARY_DIR}/")
|
||||
install(FILES ${generated_sources} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/LibGfx/ImageFormats")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue