@@ -7,42 +7,12 @@ file(GLOB MODULE_SOURCES *.c)
7
7
# Find all .exp files in the directory
8
8
file (GLOB EXP_FILES *.exp)
9
9
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
+ )
36
15
37
16
# Set output name to "pspme.prx"
38
17
set_target_properties (pspme_prx PROPERTIES OUTPUT_NAME "pspme" )
39
18
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