port: build: move to CMake

god forgive me
This commit is contained in:
fgsfds committed 2024-11-12 22:08:18 +01:00
1 parent 91c43385dd
commit 0bdf79cc51
11 files changed
+693 -1175

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
# execute a header generator (execcmd) for every json file in jsonpath, collect headers in headerlist
# note that this reads ROMID
macro(generate_asset_headers jsonpath execcmd extraarg headerlist)
set(TMP_JSON "")
if (${jsonpath} MATCHES "\.json")
# is a json file
list(APPEND TMP_JSON "${CMAKE_SOURCE_DIR}/${ASSET_DIR}/${jsonpath}")
else()
# is a directory
file(GLOB TMP_JSON "${CMAKE_SOURCE_DIR}/${ASSET_DIR}/${jsonpath}*.json")
endif()
foreach(JSON ${TMP_JSON})
unset(HEADERNAME)
string(REPLACE ".json" ".h" HEADERNAME ${JSON})
string(REPLACE "${CMAKE_SOURCE_DIR}/${ASSET_DIR}" "${CMAKE_BINARY_DIR}/${GENERATED_DIR}" HEADERNAME ${HEADERNAME})
add_custom_command(
OUTPUT ${HEADERNAME}
DEPENDS ${JSON}
COMMAND ${execcmd} ${JSON} ${extraarg} --headers-only --romid=${ROMID}
)
list(APPEND ${headerlist} "${HEADERNAME}")
endforeach()
unset(TMP_JSON)
endmacro()