mirror of
https://git.planet-casio.com/Lephenixnoir/fxsdk.git
synced 2024-12-28 04:23:37 +01:00
fxsdk: handle parentheses in paths for fxgxa
Quotes are still impossible because CMake is unredeemable in that regard.
This commit is contained in:
parent
8c966821e8
commit
e31d053a08
3 changed files with 18 additions and 7 deletions
7
fxsdk/cmake/FxsdkUtils.cmake
Normal file
7
fxsdk/cmake/FxsdkUtils.cmake
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Who doesn't love to deal with escaping?!
|
||||
function(shell_escape _str _out)
|
||||
string(REPLACE "'" "\\'" _str "${_str}")
|
||||
string(REPLACE "(" "\\(" _str "${_str}")
|
||||
string(REPLACE ")" "\\)" _str "${_str}")
|
||||
set("${_out}" "${_str}" PARENT_SCOPE)
|
||||
endfunction()
|
|
@ -1,3 +1,5 @@
|
|||
include(FxsdkUtils)
|
||||
|
||||
function(generate_g1a)
|
||||
cmake_parse_arguments(G1A "" "TARGET;OUTPUT;NAME;INTERNAL;VERSION;DATE;ICON" "" ${ARGN})
|
||||
|
||||
|
@ -16,6 +18,7 @@ function(generate_g1a)
|
|||
if(DEFINED G1A_OUTPUT)
|
||||
get_filename_component(G1A_OUTPUT "${G1A_OUTPUT}" ABSOLUTE
|
||||
BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
shell_escape("${G1A_OUTPUT}" G1A_OUTPUT)
|
||||
else()
|
||||
set(G1A_OUTPUT "${G1A_TARGET}.g1a")
|
||||
endif()
|
||||
|
@ -32,7 +35,8 @@ function(generate_g1a)
|
|||
if(DEFINED G1A_ICON)
|
||||
get_filename_component(G1A_ICON "${G1A_ICON}" ABSOLUTE
|
||||
BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
list(APPEND FXGXA_ARGS "-i" "${G1A_ICON}")
|
||||
shell_escape("${G1A_ICON}" G1A_ICONB)
|
||||
list(APPEND FXGXA_ARGS "-i" "${G1A_ICONB}")
|
||||
endif()
|
||||
|
||||
if(DEFINED G1A_INTERNAL)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
include(FxsdkUtils)
|
||||
|
||||
function(generate_g3a)
|
||||
cmake_parse_arguments(G3A "" "TARGET;OUTPUT;NAME;VERSION" "ICONS" ${ARGN})
|
||||
|
||||
|
@ -21,8 +23,7 @@ function(generate_g3a)
|
|||
if(DEFINED G3A_OUTPUT)
|
||||
get_filename_component(G3A_OUTPUT "${G3A_OUTPUT}" ABSOLUTE
|
||||
BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
# Who doesn't love to deal with escaping
|
||||
string(REPLACE "'" "\\'" G3A_OUTPUT "${G3A_OUTPUT}")
|
||||
shell_escape("${G3A_OUTPUT}" G3A_OUTPUT)
|
||||
else()
|
||||
set(G3A_OUTPUT "${G3A_TARGET}.g3a")
|
||||
endif()
|
||||
|
@ -52,9 +53,8 @@ function(generate_g3a)
|
|||
BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
get_filename_component(G3A_ICON2 "${G3A_ICON2}" ABSOLUTE
|
||||
BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
# Who doesn't REALLY love to deal with escaping
|
||||
string(REPLACE "'" "\\'" G3A_ICON1B "${G3A_ICON1}")
|
||||
string(REPLACE "'" "\\'" G3A_ICON2B "${G3A_ICON2}")
|
||||
shell_escape("${G3A_ICON1}" G3A_ICON1B)
|
||||
shell_escape("${G3A_ICON2}" G3A_ICON2B)
|
||||
list(APPEND FXGXA_ARGS "--icon-uns=${G3A_ICON1B}" "--icon-sel=${G3A_ICON2B}")
|
||||
endif()
|
||||
|
||||
|
@ -63,7 +63,7 @@ function(generate_g3a)
|
|||
add_custom_command(
|
||||
TARGET "${G3A_TARGET}" POST_BUILD
|
||||
COMMAND ${OBJCOPY} -O binary -R .bss -R .gint_bss ${G3A_TARGET} ${G3A_TARGET}.bin
|
||||
COMMAND fxgxa --g3a ${FXGXA_ARGS} "${G3A_TARGET}.bin" -o "${G3A_OUTPUT}"
|
||||
COMMAND fxgxa --g3a ${FXGXA_ARGS} ${G3A_TARGET}.bin -o ${G3A_OUTPUT}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
)
|
||||
if(DEFINED G3A_ICONS)
|
||||
|
|
Loading…
Reference in a new issue