Skip to content

Commit

Permalink
build: use upx -9 for universal binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
mhx committed Jan 9, 2024
1 parent bf1a59c commit f85873a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1042,9 +1042,12 @@ if(STATIC_BUILD_DO_NOT_USE OR WIN32)
set(UNIVERSAL_PACKED
"dwarfs-universal-${PRJ_VERSION_FULL}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}${CMAKE_EXECUTABLE_SUFFIX}")

# upx -9 is a good compromise between compression ratio and speed
# also, anything above --best increases the startup time of the compressed
# executable significantly
add_custom_command(
OUTPUT ${UNIVERSAL_PACKED}
COMMAND ${UPX_EXE} -o ${UNIVERSAL_PACKED} $<TARGET_FILE:dwarfsuniversal>
COMMAND ${UPX_EXE} -9 -o ${UNIVERSAL_PACKED} $<TARGET_FILE:dwarfsuniversal>
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

Expand Down

0 comments on commit f85873a

Please sign in to comment.