CREATE_PROJECT: Support building with Tremor instead of Vorbis

This commit is contained in:
Cameron Cawley 2018-11-03 23:06:10 +00:00 committed by David Turner
parent e016efce56
commit 8fa2f90a26
6 changed files with 50 additions and 9 deletions

View file

@ -45,7 +45,9 @@ const CMakeProvider::Library *CMakeProvider::getLibraryFromFeature(const char *f
{ "mpeg2", kSDLVersionAny, "FindMPEG2", "MPEG2", "MPEG2_INCLUDE_DIRS", "MPEG2_mpeg2_LIBRARY", 0 },
{ "flac", kSDLVersionAny, 0, 0, 0, 0, "FLAC" },
{ "mad", kSDLVersionAny, 0, 0, 0, 0, "mad" },
{ "vorbis", kSDLVersionAny, 0, 0, 0, 0, "vorbisfile vorbis ogg" },
{ "ogg", kSDLVersionAny, 0, 0, 0, 0, "ogg" },
{ "vorbis", kSDLVersionAny, 0, 0, 0, 0, "vorbisfile vorbis" },
{ "tremor", kSDLVersionAny, 0, 0, 0, 0, "vorbisidec" },
{ "theora", kSDLVersionAny, 0, 0, 0, 0, "theoradec" },
{ "fluidsynth",kSDLVersionAny, 0, 0, 0, 0, "fluidsynth" },
{ "faad", kSDLVersionAny, 0, 0, 0, 0, "faad" },

View file

@ -314,6 +314,11 @@ int main(int argc, char *argv[]) {
}
}
// HACK: Vorbis and Tremor can not be enabled simultaneously
if (getFeatureBuildState("tremor", setup.features)) {
setFeatureBuildState("vorbis", setup.features, false);
}
// Print status
cout << "Enabled engines:\n\n";
for (EngineDescList::const_iterator i = setup.engines.begin(); i != setup.engines.end(); ++i) {
@ -1027,7 +1032,9 @@ const Feature s_features[] = {
// Libraries
{ "libz", "USE_ZLIB", "zlib", true, "zlib (compression) support" },
{ "mad", "USE_MAD", "libmad", true, "libmad (MP3) support" },
{ "vorbis", "USE_VORBIS", "libvorbisfile_static libvorbis_static libogg_static", true, "Ogg Vorbis support" },
{ "ogg", "USE_OGG", "libogg_static", true, "Ogg support" },
{ "vorbis", "USE_VORBIS", "libvorbisfile_static libvorbis_static", true, "Vorbis support" },
{ "tremor", "USE_TREMOR", "libtremor", false, "Tremor support" },
{ "flac", "USE_FLAC", "libFLAC_static win_utf8_io_static", true, "FLAC support" },
{ "png", "USE_PNG", "libpng16", true, "libpng support" },
{ "faad", "USE_FAAD", "libfaad", false, "AAC support" },
@ -1120,6 +1127,15 @@ bool setFeatureBuildState(const std::string &name, FeatureList &features, bool e
}
}
bool getFeatureBuildState(const std::string &name, FeatureList &features) {
FeatureList::iterator i = std::find(features.begin(), features.end(), name);
if (i != features.end()) {
return i->enable;
} else {
return false;
}
}
ToolList getAllTools() {
const size_t toolCount = sizeof(s_tools) / sizeof(s_tools[0]);

View file

@ -211,6 +211,15 @@ StringList getFeatureLibraries(const FeatureList &features);
*/
bool setFeatureBuildState(const std::string &name, FeatureList &features, bool enable);
/**
* Gets the state of a given feature.
*
* @param name Name of the feature.
* @param features List of features to operate on.
* @return "true", when the feature is enabled, "false" otherwise.
*/
bool getFeatureBuildState(const std::string &name, FeatureList &features);
/**
* Structure to describe a build setup.
*

View file

@ -486,11 +486,16 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
if (CONTAINS_DEFINE(setup.defines, "USE_PNG")) {
DEF_LOCALLIB_STATIC("libpng");
}
if (CONTAINS_DEFINE(setup.defines, "USE_VORBIS") || CONTAINS_DEFINE(setup.defines, "USE_THEORADEC")) {
if (CONTAINS_DEFINE(setup.defines, "USE_OGG")) {
DEF_LOCALLIB_STATIC("libogg");
}
if (CONTAINS_DEFINE(setup.defines, "USE_VORBIS")) {
DEF_LOCALLIB_STATIC("libvorbis");
DEF_LOCALLIB_STATIC("libvorbisfile");
}
if (CONTAINS_DEFINE(setup.defines, "USE_TREMOR")) {
DEF_LOCALLIB_STATIC("libvorbisidec");
}
if (CONTAINS_DEFINE(setup.defines, "USE_THEORADEC")) {
DEF_LOCALLIB_STATIC("libtheoradec");
}
@ -549,11 +554,16 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
if (CONTAINS_DEFINE(setup.defines, "USE_PNG")) {
frameworks_iOS.push_back("libpng.a");
}
if (CONTAINS_DEFINE(setup.defines, "USE_VORBIS") || CONTAINS_DEFINE(setup.defines, "USE_THEORADEC")) {
if (CONTAINS_DEFINE(setup.defines, "USE_OGG")) {
frameworks_iOS.push_back("libogg.a");
}
if (CONTAINS_DEFINE(setup.defines, "USE_VORBIS")) {
frameworks_iOS.push_back("libvorbis.a");
frameworks_iOS.push_back("libvorbisfile.a");
}
if (CONTAINS_DEFINE(setup.defines, "USE_TREMOR")) {
frameworks_iOS.push_back("libvorbisidec.a");
}
if (CONTAINS_DEFINE(setup.defines, "USE_THEORADEC")) {
frameworks_iOS.push_back("libtheoradec.a");
}
@ -632,11 +642,16 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
if (CONTAINS_DEFINE(setup.defines, "USE_PNG")) {
frameworks_osx.push_back("libpng.a");
}
if (CONTAINS_DEFINE(setup.defines, "USE_VORBIS") || CONTAINS_DEFINE(setup.defines, "USE_THEORADEC")) {
if (CONTAINS_DEFINE(setup.defines, "USE_OGG")) {
frameworks_osx.push_back("libogg.a");
}
if (CONTAINS_DEFINE(setup.defines, "USE_VORBIS")) {
frameworks_osx.push_back("libvorbis.a");
frameworks_osx.push_back("libvorbisfile.a");
}
if (CONTAINS_DEFINE(setup.defines, "USE_TREMOR")) {
frameworks_osx.push_back("libvorbisidec.a");
}
if (CONTAINS_DEFINE(setup.defines, "USE_THEORADEC")) {
frameworks_osx.push_back("libtheoradec.a");
}