Skip to content

Commit

Permalink
Don't ignore 7z_command.cmake
Browse files Browse the repository at this point in the history
It probably should be in cmake/ instead of dist/ but this will do for now
  • Loading branch information
sirjuddington committed May 2, 2024
1 parent 0858041 commit 1bc39db
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
!/dist/res
!/dist/CMakeLists.txt
!/dist/makebuild.ps1
!/dist/7z_command.cmake

/msvc/*
!/msvc/resource.h
Expand Down
26 changes: 26 additions & 0 deletions dist/7z_command.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
set(7ZIP_COMMAND "${ZIPTOOL_7Z_EXECUTABLE}" a -tzip -mtc- -mcu+ -mx=9 -r "${PK3_DESTINATION}/slade.pk3" .)

if(EXISTS "${PK3_DESTINATION}/slade.pk3")
if(WIN32)
set(PLATFORM_GREP_COMMAND findstr "/c:SHA256 for data and names:")
else()
set(PLATFORM_GREP_COMMAND grep "SHA256 for data and names:")
endif()
execute_process(COMMAND "${ZIPTOOL_7Z_EXECUTABLE}" h -scrcsha256 .
COMMAND ${PLATFORM_GREP_COMMAND}
OUTPUT_VARIABLE FOLDER_SHA256
)
execute_process(COMMAND "${ZIPTOOL_7Z_EXECUTABLE}" t -scrcsha256 "${PK3_DESTINATION}/slade.pk3"
COMMAND ${PLATFORM_GREP_COMMAND}
OUTPUT_VARIABLE PK3_SHA256
)
if(FOLDER_SHA256 STREQUAL PK3_SHA256)
message(STATUS "slade.pk3 is already up to date.")
else()
file(REMOVE "${PK3_DESTINATION}/slade.pk3")
message(STATUS "Regenerating slade.pk3...")
execute_process(COMMAND ${7ZIP_COMMAND})
endif()
else()
execute_process(COMMAND ${7ZIP_COMMAND})
endif()

0 comments on commit 1bc39db

Please sign in to comment.