2022-07-30 12:24:03 -04:00
|
|
|
if (NOT DEFINED GEODE_CLI)
|
|
|
|
find_program(GEODE_CLI NAMES geode.exe geode-cli.exe geode geode-cli)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (GEODE_CLI STREQUAL "GEODE_CLI-NOTFOUND")
|
|
|
|
message(STATUS "Unable to find Geode CLI")
|
|
|
|
else()
|
|
|
|
message(STATUS "Found Geode CLI: ${GEODE_CLI}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
function(create_geode_file proname)
|
2022-09-01 02:35:18 -04:00
|
|
|
message(
|
|
|
|
DEPRECATION
|
|
|
|
"create_geode_file has been deprecated, and will
|
|
|
|
be replaced by create_geode_file_v2 in the future.
|
|
|
|
Do note that create_geode_file_v2 will be *renamed*
|
|
|
|
to create_geode_file"
|
|
|
|
)
|
|
|
|
|
2022-07-30 12:24:03 -04:00
|
|
|
message(STATUS "Creating geode file")
|
|
|
|
|
2022-09-01 05:46:37 -04:00
|
|
|
if(GEODE_CLI STREQUAL "GEODE_CLI-NOTFOUND")
|
|
|
|
message(WARNING "create_geode_file called, but Geode CLI was not found - You will need to manually package the .geode files")
|
|
|
|
else()
|
|
|
|
|
|
|
|
add_custom_target(${proname}_PACKAGE ALL
|
|
|
|
DEPENDS ${proname}
|
|
|
|
COMMAND ${GEODE_CLI} pkg ${CMAKE_CURRENT_SOURCE_DIR} $<TARGET_FILE_DIR:${proname}> $<TARGET_FILE_DIR:${proname}>/${proname}.geode --install --cached
|
|
|
|
VERBATIM USES_TERMINAL
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(create_geode_file_v2 proname)
|
|
|
|
message(STATUS "Creating geode file")
|
|
|
|
|
2022-08-31 13:15:56 -04:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mod.json ${CMAKE_CURRENT_BINARY_DIR}/what.txt)
|
|
|
|
set_target_properties(${proname} PROPERTIES CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/mod.json)
|
|
|
|
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${GEODE_CLI} package get-id ${CMAKE_CURRENT_SOURCE_DIR} --raw
|
|
|
|
OUTPUT_VARIABLE MOD_ID
|
|
|
|
)
|
|
|
|
|
|
|
|
set_target_properties(${proname} PROPERTIES PREFIX "")
|
|
|
|
set_target_properties(${proname} PROPERTIES OUTPUT_NAME ${MOD_ID})
|
|
|
|
|
2022-07-30 12:24:03 -04:00
|
|
|
if(GEODE_CLI STREQUAL "GEODE_CLI-NOTFOUND")
|
|
|
|
message(WARNING "create_geode_file called, but Geode CLI was not found - You will need to manually package the .geode files")
|
|
|
|
else()
|
|
|
|
add_custom_target(${proname}_PACKAGE ALL
|
2022-08-31 13:15:56 -04:00
|
|
|
DEPENDS ${proname} ${CMAKE_CURRENT_SOURCE_DIR}/mod.json
|
|
|
|
COMMAND ${GEODE_CLI} package new ${CMAKE_CURRENT_SOURCE_DIR} --binary $<TARGET_FILE:${proname}> --output $<TARGET_FILE_DIR:${proname}>/${proname}.geode --install
|
2022-07-30 12:24:03 -04:00
|
|
|
VERBATIM USES_TERMINAL
|
|
|
|
)
|
|
|
|
endif()
|
2022-09-01 02:35:18 -04:00
|
|
|
endfunction()
|
|
|
|
|
2022-08-01 11:18:03 -04:00
|
|
|
function(package_geode_resources proname src dest prefix)
|
|
|
|
message(STATUS "Packaging resources from ${src} with prefix ${prefix} into ${dest}")
|
|
|
|
|
|
|
|
if(GEODE_CLI STREQUAL "GEODE_CLI-NOTFOUND")
|
|
|
|
message(WARNING "package_geode_resources called, but Geode CLI was not found - You will need to manually package the resources")
|
|
|
|
else()
|
|
|
|
|
|
|
|
add_custom_target(${proname}_PACKAGE ALL
|
|
|
|
DEPENDS ${proname}
|
|
|
|
COMMAND ${GEODE_CLI} resources ${src} ${dest} --prefix ${prefix} --cached
|
|
|
|
VERBATIM USES_TERMINAL
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endfunction()
|