mirror of
https://github.com/diasurgical/DevilutionX.git
synced 2026-10-12 02:13:06 +00:00
mods/hellfire.mpq build = with devilutionx.mpq
This commit is contained in:
+40
-27
@@ -1,3 +1,6 @@
|
||||
include(functions/copy_files)
|
||||
include(functions/trim_retired_files)
|
||||
|
||||
if(NOT DEFINED DEVILUTIONX_MODS_OUTPUT_DIRECTORY)
|
||||
set(DEVILUTIONX_MODS_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mods")
|
||||
endif()
|
||||
@@ -30,32 +33,42 @@ if(NOT UNPACKED_MPQS)
|
||||
data/inv/objcurs2-widths.txt)
|
||||
endif()
|
||||
|
||||
foreach(asset_file ${hellfire_mod})
|
||||
set(src "${CMAKE_CURRENT_SOURCE_DIR}/mods/Hellfire/${asset_file}")
|
||||
set(dst "${DEVILUTIONX_MODS_OUTPUT_DIRECTORY}/Hellfire/${asset_file}")
|
||||
list(APPEND HELLFIRE_MPQ_FILES "${asset_file}")
|
||||
list(APPEND HELLFIRE_OUTPUT_FILES "${dst}")
|
||||
add_custom_command(
|
||||
COMMENT "Copying ${asset_file}"
|
||||
OUTPUT "${dst}"
|
||||
DEPENDS "${src}"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${src}" "${dst}"
|
||||
VERBATIM)
|
||||
endforeach()
|
||||
|
||||
if(BUILD_ASSETS_MPQ)
|
||||
set(HELLFIRE_MPQ "${DEVILUTIONX_MODS_OUTPUT_DIRECTORY}/Hellfire.mpq")
|
||||
add_custom_command(
|
||||
COMMENT "Building Hellfire.mpq"
|
||||
OUTPUT "${HELLFIRE_MPQ}"
|
||||
COMMAND ${CMAKE_COMMAND} -E remove -f "${HELLFIRE_MPQ}"
|
||||
COMMAND ${SMPQ} -A -M 1 -C BZIP2 -c "${HELLFIRE_MPQ}" ${HELLFIRE_MPQ_FILES}
|
||||
WORKING_DIRECTORY "${DEVILUTIONX_MODS_OUTPUT_DIRECTORY}/Hellfire"
|
||||
DEPENDS ${HELLFIRE_OUTPUT_FILES}
|
||||
VERBATIM)
|
||||
add_custom_target(hellfire_mpq DEPENDS "${HELLFIRE_MPQ}")
|
||||
add_dependencies(libdevilutionx hellfire_mpq)
|
||||
if(APPLE)
|
||||
foreach(asset_file ${hellfire_mod})
|
||||
set(src "${CMAKE_CURRENT_SOURCE_DIR}/mods/Hellfire/${asset_file}")
|
||||
get_filename_component(_asset_dir "${asset_file}" DIRECTORY)
|
||||
set_source_files_properties("${src}" PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION "Resources/mods/Hellfire/${_asset_dir}"
|
||||
XCODE_EXPLICIT_FILE_TYPE compiled)
|
||||
target_sources(${BIN_TARGET} PRIVATE "${src}")
|
||||
endforeach()
|
||||
else()
|
||||
add_custom_target(hellfire_copied_mod_file DEPENDS ${HELLFIRE_OUTPUT_FILES})
|
||||
add_dependencies(libdevilutionx hellfire_copied_mod_file)
|
||||
copy_files(
|
||||
FILES ${hellfire_mod}
|
||||
SRC_PREFIX "mods/Hellfire/"
|
||||
OUTPUT_DIR "${DEVILUTIONX_MODS_OUTPUT_DIRECTORY}/Hellfire"
|
||||
OUTPUT_VARIABLE HELLFIRE_OUTPUT_FILES)
|
||||
set(HELLFIRE_MPQ_FILES ${hellfire_mod})
|
||||
add_trim_target(hellfire_trim_assets
|
||||
ROOT_FOLDER "${DEVILUTIONX_MODS_OUTPUT_DIRECTORY}/Hellfire"
|
||||
CURRENT_FILES ${HELLFIRE_MPQ_FILES})
|
||||
|
||||
if(BUILD_ASSETS_MPQ)
|
||||
set(HELLFIRE_MPQ "${DEVILUTIONX_MODS_OUTPUT_DIRECTORY}/Hellfire.mpq")
|
||||
add_custom_command(
|
||||
COMMENT "Building Hellfire.mpq"
|
||||
OUTPUT "${HELLFIRE_MPQ}"
|
||||
COMMAND ${CMAKE_COMMAND} -E remove -f "${HELLFIRE_MPQ}"
|
||||
COMMAND ${SMPQ} -A -M 1 -C BZIP2 -c "${HELLFIRE_MPQ}" ${HELLFIRE_MPQ_FILES}
|
||||
WORKING_DIRECTORY "${DEVILUTIONX_MODS_OUTPUT_DIRECTORY}/Hellfire"
|
||||
DEPENDS ${TRIM_COMMAND_BYPRODUCT} ${HELLFIRE_OUTPUT_FILES}
|
||||
VERBATIM)
|
||||
add_custom_target(hellfire_mpq DEPENDS "${HELLFIRE_MPQ}")
|
||||
add_dependencies(hellfire_mpq hellfire_trim_assets)
|
||||
add_dependencies(libdevilutionx hellfire_mpq)
|
||||
else()
|
||||
add_custom_target(hellfire_copied_assets DEPENDS ${HELLFIRE_OUTPUT_FILES})
|
||||
add_dependencies(hellfire_copied_assets hellfire_trim_assets)
|
||||
add_dependencies(libdevilutionx hellfire_copied_assets)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
+13
-2
@@ -181,7 +181,7 @@ else()
|
||||
set(SUPPORTS_MPQ ON)
|
||||
endif()
|
||||
|
||||
# By default, devilutionx.mpq is built only if smpq is installed and MPQ support is enabled.
|
||||
# By default, devilutionx.mpq and mods/Hellfire.mpq are built only if smpq is installed and MPQ support is enabled.
|
||||
if(SUPPORTS_MPQ AND NOT UNPACKED_MPQS)
|
||||
if(BUILD_ASSETS_MPQ OR (CPACK STREQUAL "ON" AND (WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux")))
|
||||
find_program(SMPQ smpq REQUIRED)
|
||||
@@ -193,7 +193,7 @@ if(SUPPORTS_MPQ AND NOT UNPACKED_MPQS)
|
||||
else()
|
||||
set(_has_smpq OFF)
|
||||
endif()
|
||||
option(BUILD_ASSETS_MPQ "If true, assets are packaged into devilutionx.mpq." ${_has_smpq})
|
||||
option(BUILD_ASSETS_MPQ "If true, assets are packaged into devilutionx.mpq and mods/Hellfire to Hellfire.mpq." ${_has_smpq})
|
||||
else()
|
||||
set(BUILD_ASSETS_MPQS OFF)
|
||||
endif()
|
||||
@@ -488,6 +488,7 @@ if(VITA)
|
||||
NAME ${VITA_APP_NAME}
|
||||
FILE Packaging/vita/sce_sys sce_sys
|
||||
FILE ${DEVILUTIONX_MPQ} devilutionx.mpq
|
||||
FILE ${HELLFIRE_MPQ} mods/Hellfire.mpq
|
||||
)
|
||||
else()
|
||||
vita_create_vpk(devilutionx.vpk ${VITA_TITLEID} devilutionx.self
|
||||
@@ -505,6 +506,10 @@ if(PS4)
|
||||
add_custom_command(
|
||||
TARGET devilutionx_mpq POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${DEVILUTIONX_MPQ} "${PROJECT_SOURCE_DIR}/Packaging/ps4/")
|
||||
add_custom_command(
|
||||
TARGET hellfire_mpq POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${PROJECT_SOURCE_DIR}/Packaging/ps4/mods"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${HELLFIRE_MPQ} "${PROJECT_SOURCE_DIR}/Packaging/ps4/mods/")
|
||||
add_self(${BIN_TARGET})
|
||||
add_pkg(${BIN_TARGET} "${PROJECT_SOURCE_DIR}/Packaging/ps4"
|
||||
"DVLX00001" "DevilutionX" "${PROJECT_VERSION}")
|
||||
@@ -593,6 +598,9 @@ if(CPACK AND (APPLE OR BUILD_ASSETS_MPQ OR SRC_DIST))
|
||||
install(FILES "${DEVILUTIONX_MPQ}"
|
||||
DESTINATION "."
|
||||
)
|
||||
install(FILES "${HELLFIRE_MPQ}"
|
||||
DESTINATION "mods"
|
||||
)
|
||||
|
||||
foreach(_SDL2_WIN32_DLL_PATH ${SDL2_WIN32_ALL_DLLS} ${WIN32_INSTALL_DLLS})
|
||||
install(FILES "${_SDL2_WIN32_DLL_PATH}"
|
||||
@@ -648,6 +656,9 @@ if(CPACK AND (APPLE OR BUILD_ASSETS_MPQ OR SRC_DIST))
|
||||
install(FILES "${DEVILUTIONX_MPQ}"
|
||||
DESTINATION "share/diasurgical/${project_name}"
|
||||
)
|
||||
install(FILES "${HELLFIRE_MPQ}"
|
||||
DESTINATION "share/diasurgical/${project_name}/mods"
|
||||
)
|
||||
install(FILES "${PROJECT_SOURCE_DIR}/Packaging/resources/icon_flat.png"
|
||||
DESTINATION "share/icons/hicolor/512x512/apps"
|
||||
RENAME "${project_name}.png"
|
||||
|
||||
@@ -97,6 +97,7 @@ def main():
|
||||
configure_args.append('-DDISCORD_INTEGRATION=ON')
|
||||
cmake(*configure_args)
|
||||
cmake('--build', _BUILD_DIR, '--target', 'devilutionx_mpq')
|
||||
cmake('--build', _BUILD_DIR, '--target', 'hellfire_mpq')
|
||||
|
||||
if _ARCHIVE_DIR.exists():
|
||||
shutil.rmtree(_ARCHIVE_DIR)
|
||||
@@ -116,6 +117,9 @@ def main():
|
||||
_LOGGER.info(f'Copying devilutionx.mpq...')
|
||||
paths.dist_dir.mkdir(parents=True)
|
||||
shutil.copy(_BUILD_DIR.joinpath('devilutionx.mpq'), paths.dist_dir)
|
||||
_LOGGER.info(f'Copying Hellfire.mpq...')
|
||||
paths.dist_dir.joinpath('mods').mkdir(exist_ok=True)
|
||||
shutil.copy(_BUILD_DIR.joinpath('mods', 'Hellfire.mpq'), paths.dist_dir.joinpath('mods'))
|
||||
|
||||
for dep in _DEPS + (_DEPS_NOT_VENDORED_BY_DEFAULT if args.fully_vendored else []):
|
||||
_LOGGER.info(f'Copying {dep}...')
|
||||
@@ -183,8 +187,9 @@ def write_dist_cmakelists(paths: Paths, version: Version, fully_vendored: bool):
|
||||
f.write(b'set(GIT_COMMIT_HASH "%s" PARENT_SCOPE)\n' % version.commit_sha.encode('utf-8'))
|
||||
|
||||
f.write(b'''
|
||||
# Pre-generated `devilutionx.mpq` is provided so that distributions do not have to depend on smpq.
|
||||
# Pre-generated `devilutionx.mpq` and `mods/Hellfire.mpq` are provided so that distributions do not have to depend on smpq.
|
||||
set(DEVILUTIONX_MPQ "${CMAKE_CURRENT_SOURCE_DIR}/devilutionx.mpq" PARENT_SCOPE)
|
||||
set(HELLFIRE_MPQ "${CMAKE_CURRENT_SOURCE_DIR}/mods/Hellfire.mpq" PARENT_SCOPE)
|
||||
|
||||
# This would ensure that CMake does not attempt to connect to network.
|
||||
# We do not set this to allow for builds for Windows and Android, which do fetch some
|
||||
|
||||
Reference in New Issue
Block a user