From 520a61f5fa16baa010195a97fc08aeefba1e7a67 Mon Sep 17 00:00:00 2001 From: huulong Date: Fri, 22 Sep 2017 21:15:47 +0200 Subject: [PATCH] Move c(pp) language standard definitions outside Xcode functions --- modules/xcode/xcode_common.lua | 60 +++++++++++++++++----------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/modules/xcode/xcode_common.lua b/modules/xcode/xcode_common.lua index f9ba35dbd5..23ccebf864 100644 --- a/modules/xcode/xcode_common.lua +++ b/modules/xcode/xcode_common.lua @@ -980,52 +980,52 @@ end - function xcode.XCBuildConfiguration_CLanguageStandard(settings, cfg) + xcode.cLanguageStandards = { + ["Default"] = "compiler-default", -- explicit compiler default + ["C89"] = "c89", + ["C90"] = "c90", + ["C99"] = "c99", + ["C11"] = "c11", + ["gnu89"] = "gnu89", + ["gnu90"] = "gnu90", + ["gnu99"] = "gnu99", + ["gnu11"] = "gnu11" + } + + xcode.setCLanguageStandard = function(settings, cfg) -- if no cppdialect is provided, don't set C dialect -- projects without C dialect set will use compiler default if not cfg.cdialect then return end - local cLanguageStandards = { - ["Default"] = "compiler-default", -- explicit compiler default - ["C89"] = "c89", - ["C90"] = "c90", - ["C99"] = "c99", - ["C11"] = "c11", - ["gnu89"] = "gnu89", - ["gnu90"] = "gnu90", - ["gnu99"] = "gnu99", - ["gnu11"] = "gnu11" - } - - local cLanguageStandard = cLanguageStandards[cfg.cdialect] + local cLanguageStandard = xcode.cLanguageStandards[cfg.cdialect] if cLanguageStandard then settings['GCC_C_LANGUAGE_STANDARD'] = cLanguageStandard end end - function xcode.XCBuildConfiguration_CppLanguageStandard(settings, cfg) + xcode.cppLanguageStandards = { + ["Default"] = "compiler-default", -- explicit compiler default + ["C++98"] = "c++98", + ["C++11"] = "c++0x", -- Xcode project GUI uses c++0x, but c++11 also works + ["C++14"] = "c++14", + ["C++17"] = "c++1z", + ["gnu++98"] = "gnu++98", + ["gnu++11"] = "gnu++0x", -- Xcode project GUI uses gnu++0x, but gnu++11 also works + ["gnu++14"] = "gnu++14", + ["gnu++17"] = "gnu++1z" + } + + xcode.setCppLanguageStandard = function(settings, cfg) -- if no cppdialect is provided, don't set C++ dialect -- projects without C++ dialect set will use compiler default if not cfg.cppdialect then return end - local cppLanguageStandards = { - ["Default"] = "compiler-default", -- explicit compiler default - ["C++98"] = "c++98", - ["C++11"] = "c++0x", -- Xcode project GUI uses c++0x, but c++11 also works - ["C++14"] = "c++14", - ["C++17"] = "c++1z", - ["gnu++98"] = "gnu++98", - ["gnu++11"] = "gnu++0x", -- Xcode project GUI uses gnu++0x, but c++11 also works - ["gnu++14"] = "gnu++14", - ["gnu++17"] = "gnu++1z" - } - - local cppLanguageStandard = cppLanguageStandards[cfg.cppdialect] + local cppLanguageStandard = xcode.cppLanguageStandards[cfg.cppdialect] if cppLanguageStandard then settings['CLANG_CXX_LANGUAGE_STANDARD'] = cppLanguageStandard end @@ -1060,8 +1060,8 @@ settings['COPY_PHASE_STRIP'] = 'NO' end - xcode.XCBuildConfiguration_CLanguageStandard(settings, cfg) - xcode.XCBuildConfiguration_CppLanguageStandard(settings, cfg) + xcode.setCLanguageStandard(settings, cfg) + xcode.setCppLanguageStandard(settings, cfg) if cfg.exceptionhandling == p.OFF then settings['GCC_ENABLE_CPP_EXCEPTIONS'] = 'NO'