From a2da2debfde1d44338d203aa4d56e485c4bb16ae Mon Sep 17 00:00:00 2001 From: spicyjpeg <88942473+spicyjpeg@users.noreply.github.com> Date: Sun, 20 Feb 2022 20:55:27 +0100 Subject: Add psn00bsdk_target_incbin() CMake function --- examples/demos/n00bdemo/CMakeLists.txt | 28 +++++++----------- examples/demos/n00bdemo/data.s.template | 37 ----------------------- examples/demos/n00bdemo/data.xml | 49 +++++++++++++++++++++++++++++++ examples/demos/n00bdemo/data.xml.template | 49 ------------------------------- 4 files changed, 60 insertions(+), 103 deletions(-) delete mode 100644 examples/demos/n00bdemo/data.s.template create mode 100644 examples/demos/n00bdemo/data.xml delete mode 100644 examples/demos/n00bdemo/data.xml.template (limited to 'examples/demos') diff --git a/examples/demos/n00bdemo/CMakeLists.txt b/examples/demos/n00bdemo/CMakeLists.txt index 1c211b3..a54c198 100644 --- a/examples/demos/n00bdemo/CMakeLists.txt +++ b/examples/demos/n00bdemo/CMakeLists.txt @@ -13,16 +13,14 @@ project( set(DATA_DIR ${PROJECT_SOURCE_DIR}/data) -configure_file(data.s.template data.s) -configure_file(data.xml.template data.xml) +configure_file(data.xml _data.xml) -# Add a build step to pack assets into a single .LZP file. This archive is then -# embedded into the binary through data.s, which is in turn generated from -# data.s.template. Note that, since we specify dependencies, CMake can detect -# when source assets are edited and rebuild the archive automatically. +# Add a build step to pack assets into a single .LZP file. Note that, since we +# are specifying dependencies, CMake can detect when source assets are edited +# and rebuild the archive automatically. file(GLOB _assets ${DATA_DIR}/*.tim ${DATA_DIR}/*.smd) add_custom_command( - COMMAND ${LZPACK} -y data.xml + COMMAND ${LZPACK} -y _data.xml OUTPUT data.lzp BYPRODUCTS textures.qlp DEPENDS ${_assets} @@ -30,17 +28,13 @@ add_custom_command( ) file(GLOB _sources *.s *.c) -psn00bsdk_add_executable( - n00bdemo STATIC - ${_sources} - ${PROJECT_BINARY_DIR}/data.s -) -target_include_directories(n00bdemo PRIVATE ${PROJECT_SOURCE_DIR}) +psn00bsdk_add_executable(n00bdemo STATIC ${_sources}) #psn00bsdk_add_cd_image(n00bdemo_iso n00bdemo iso.xml DEPENDS n00bdemo) -# Ensure data.lzp is built before the executable. Due to CMake's limitations we -# actually have to wrap it in a dummy target. -add_custom_target(n00bdemo_data DEPENDS data.lzp) -add_dependencies(n00bdemo n00bdemo_data) +target_include_directories(n00bdemo PRIVATE ${PROJECT_SOURCE_DIR}) +psn00bsdk_target_incbin( + n00bdemo PRIVATE _lz_resources + ${PROJECT_BINARY_DIR}/data.lzp +) install(FILES ${PROJECT_BINARY_DIR}/n00bdemo.exe TYPE BIN) diff --git a/examples/demos/n00bdemo/data.s.template b/examples/demos/n00bdemo/data.s.template deleted file mode 100644 index f659163..0000000 --- a/examples/demos/n00bdemo/data.s.template +++ /dev/null @@ -1,37 +0,0 @@ -.section .data - -.global _lz_resources -.type _lz_resources, @object -_lz_resources: - .balign 4 - .incbin "${PROJECT_BINARY_DIR}/data.lzp" - -#.global smd_mtekdisk -#.type smd_mtekdisk, @object -#smd_mtekdisk: -# .balign 4 -# .incbin "data/mtekdisk.smd" - -#.global smd_mtektext -#.type smd_mtektext, @object -#smd_mtektext: -# .balign 4 -# .incbin "data/mtektext.smd" - -#.global smd_star -#.type smd_star, @object -#smd_star: -# .balign 4 -# .incbin "data/star.smd" - -#.global smd_psn00b -#.type smd_psn00b, @object -#smd_psn00b: -# .balign 4 -# .incbin "data/psn00blogo.smd" - -#.global smd_scarletlogo -#.type smd_scarletlogo, @object -#smd_scarletlogo: -# .balign 4 -# .incbin "data/scarletlogo.smd" diff --git a/examples/demos/n00bdemo/data.xml b/examples/demos/n00bdemo/data.xml new file mode 100644 index 0000000..057d6a6 --- /dev/null +++ b/examples/demos/n00bdemo/data.xml @@ -0,0 +1,49 @@ + + + + + ${DATA_DIR}/petscum16c.tim + ${DATA_DIR}/bungirl.tim + + + ${DATA_DIR}/clktower.tim + ${DATA_DIR}/riftbld1.tim + ${DATA_DIR}/riftbld2.tim + ${DATA_DIR}/hatkid.tim + + ${DATA_DIR}/celmapi.tim + + ${DATA_DIR}/lamelotl16c.tim + ${DATA_DIR}/n00blogo-pixel.tim + ${DATA_DIR}/font.tim + + + + + + + ${DATA_DIR}/mtekdisk.smd + ${DATA_DIR}/mtektext.smd + ${DATA_DIR}/star.smd + ${DATA_DIR}/psn00blogo.smd + ${DATA_DIR}/logo.smd + + + ${DATA_DIR}/petscum.smd + ${DATA_DIR}/bulb.smd + + + ${DATA_DIR}/bungirl.smd + + ${DATA_DIR}/star_mask.smd + ${DATA_DIR}/timerift.smd + ${DATA_DIR}/rbowshade.smd + + ${DATA_DIR}/hatkid.smd + + + textures.qlp + + + + \ No newline at end of file diff --git a/examples/demos/n00bdemo/data.xml.template b/examples/demos/n00bdemo/data.xml.template deleted file mode 100644 index 057d6a6..0000000 --- a/examples/demos/n00bdemo/data.xml.template +++ /dev/null @@ -1,49 +0,0 @@ - - - - - ${DATA_DIR}/petscum16c.tim - ${DATA_DIR}/bungirl.tim - - - ${DATA_DIR}/clktower.tim - ${DATA_DIR}/riftbld1.tim - ${DATA_DIR}/riftbld2.tim - ${DATA_DIR}/hatkid.tim - - ${DATA_DIR}/celmapi.tim - - ${DATA_DIR}/lamelotl16c.tim - ${DATA_DIR}/n00blogo-pixel.tim - ${DATA_DIR}/font.tim - - - - - - - ${DATA_DIR}/mtekdisk.smd - ${DATA_DIR}/mtektext.smd - ${DATA_DIR}/star.smd - ${DATA_DIR}/psn00blogo.smd - ${DATA_DIR}/logo.smd - - - ${DATA_DIR}/petscum.smd - ${DATA_DIR}/bulb.smd - - - ${DATA_DIR}/bungirl.smd - - ${DATA_DIR}/star_mask.smd - ${DATA_DIR}/timerift.smd - ${DATA_DIR}/rbowshade.smd - - ${DATA_DIR}/hatkid.smd - - - textures.qlp - - - - \ No newline at end of file -- cgit v1.2.3