Compiler improvements 3

This commit is contained in:
StarManiaKG 2024-03-21 22:36:39 -04:00
parent 7de8bb79d0
commit daa2112adf
3 changed files with 58 additions and 2 deletions

View file

@ -0,0 +1,34 @@
# Find SDL2_MixerX
# Once done, this will define
#
# SDL2_MIXERX_FOUND - system has SDL2_MixerX
# SDL2_MIXERX_INCLUDE_DIRS - SDL2_MixerX include directories
# SDL2_MIXERX_LIBRARIES - link libraries
include(LibFindMacros)
libfind_pkg_check_modules(SDL2_MIXERX_PKGCONF SDL2_mixerx)
# includes
find_path(SDL2_MIXERX_INCLUDE_DIR
NAMES SDL_mixer_ext.h
PATHS
${SDL2_MIXERX_PKGCONF_INCLUDE_DIRS}
"/usr/include/SDL2"
"/usr/local/include/SDL2"
)
# library
find_library(SDL2_MIXERX_LIBRARY
NAMES SDL2_mixer_ext
PATHS
${SDL2_MIXERX_PKGCONF_LIBRARY_DIRS}
"/usr/lib"
"/usr/local/lib"
)
# set include dir variables
set(SDL2_MIXERX_PROCESS_INCLUDES SDL2_MIXERX_INCLUDE_DIR)
set(SDL2_MIXERX_PROCESS_LIBS SDL2_MIXERX_LIBRARY)
libfind_process(MIXERX)

View file

@ -204,6 +204,28 @@ if("${SRB2_CONFIG_HWRENDER}")
endif()
endif()
if("${SRB2_CONFIG_HAVE_MIXERX}")
if("${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}")
set(MIXERX_FOUND ON)
if(${SRB2_SYSTEM_BITS} EQUAL 64)
set(MIXERX_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2)
set(MIXERX_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDLMixerX/x86_64-w64-mingw32/lib -lSDL2_mixer_ext")
else() # 32-bit
set(MIXERX_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDLMixerX/i686-w64-mingw32/include/SDL2)
set(MIXERX_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDLMixerX/i686-w64-mingw32/lib -lSDL2_mixer_ext")
endif()
else()
find_package(MIXERX)
endif()
if(${MIXERX_FOUND})
set(SRB2_HAVE_MIXERX ON)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXERX)
else()
message(WARNING "You have specified that SDL Mixer X is available but it was not found.")
endif()
endif()
# Targets
# If using CCACHE, then force it.

View file

@ -713,7 +713,7 @@ void I_SetSfxVolume(UINT8 volume)
static UINT32 get_real_volume(UINT8 volume)
{
#if defined (HAVE_MIXERX) && (_WIN32)
#if !defined(SDL_MIXER_VERSION_ATLEAST(2,6,0)) // StarManiaKG: recent SDL_Mixer_X builds fix whatever issue was here, apparently :p //
#ifndef SDL_MIXER_VERSION_ATLEAST(2,6,0) // StarManiaKG: recent SDL_Mixer_X builds fix whatever issue was here, apparently :p //
if (I_SongType() == MU_MID)
// HACK: Until we stop using native MIDI,
// disable volume changes
@ -1610,7 +1610,7 @@ void I_SetMusicVolume(UINT8 volume)
return;
#if defined (HAVE_MIXERX) && (_WIN32)
#if !defined(SDL_MIXER_VERSION_ATLEAST(2,6,0)) // StarManiaKG: recent SDL_Mixer_X builds fix whatever issue was here, apparently :p //
#ifndef SDL_MIXER_VERSION_ATLEAST(2,6,0) // StarManiaKG: recent SDL_Mixer_X builds fix whatever issue was here, apparently :p //
if (I_SongType() == MU_MID)
// HACK: Until we stop using native MIDI,
// disable volume changes