aboutsummaryrefslogtreecommitdiff
path: root/examples/demos
diff options
context:
space:
mode:
authorspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2022-02-20 20:55:27 +0100
committerspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2022-02-20 23:10:19 +0100
commita2da2debfde1d44338d203aa4d56e485c4bb16ae (patch)
treebcce13d2c63acfe4d9b1d72c1887130b29bb098f /examples/demos
parent72db767f5a5bdb958bb11bcb6fe6b9b332a2b195 (diff)
downloadpsn00bsdk-a2da2debfde1d44338d203aa4d56e485c4bb16ae.tar.gz
Add psn00bsdk_target_incbin() CMake function
Diffstat (limited to 'examples/demos')
-rw-r--r--examples/demos/n00bdemo/CMakeLists.txt28
-rw-r--r--examples/demos/n00bdemo/data.s.template37
-rw-r--r--examples/demos/n00bdemo/data.xml (renamed from examples/demos/n00bdemo/data.xml.template)0
3 files changed, 11 insertions, 54 deletions
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.template b/examples/demos/n00bdemo/data.xml
index 057d6a6..057d6a6 100644
--- a/examples/demos/n00bdemo/data.xml.template
+++ b/examples/demos/n00bdemo/data.xml