Skip to content

Commit

Permalink
updated upx to version 4.2.2 and added upx'd executables to cpack
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Wilmans committed Feb 24, 2024
1 parent f2dd65c commit c0e926e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ target_compile_definitions(project_definitions
WIN32 WIN64 "_WIN32_WINNT=0x0601"
_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
)
target_compile_options(project_compile_options INTERFACE /utf-8)
target_link_options(msvc_gui_link_options INTERFACE /SUBSYSTEM:WINDOWS /NOLOGO)
target_link_options(msvc_console_link_options INTERFACE /SUBSYSTEM:CONSOLE /NOLOGO)

# /Oy and /RELEASE are added to avoid tripping malware detection
# this is quite random, ymmv
target_compile_options(project_compile_options INTERFACE /utf-8 /Oy)
target_link_options(msvc_gui_link_options INTERFACE /SUBSYSTEM:WINDOWS /NOLOGO /RELEASE)
target_link_options(msvc_console_link_options INTERFACE /SUBSYSTEM:CONSOLE /NOLOGO /RELEASE)

add_library(project::definitions ALIAS project_definitions)
add_library(project::compile_features ALIAS project_compile_features)
Expand Down
16 changes: 14 additions & 2 deletions application/DebugViewConsole/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,17 @@ target_include_directories(DebugViewConsole PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
)

get_property(EXE_NAME TARGET DebugViewConsole PROPERTY TARGET_FILE_NAME)
add_custom_command(TARGET DebugViewConsole POST_BUILD COMMAND ${PROJECT_UTILS_DIRECTORY}/upx.exe --best $<TARGET_FILE:DebugViewConsole>)
add_custom_command(
TARGET DebugViewConsole
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE:DebugViewConsole>
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DebugViewConsole-small.exe
)

install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DebugViewConsole.exe ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DebugViewConsole-small.exe)
execute_process(COMMAND ${PROJECT_UTILS_DIRECTORY}/upx.exe ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DebugViewConsole-small.exe)
")

INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DebugViewConsole-small.exe DESTINATION bin)
7 changes: 5 additions & 2 deletions application/DebugViewpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ target_include_directories(Debugviewpp PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
)

get_property(EXE_NAME TARGET Debugviewpp PROPERTY TARGET_FILE_NAME)
add_custom_command(TARGET Debugviewpp POST_BUILD COMMAND ${PROJECT_UTILS_DIRECTORY}/upx.exe --best $<TARGET_FILE:Debugviewpp>)
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debugviewpp.exe ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debugviewpp-small.exe)
execute_process(COMMAND ${PROJECT_UTILS_DIRECTORY}/upx.exe ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debugviewpp-small.exe)
")

INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debugviewpp-small.exe DESTINATION bin)
Binary file modified utils/upx.exe
Binary file not shown.

0 comments on commit c0e926e

Please sign in to comment.