mirror of
https://git.planet-casio.com/Lephenixnoir/fxsdk.git
synced 2024-12-29 13:03: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)
|
function(generate_g1a)
|
||||||
cmake_parse_arguments(G1A "" "TARGET;OUTPUT;NAME;INTERNAL;VERSION;DATE;ICON" "" ${ARGN})
|
cmake_parse_arguments(G1A "" "TARGET;OUTPUT;NAME;INTERNAL;VERSION;DATE;ICON" "" ${ARGN})
|
||||||
|
|
||||||
|
@ -16,6 +18,7 @@ function(generate_g1a)
|
||||||
if(DEFINED G1A_OUTPUT)
|
if(DEFINED G1A_OUTPUT)
|
||||||
get_filename_component(G1A_OUTPUT "${G1A_OUTPUT}" ABSOLUTE
|
get_filename_component(G1A_OUTPUT "${G1A_OUTPUT}" ABSOLUTE
|
||||||
BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
shell_escape("${G1A_OUTPUT}" G1A_OUTPUT)
|
||||||
else()
|
else()
|
||||||
set(G1A_OUTPUT "${G1A_TARGET}.g1a")
|
set(G1A_OUTPUT "${G1A_TARGET}.g1a")
|
||||||
endif()
|
endif()
|
||||||
|
@ -32,7 +35,8 @@ function(generate_g1a)
|
||||||
if(DEFINED G1A_ICON)
|
if(DEFINED G1A_ICON)
|
||||||
get_filename_component(G1A_ICON "${G1A_ICON}" ABSOLUTE
|
get_filename_component(G1A_ICON "${G1A_ICON}" ABSOLUTE
|
||||||
BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
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()
|
endif()
|
||||||
|
|
||||||
if(DEFINED G1A_INTERNAL)
|
if(DEFINED G1A_INTERNAL)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
include(FxsdkUtils)
|
||||||
|
|
||||||
function(generate_g3a)
|
function(generate_g3a)
|
||||||
cmake_parse_arguments(G3A "" "TARGET;OUTPUT;NAME;VERSION" "ICONS" ${ARGN})
|
cmake_parse_arguments(G3A "" "TARGET;OUTPUT;NAME;VERSION" "ICONS" ${ARGN})
|
||||||
|
|
||||||
|
@ -21,8 +23,7 @@ function(generate_g3a)
|
||||||
if(DEFINED G3A_OUTPUT)
|
if(DEFINED G3A_OUTPUT)
|
||||||
get_filename_component(G3A_OUTPUT "${G3A_OUTPUT}" ABSOLUTE
|
get_filename_component(G3A_OUTPUT "${G3A_OUTPUT}" ABSOLUTE
|
||||||
BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
# Who doesn't love to deal with escaping
|
shell_escape("${G3A_OUTPUT}" G3A_OUTPUT)
|
||||||
string(REPLACE "'" "\\'" G3A_OUTPUT "${G3A_OUTPUT}")
|
|
||||||
else()
|
else()
|
||||||
set(G3A_OUTPUT "${G3A_TARGET}.g3a")
|
set(G3A_OUTPUT "${G3A_TARGET}.g3a")
|
||||||
endif()
|
endif()
|
||||||
|
@ -52,9 +53,8 @@ function(generate_g3a)
|
||||||
BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
get_filename_component(G3A_ICON2 "${G3A_ICON2}" ABSOLUTE
|
get_filename_component(G3A_ICON2 "${G3A_ICON2}" ABSOLUTE
|
||||||
BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
# Who doesn't REALLY love to deal with escaping
|
shell_escape("${G3A_ICON1}" G3A_ICON1B)
|
||||||
string(REPLACE "'" "\\'" G3A_ICON1B "${G3A_ICON1}")
|
shell_escape("${G3A_ICON2}" G3A_ICON2B)
|
||||||
string(REPLACE "'" "\\'" G3A_ICON2B "${G3A_ICON2}")
|
|
||||||
list(APPEND FXGXA_ARGS "--icon-uns=${G3A_ICON1B}" "--icon-sel=${G3A_ICON2B}")
|
list(APPEND FXGXA_ARGS "--icon-uns=${G3A_ICON1B}" "--icon-sel=${G3A_ICON2B}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ function(generate_g3a)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET "${G3A_TARGET}" POST_BUILD
|
TARGET "${G3A_TARGET}" POST_BUILD
|
||||||
COMMAND ${OBJCOPY} -O binary -R .bss -R .gint_bss ${G3A_TARGET} ${G3A_TARGET}.bin
|
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}"
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
)
|
)
|
||||||
if(DEFINED G3A_ICONS)
|
if(DEFINED G3A_ICONS)
|
||||||
|
|
Loading…
Reference in a new issue