Skip to content

Commit f0cbd96

Browse files
committed
Use add_prx_module macro
1 parent 215becc commit f0cbd96

File tree

1 file changed

+5
-35
lines changed

1 file changed

+5
-35
lines changed

src/module/CMakeLists.txt

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,12 @@ file(GLOB MODULE_SOURCES *.c)
77
# Find all .exp files in the directory
88
file(GLOB EXP_FILES *.exp)
99

10-
# Initialize a list to store generated .c files
11-
set(GENERATED_C_FILES)
12-
13-
# Loop over each .exp file to set up a rule to generate a corresponding .c file
14-
foreach(EXP_FILE ${EXP_FILES})
15-
# Get the filename without extension
16-
get_filename_component(EXP_FILE_NAME ${EXP_FILE} NAME_WE)
17-
18-
# Define the output .c file path
19-
set(GENERATED_C_FILE ${CMAKE_BINARY_DIR}/${EXP_FILE_NAME}.c)
20-
21-
# Add a custom command for each .exp file to generate a .c file
22-
add_custom_command(
23-
OUTPUT ${GENERATED_C_FILE}
24-
COMMAND psp-build-exports -b ${EXP_FILE} > ${GENERATED_C_FILE}
25-
DEPENDS ${EXP_FILE}
26-
COMMENT "Generating ${GENERATED_C_FILE} from ${EXP_FILE}"
27-
)
28-
29-
# Add the generated .c file to the list
30-
list(APPEND GENERATED_C_FILES ${GENERATED_C_FILE})
31-
endforeach()
32-
33-
# Define the PRX target
34-
add_executable(pspme_prx ${MODULE_SOURCES} ${GENERATED_C_FILES})
35-
target_link_options(pspme_prx PRIVATE -Wl,-q,-T${PSPDEV}/psp/sdk/lib/linkfile.prx -nostartfiles -Wl,-zmax-page-size=128)
10+
add_prx_module(
11+
TARGET pspme_prx
12+
SRC_FILES ${MODULE_SOURCES}
13+
EXP_FILES ${EXP_FILES}
14+
)
3615

3716
# Set output name to "pspme.prx"
3817
set_target_properties(pspme_prx PROPERTIES OUTPUT_NAME "pspme")
3918
target_include_directories(pspme_prx PUBLIC ${CMAKE_SOURCE_DIR}/include)
40-
41-
# Add a post-build command to run psp-fixup-imports on the generated ELF file
42-
add_custom_command(
43-
TARGET pspme_prx
44-
POST_BUILD
45-
COMMAND psp-fixup-imports $<TARGET_FILE:pspme_prx>
46-
COMMAND psp-prxgen $<TARGET_FILE:pspme_prx> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<TARGET_FILE_NAME:pspme_prx>.prx
47-
COMMENT "Running psp-fixup-imports and psp-prxgen on $<TARGET_FILE_NAME:pspme_prx>"
48-
)

0 commit comments

Comments
 (0)