CMake: Add stripping

- Strips binaries on gcc/clang
  - Affects Linux binary size: from 14.2mb to 6.1mb for static, and from 3.1mb to 2.6mb for shared
  - Does not affect wasm binary size
- Fix building static linux binaries on Ubuntu 22.10 by renaming a few functions in libcelt that clash with system libopus
- Fix building wasm binaries on systems with Vulkan installed
This commit is contained in:
KatieFrogs 2023-01-23 03:06:23 +01:00
parent b250b3faa5
commit 2e3694e102
4 changed files with 15 additions and 3 deletions

View File

@ -53,7 +53,9 @@ elseif(VGMSTREAM_VERSION)
target_compile_definitions(vgmstream_cli PRIVATE VGMSTREAM_VERSION="${VGMSTREAM_VERSION}")
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES GNU)
set_target_properties(vgmstream_cli PROPERTIES LINK_FLAGS_RELEASE -s)
endif()
# Install the CLI program
install(TARGETS vgmstream_cli
@ -80,9 +82,11 @@ if(NOT WIN32 AND BUILD_V123)
# Include the version string
target_compile_definitions(vgmstream123 PRIVATE VGMSTREAM_VERSION="${VGMSTREAM_VERSION}")
if(CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES GNU)
set_target_properties(vgmstream123 PROPERTIES LINK_FLAGS_RELEASE -s)
endif()
# Install vgmstream123
install(TARGETS vgmstream123
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)

View File

@ -96,6 +96,9 @@ if(NOT WIN32 AND USE_CELT)
mdct_backward
mdct_init
mdct_clear
clt_mdct_init
clt_mdct_clear
compute_pulse_cache
)
foreach(ver 0061 0110)

View File

@ -113,6 +113,7 @@ if(USE_FFMPEG)
--disable-nvenc
--disable-nvdec
--disable-vdpau
--disable-vulkan
--enable-parser=${FFMPEG_CONF_PARSER}
--enable-demuxer=${FFMPEG_CONF_DEMUXER}
--enable-decoder=${FFMPEG_CONF_DECODER}

View File

@ -71,4 +71,8 @@ if(NOT EMSCRIPTEN)
setup_target(libvgmstream_shared TRUE)
target_include_directories(libvgmstream_shared PRIVATE ${libvgmstream_includes})
if(CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES GNU)
set_target_properties(libvgmstream_shared PROPERTIES LINK_FLAGS_RELEASE -s)
endif()
endif()