mirror of
https://github.com/clangen/musikcube.git
synced 2025-02-04 15:39:50 +00:00
Fixed static macOS compiles.
This commit is contained in:
parent
f485c3a052
commit
b5775454f8
@ -103,15 +103,15 @@ add_subdirectory(src/plugins/stockencoders)
|
||||
add_subdirectory(src/plugins/supereqdsp)
|
||||
add_subdirectory(src/plugins/gmedecoder)
|
||||
|
||||
if (${FFMPEG_DECODER} MATCHES "false")
|
||||
message(STATUS "[ffmpeg] decoder enabled = false")
|
||||
if (${FFMPEG_ENABLED} MATCHES "false")
|
||||
message(STATUS "[ffmpeg] enabled = false")
|
||||
add_subdirectory(src/plugins/m4adecoder)
|
||||
add_subdirectory(src/plugins/oggdecoder)
|
||||
add_subdirectory(src/plugins/nomaddecoder)
|
||||
add_subdirectory(src/plugins/flacdecoder)
|
||||
add_dependencies(musikcube m4adecoder oggdecoder nomaddecoder flacdecoder)
|
||||
else()
|
||||
message(STATUS "[ffmpeg] decoder enabled = true")
|
||||
message(STATUS "[ffmpeg] enabled = true")
|
||||
add_subdirectory(src/plugins/ffmpegdecoder)
|
||||
add_dependencies(musikcube ffmpegdecoder)
|
||||
endif()
|
||||
@ -309,7 +309,7 @@ if (GENERATE_DEB MATCHES "1")
|
||||
set(DEPENDENCIES "libboost-thread${DEB_BOOST_VERSION},
|
||||
libboost-system${DEB_BOOST_VERSION}, libboost-chrono${DEB_BOOST_VERSION}, libboost-filesystem${DEB_BOOST_VERSION}, libboost-date-time${DEB_BOOST_VERSION}, libmicrohttpd${DEB_MICROHTTPD_VERSION}, libcurl${DEB_LIBCURL_VERSION}, libogg0, libvorbis0a, libvorbisfile3, libncursesw5, libasound2, libpulse0, pulseaudio, libmp3lame0, libev4")
|
||||
|
||||
if (${FFMPEG_DECODER} MATCHES "false")
|
||||
if (${FFMPEG_ENABLED} MATCHES "false")
|
||||
set(DEPENDENCIES "${DEPENDENCIES}, libflac8, libfaad2")
|
||||
else()
|
||||
set(DEPENDENCIES "${DEPENDENCIES}, libavcodec-extra, libavutil${DEB_AVUTIL_VERSION}, libavformat${DEB_AVFORMAT_VERSION}, libswresample${DEB_SWRESAMPLE_VERSION}")
|
||||
|
@ -10,7 +10,7 @@ fi
|
||||
rm -rf bin/
|
||||
|
||||
./clean-nix.sh
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DLINK_STATICALLY=true -DFFMPEG_DECODER=false .
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DLINK_STATICALLY=true -DFFMPEG_ENABLED=false .
|
||||
make -j4
|
||||
|
||||
DIRNAME="musikcube_macos_$VERSION"
|
||||
@ -33,7 +33,7 @@ strip bin/musikcubed
|
||||
strip bin/libmusikcore.dylib
|
||||
strip bin/plugins/*.dylib
|
||||
|
||||
pushd bin/dist
|
||||
pushd bin/dist
|
||||
tar cvf musikcube_macos_$VERSION.tar $DIRNAME
|
||||
bzip2 musikcube_macos_$VERSION.tar
|
||||
popd
|
||||
|
@ -40,7 +40,7 @@ if (${LINK_STATICALLY} MATCHES "true")
|
||||
|
||||
add_dependencies(server libmicrohttpd)
|
||||
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/microhttpd/include")
|
||||
file(GLOB EXTRA_OBJS "${CMAKE_CURRENT_SOURCE_DIR}/libmicrohttpd-prefix/src/libmicrohttpd/src/microhttpd/.libs/*.o")
|
||||
file(GLOB EXTRA_OBJS "${CMAKE_CURRENT_SOURCE_DIR}/libmicrohttpd-prefix/src/libmicrohttpd/src/microhttpd/*.o")
|
||||
target_link_libraries(server ${server_LINK_LIBS} z crypto ${EXTRA_OBJS})
|
||||
else()
|
||||
find_library(MICROHTTPDLIB NAMES libmicrohttpd.a microhttpd)
|
||||
|
@ -34,7 +34,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <microhttpd.h>
|
||||
extern "C" {
|
||||
#include <microhttpd.h>
|
||||
}
|
||||
|
||||
#include "Context.h"
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
|
@ -6,6 +6,18 @@ set (stockencoders_SOURCES
|
||||
|
||||
add_library(stockencoders SHARED ${stockencoders_SOURCES})
|
||||
|
||||
if (${FFMPEG_ENABLED} MATCHES "false")
|
||||
message(STATUS "[stockencoders] *not* defining FFMPEG_ENABLED")
|
||||
else()
|
||||
message(STATUS "[stockencoders] defining FFMPEG_ENABLED")
|
||||
add_definitions(-FFMPEG_ENABLED)
|
||||
# fedora (and probably other RPM-based distros) put ffmpeg includes here...
|
||||
include_directories("/usr/include/ffmpeg")
|
||||
include_directories("/usr/local/include/ffmpeg")
|
||||
# note: static linking is a no-go (too many dependencies). sorry macOS.
|
||||
target_link_libraries(stockencoders avcodec avutil avformat swresample)
|
||||
endif()
|
||||
|
||||
# prefer static libraries on mac to make redist easier
|
||||
if (${LINK_STATICALLY} MATCHES "true")
|
||||
find_library(MP3LAMELIB NAMES libmp3lame.a mp3lame)
|
||||
@ -13,10 +25,3 @@ if (${LINK_STATICALLY} MATCHES "true")
|
||||
else()
|
||||
target_link_libraries(stockencoders ${musikcube_LINK_LIBS} mp3lame)
|
||||
endif()
|
||||
|
||||
# fedora (and probably other RPM-based distros) put ffmpeg includes here...
|
||||
include_directories("/usr/include/ffmpeg")
|
||||
include_directories("/usr/local/include/ffmpeg")
|
||||
|
||||
# note: static linking is a no-go (too many dependencies). sorry macOS.
|
||||
target_link_libraries(stockencoders avcodec avutil avformat swresample)
|
||||
|
@ -33,6 +33,9 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "FfmpegEncoder.h"
|
||||
|
||||
#ifdef FFMPEG_ENABLED
|
||||
|
||||
#include "shared.h"
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
@ -628,4 +631,6 @@ AVFrame* FfmpegEncoder::ReallocFrame(
|
||||
}
|
||||
}
|
||||
return original;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // FFMPEG_ENABLED
|
@ -32,6 +32,14 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef WIN32
|
||||
#define FFMPEG_ENABLED
|
||||
#endif
|
||||
|
||||
#ifdef FFMPEG_ENABLED
|
||||
|
||||
#include <core/sdk/IBlockingEncoder.h>
|
||||
#include <core/sdk/DataBuffer.h>
|
||||
#include <string>
|
||||
@ -86,4 +94,6 @@ class FfmpegEncoder : public musik::core::sdk::IBlockingEncoder {
|
||||
std::string format;
|
||||
int inputChannelCount;
|
||||
int inputSampleRate;
|
||||
};
|
||||
};
|
||||
|
||||
#endif // FFMPEG_ENABLED
|
@ -62,6 +62,7 @@ static IEnvironment* environment = nullptr;
|
||||
|
||||
static std::set<std::string> supportedFormats = {
|
||||
".mp3",
|
||||
#ifdef FFMPEG_ENABLED
|
||||
"audio/mpeg",
|
||||
".ogg",
|
||||
"audio/ogg",
|
||||
@ -76,6 +77,7 @@ static std::set<std::string> supportedFormats = {
|
||||
".wma",
|
||||
"audio/x-ms-wma",
|
||||
".wv"
|
||||
#endif
|
||||
};
|
||||
|
||||
static class Plugin : public IPlugin {
|
||||
@ -110,9 +112,11 @@ static class EncoderFactory: public IEncoderFactory {
|
||||
if (isMp3(lowerType)) {
|
||||
return new LameEncoder();
|
||||
}
|
||||
#ifdef FFMPEG_ENABLED
|
||||
else if (supportedFormats.find(lowerType) != supportedFormats.end()) {
|
||||
return new FfmpegEncoder(lowerType);
|
||||
}
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,11 @@ set (taglibreader_SOURCES
|
||||
TaglibMetadataReader.cpp
|
||||
)
|
||||
|
||||
if (${FFMPEG_DECODER} MATCHES "false")
|
||||
message(STATUS "[taglibmetadatareader] *not* defining FFMPEG_DECODER")
|
||||
if (${FFMPEG_ENABLED} MATCHES "false")
|
||||
message(STATUS "[taglibmetadatareader] *not* defining FFMPEG_ENABLED")
|
||||
else()
|
||||
message(STATUS "[taglibmetadatareader] defining FFMPEG_DECODER")
|
||||
add_definitions(-DFFMPEG_DECODER)
|
||||
message(STATUS "[taglibmetadatareader] defining FFMPEG_ENABLED")
|
||||
add_definitions(-FFMPEG_ENABLED)
|
||||
endif()
|
||||
|
||||
add_library(taglibreader SHARED ${taglibreader_SOURCES})
|
||||
|
@ -92,7 +92,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef WIN32
|
||||
#define FFMPEG_DECODER
|
||||
#define FFMPEG_ENABLED
|
||||
#endif
|
||||
|
||||
using namespace musik::core::sdk;
|
||||
@ -223,7 +223,7 @@ bool TaglibMetadataReader::CanRead(const char *extension) {
|
||||
if (extension) {
|
||||
std::string ext(str::lower(extension));
|
||||
return
|
||||
#ifdef FFMPEG_DECODER
|
||||
#ifdef FFMPEG_ENABLED
|
||||
ext.compare("opus") == 0 ||
|
||||
ext.compare("wv") == 0 ||
|
||||
ext.compare("wma") == 0 ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user