From 03eb182e7d7ec85361af71d5fb5144a84307fb14 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 9 Apr 2018 11:10:34 +0100 Subject: [PATCH] Revert commit ba130cd --- .../ProjectSaving/jucer_ProjectExport_Xcode.h | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h index 980d3fb55d..822711aa8e 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h @@ -33,7 +33,7 @@ namespace const char* const osxVersionDefault = "10.11"; const char* const iosVersionDefault = "9.3"; - const int oldestSDKVersion = 7; + const int oldestSDKVersion = 5; const int currentSDKVersion = 13; const int minimumAUv3SDKVersion = 11; @@ -421,6 +421,7 @@ protected: osxArchitecture (config, Ids::osxArchitecture, getUndoManager(), osxArch_Default), customXcodeFlags (config, Ids::customXcodeFlags, getUndoManager()), plistPreprocessorDefinitions (config, Ids::plistPreprocessorDefinitions, getUndoManager()), + cppStandardLibrary (config, Ids::cppLibType, getUndoManager()), codeSignIdentity (config, Ids::codeSigningIdentity, getUndoManager(), iOS ? "iPhone Developer" : "Mac Developer"), fastMathEnabled (config, Ids::fastMath, getUndoManager()), stripLocalSymbolsEnabled (config, Ids::stripLocalSymbols, getUndoManager()), @@ -486,6 +487,11 @@ protected: props.add (new TextPropertyComponent (plistPreprocessorDefinitions, "PList Preprocessor Definitions", 2048, true), "Preprocessor definitions used during PList preprocessing (see PList Preprocess)."); + props.add (new ChoicePropertyComponent (cppStandardLibrary, "C++ Library", + { "LLVM libc++", "GNU libstdc++" }, + { "libc++", "libstdc++" }), + "The type of C++ std lib that will be linked."); + props.add (new TextPropertyComponent (codeSignIdentity, "Code-Signing Identity", 1024, false), "The name of a code-signing identity for Xcode to apply."); @@ -508,6 +514,8 @@ protected: bool isFastMathEnabled() const { return fastMathEnabled.get(); } + String getCPPStandardLibraryString() const { return cppStandardLibrary.get(); } + bool isStripLocalSymbolsEnabled() const { return stripLocalSymbolsEnabled.get(); } String getCustomXcodeFlagsString() const { return customXcodeFlags.get(); } @@ -532,7 +540,7 @@ protected: bool iOS; ValueWithDefault osxSDKVersion, osxDeploymentTarget, iosDeploymentTarget, osxArchitecture, - customXcodeFlags, plistPreprocessorDefinitions, codeSignIdentity, + customXcodeFlags, plistPreprocessorDefinitions, cppStandardLibrary, codeSignIdentity, fastMathEnabled, stripLocalSymbolsEnabled, pluginBinaryCopyStepEnabled, vstBinaryLocation, vst3BinaryLocation, auBinaryLocation, rtasBinaryLocation, aaxBinaryLocation; @@ -1121,7 +1129,8 @@ public: : "c++") + cppStandard).quoted()); } - s.set ("CLANG_CXX_LIBRARY", "\"libc++\""); + if (config.getCPPStandardLibraryString().isNotEmpty()) + s.set ("CLANG_CXX_LIBRARY", config.getCPPStandardLibraryString().quoted()); s.set ("COMBINE_HIDPI_IMAGES", "YES"); @@ -1568,8 +1577,8 @@ public: = RelativePath (owner.getAAXPathValue().toString(), RelativePath::projectFolder) .getChildFile ("Libs"); - String libraryPath (config.isDebug() ? "Debug" : "Release"); - libraryPath += "/libAAXLibrary_libcpp.a"; + String libraryPath (config.isDebug() ? "Debug/libAAXLibrary" : "Release/libAAXLibrary"); + libraryPath += (isUsingClangCppLibrary (config) ? "_libcpp.a" : ".a"); extraLibs.add (aaxLibsFolder.getChildFile (libraryPath)); } @@ -1630,6 +1639,25 @@ public: return targetExtraSearchPaths; } + bool isUsingClangCppLibrary (const BuildConfiguration& config) const + { + if (auto xcodeConfig = dynamic_cast (&config)) + { + auto configValue = xcodeConfig->getCPPStandardLibraryString(); + + if (configValue.isNotEmpty()) + return (configValue == "libc++"); + + auto minorOSXDeploymentTarget = getOSXDeploymentTarget (*xcodeConfig) + .fromLastOccurrenceOf (".", false, false) + .getIntValue(); + + return (minorOSXDeploymentTarget > 8); + } + + return false; + } + String getOSXDeploymentTarget (const XcodeBuildConfiguration& config, String* sdkRoot = nullptr) const { auto sdk = config.getOSXSDKVersionString();