aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/cmake
diff options
context:
space:
mode:
authorspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2022-02-27 19:47:47 +0100
committerspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2022-02-27 19:47:47 +0100
commitc297c02652575e2affccbba16be0176d30d5ff06 (patch)
tree6f9ae00bff86811ffbffadd7c64248cde088c0f9 /libpsn00b/cmake
parent69a364049a3958396d2d083c660591dad9ec257d (diff)
downloadpsn00bsdk-c297c02652575e2affccbba16be0176d30d5ff06.tar.gz
Add psxpress MDEC API and psn00bsdk_target_incbin_a
Diffstat (limited to 'libpsn00b/cmake')
-rw-r--r--libpsn00b/cmake/internal_setup.cmake48
1 files changed, 36 insertions, 12 deletions
diff --git a/libpsn00b/cmake/internal_setup.cmake b/libpsn00b/cmake/internal_setup.cmake
index 8fb6482..d293127 100644
--- a/libpsn00b/cmake/internal_setup.cmake
+++ b/libpsn00b/cmake/internal_setup.cmake
@@ -32,7 +32,7 @@ set(
psxgte
psxspu
psxcd
- #psxpress
+ psxpress
psxsio
psxetc
psxapi
@@ -186,7 +186,7 @@ function(psn00bsdk_add_cd_image name image_name config_file)
add_custom_target(
${name} ALL
- COMMAND ${MKPSXISO} -y -q ${CD_CONFIG_FILE}
+ COMMAND ${MKPSXISO} -y ${CD_CONFIG_FILE}
BYPRODUCTS ${image_name}.bin ${image_name}.cue
COMMENT "Building CD image ${image_name}"
${ARGN}
@@ -195,13 +195,17 @@ endfunction()
## Helper functions for assets
-# psn00bsdk_target_incbin(
+# psn00bsdk_target_incbin_a(
# <existing target name> <PRIVATE|PUBLIC|INTERFACE>
-# <symbol name>
+# <data symbol name>
+# <size symbol name>
# <path to binary file>
+# <linker section name>
+# <alignment>
# )
-function(psn00bsdk_target_incbin name type symbol_name path)
+function(psn00bsdk_target_incbin_a name type symbol_name size_name path section align)
string(MAKE_C_IDENTIFIER ${symbol_name} _id)
+ string(MAKE_C_IDENTIFIER ${size_name} _size)
cmake_path(ABSOLUTE_PATH path OUTPUT_VARIABLE _path)
# Generate an assembly source file that includes the binary file and add it
@@ -212,26 +216,27 @@ function(psn00bsdk_target_incbin name type symbol_name path)
CONFIGURE
OUTPUT ${_asm_file}
CONTENT [[
-.section .data.${_id}
-.balign 4
+.section ${section}
+.balign ${align}
.global ${_id}
.type ${_id}, @object
-${_id}:
+${_id}:
.incbin "${_path}"
.local ${_id}_end
${_id}_end:
+.balign ${align}
.balign 4
-.global ${_id}_size
-.type ${_id}_size, @object
-${_id}_size:
+.global ${_size}
+.type ${_size}, @object
+${_size}:
.int (${_id}_end - ${_id})
.size ${_id}, (${_id}_end - ${_id})
-.size ${_id}_size, 4
+.size ${_size}, 4
]]
ESCAPE_QUOTES
NEWLINE_STYLE LF
@@ -240,3 +245,22 @@ ${_id}_size:
target_sources(${name} ${type} ${_asm_file})
set_source_files_properties(${_asm_file} PROPERTIES OBJECT_DEPENDS ${_path})
endfunction()
+
+# psn00bsdk_target_incbin(
+# <existing target name> <PRIVATE|PUBLIC|INTERFACE>
+# <symbol name>
+# <path to binary file>
+# )
+function(psn00bsdk_target_incbin name type symbol_name path)
+ string(MAKE_C_IDENTIFIER ${symbol_name} _id)
+
+ psn00bsdk_target_incbin_a(
+ ${name}
+ ${type}
+ ${_id}
+ ${_id}_size
+ ${path}
+ .data.${_id}
+ 4
+ )
+endfunction()