From 8fa2f90a2638f9d635cc2e1e55093e671734274c Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Sat, 3 Nov 2018 23:06:10 +0000 Subject: CREATE_PROJECT: Support building with Tremor instead of Vorbis --- devtools/create_project/cmake.cpp | 4 +++- devtools/create_project/create_project.cpp | 18 +++++++++++++++++- devtools/create_project/create_project.h | 9 +++++++++ devtools/create_project/xcode.cpp | 21 ++++++++++++++++++--- 4 files changed, 47 insertions(+), 5 deletions(-) (limited to 'devtools/create_project') diff --git a/devtools/create_project/cmake.cpp b/devtools/create_project/cmake.cpp index 20f868299a..fcd1cf5c1a 100644 --- a/devtools/create_project/cmake.cpp +++ b/devtools/create_project/cmake.cpp @@ -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" }, diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index cbf30adae8..3dab08a0b3 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -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]); diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h index fc3df8154a..af4de291e4 100644 --- a/devtools/create_project/create_project.h +++ b/devtools/create_project/create_project.h @@ -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. * diff --git a/devtools/create_project/xcode.cpp b/devtools/create_project/xcode.cpp index e6ba6a8ba1..a04d250a3e 100644 --- a/devtools/create_project/xcode.cpp +++ b/devtools/create_project/xcode.cpp @@ -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"); } -- cgit v1.2.3