Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-lysiuk committed Jan 6, 2025
1 parent 7c7fc79 commit 5ed11ce
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 17 deletions.
18 changes: 9 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ endif()
# Optional dependencies

function(FIND_CODEC)
cmake_parse_arguments(FIND_CODEC "" "NAME;HEADER;DEFINE" "PATH_SUFFIXES;LIBRARIES;SOURCES" ${ARGN})
cmake_parse_arguments(FIND_CODEC "" "NAME;HEADER" "PATH_SUFFIXES;LIBRARIES;DEFINES;SOURCES" ${ARGN})

set(CODEC ${FIND_CODEC_NAME})
find_path(${CODEC}_INCLUDE_DIR ${FIND_CODEC_HEADER} PATH_SUFFIXES ${FIND_CODEC_PATH_SUFFIXES})
Expand Down Expand Up @@ -625,7 +625,7 @@ function(FIND_CODEC)
if(${CODEC}_FOUND)
set(${CODEC}_FOUND TRUE PARENT_SCOPE)
target_sources(${PROJECT_NAME} PRIVATE "${FIND_CODEC_SOURCES}")
target_compile_definitions(${PROJECT_NAME} PRIVATE ${FIND_CODEC_DEFINE})
target_compile_definitions(${PROJECT_NAME} PRIVATE ${FIND_CODEC_DEFINES})
target_include_directories(${PROJECT_NAME} PRIVATE "${${CODEC}_INCLUDE_DIR}")
target_link_libraries(${PROJECT_NAME} PRIVATE "${${CODEC}_LIBRARY}")
endif()
Expand All @@ -634,27 +634,27 @@ endfunction()
find_codec(NAME FLAC
HEADER FLAC/stream_decoder.h
LIBRARIES FLAC
DEFINE USE_CODEC_FLAC
DEFINES USE_CODEC_FLAC
)

find_codec(NAME MIKMOD
HEADER mikmod.h
LIBRARIES mikmod
DEFINE USE_CODEC_MIKMOD
DEFINES USE_CODEC_MIKMOD
)

find_codec(NAME MPG123
HEADER mpg123.h
LIBRARIES mpg123
DEFINE USE_CODEC_MP3
DEFINES USE_CODEC_MP3 USE_CODEC_MPG123
SOURCES Quake/snd_mpg123.c
)

if(NOT MPG123_FOUND)
find_codec(NAME MAD
HEADER mad.h
LIBRARIES mad
DEFINE USE_CODEC_MP3
DEFINES USE_CODEC_MP3 USE_CODEC_MAD
SOURCES Quake/snd_mp3.c
)
endif()
Expand All @@ -663,19 +663,19 @@ find_codec(NAME OPUS
HEADER opusfile.h
PATH_SUFFIXES opus
LIBRARIES opus opusfile
DEFINE USE_CODEC_OPUS
DEFINES USE_CODEC_OPUS
)

find_codec(NAME VORBIS
HEADER vorbis/vorbisfile.h
LIBRARIES vorbis vorbisfile
DEFINE USE_CODEC_VORBIS
DEFINES USE_CODEC_VORBIS
)

find_codec(NAME XMP
HEADER xmp.h
LIBRARIES xmp
DEFINE USE_CODEC_XMP
DEFINES USE_CODEC_XMP
)

if(CMAKE_CROSSCOMPILING)
Expand Down
32 changes: 24 additions & 8 deletions Quake/ls_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <mikmod.h>
#endif // USE_CODEC_MIKMOD

#ifdef USE_CODEC_MP3
#ifdef USE_CODEC_MPG123
#include <mpg123.h>
#if MPG123_API_VERSION < 48
static const char *mpg123_distversion(unsigned int *major, unsigned int *minor, unsigned int *patch)
{
return "pre-1.32.0";
}
#endif // MPG123_API_VERSION < 48
// TODO: libmad support
#endif // USE_CODEC_MP3
#endif // USE_CODEC_MPG123

#ifdef USE_CODEC_MAD
#include <mad.h>
#endif // USE_CODEC_MAD

#ifdef USE_CODEC_OPUS
#include <opusfile.h>
Expand Down Expand Up @@ -75,37 +78,50 @@ int LS_global_expversion(lua_State* state)

lua_pushstring(state, expversion);
++results;

lua_pushfstring(state, "SDL2 %d.%d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
++results;

#ifdef USE_CODEC_FLAC
lua_pushfstring(state, "FLAC %s", FLAC__VERSION_STRING);
++results;
#endif // USE_CODEC_FLAC

#ifdef USE_CODEC_MIKMOD
lua_pushfstring(state, "MikMod %d.%d.%d", LIBMIKMOD_VERSION_MAJOR, LIBMIKMOD_VERSION_MINOR, LIBMIKMOD_REVISION);
++results;
#endif // USE_CODEC_MIKMOD
#ifdef USE_CODEC_MP3

#ifdef USE_CODEC_MPG123
lua_pushfstring(state, "mpg123 %s", mpg123_distversion(nullptr, nullptr, nullptr));
++results;
// TODO: libmad support
#endif // USE_CODEC_MP3
#endif // USE_CODEC_MPG123

#ifdef USE_CODEC_MAD
lua_pushstring(state, "libmad " MAD_VERSION);
++results;
#endif // USE_CODEC_MAD

#ifdef USE_CODEC_OPUS
lua_pushstring(state, opus_get_version_string());
++results;
#endif // USE_CODEC_OPUS

#ifdef USE_CODEC_VORBIS
lua_pushstring(state, vorbis_version_string());
++results;
#endif // USE_CODEC_VORBIS

#ifdef USE_CODEC_XMP
lua_pushfstring(state, "XMP %s", XMP_VERSION);
lua_pushstring(state, "libxmp " XMP_VERSION);
++results;
#endif // USE_CODEC_XMP

lua_pushstring(state, LUA_RELEASE);
++results;

#ifdef USE_IMGUI
lua_pushfstring(state, "ImGui %s", IMGUI_VERSION);
lua_pushstring(state, "ImGui " IMGUI_VERSION);
++results;
#endif // USE_IMGUI

Expand Down

0 comments on commit 5ed11ce

Please sign in to comment.