From 64ea2da25899af25d9e114eec79713547084b85a Mon Sep 17 00:00:00 2001 From: Wouter Wijsman Date: Thu, 31 Oct 2024 10:39:39 +0100 Subject: [PATCH 1/2] Add support for setting the output directory to create_pbp_file macro --- src/base/CreatePBP.cmake | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/base/CreatePBP.cmake b/src/base/CreatePBP.cmake index f6a5e463..9191fc04 100644 --- a/src/base/CreatePBP.cmake +++ b/src/base/CreatePBP.cmake @@ -18,6 +18,7 @@ macro(create_pbp_file) PREVIEW_PATH # optional, absolute path to .png file, 480x272 MUSIC_PATH # optional, absolute path to .at3 file VERSION # optional, adds version information to PARAM.SFO + OUTPUT_DIR # optional, set the output directory for the EBOOT.PBP ) set(options BUILD_PRX # optional, generates and uses PRX file instead of ELF in EBOOT.PBP @@ -30,6 +31,20 @@ macro(create_pbp_file) set(ARG_VERSION "") endif() + # set output directory to where the target is build if not set + if (NOT DEFINED ARG_OUTPUT_DIR) + set(ARG_OUTPUT_DIR $) + endif() + + # Make sure the output directory exists + if(NOT IS_DIRECTORY ${ARG_OUTPUT_DIR}) + add_custom_command( + TARGET ${APP} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory + ${ARG_OUTPUT_DIR} + ) + endif() + # As pack-pbp takes undefined arguments in form of "NULL" string, # set each undefined macro variable to such value: foreach(arg ${oneValueArgs}) @@ -146,6 +161,13 @@ macro(create_pbp_file) ) endif() + add_custom_command( + TARGET ${APP} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove + ${ARG_OUTPUT_DIR}/PARAM.SFO + COMMENT "Cleaning up PARAM.SFO for target ${ARG_TARGET}" + ) + add_custom_command( TARGET ${ARG_TARGET} POST_BUILD COMMAND From 6544b80356a2e8f31cf21ac9448437d135d34032 Mon Sep 17 00:00:00 2001 From: Wouter Wijsman Date: Thu, 31 Oct 2024 10:57:00 +0100 Subject: [PATCH 2/2] Only create output directory if it was set --- src/base/CreatePBP.cmake | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/base/CreatePBP.cmake b/src/base/CreatePBP.cmake index 9191fc04..22be0e69 100644 --- a/src/base/CreatePBP.cmake +++ b/src/base/CreatePBP.cmake @@ -34,15 +34,15 @@ macro(create_pbp_file) # set output directory to where the target is build if not set if (NOT DEFINED ARG_OUTPUT_DIR) set(ARG_OUTPUT_DIR $) - endif() - - # Make sure the output directory exists - if(NOT IS_DIRECTORY ${ARG_OUTPUT_DIR}) - add_custom_command( - TARGET ${APP} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory - ${ARG_OUTPUT_DIR} - ) + else() + # Make sure the output directory exists + if(NOT IS_DIRECTORY ${ARG_OUTPUT_DIR}) + add_custom_command( + TARGET ${APP} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory + ${ARG_OUTPUT_DIR} + ) + endif() endif() # As pack-pbp takes undefined arguments in form of "NULL" string,