Skip to content

Commit

Permalink
Move c(pp) language standard definitions outside Xcode functions
Browse files Browse the repository at this point in the history
  • Loading branch information
hsandt committed Sep 29, 2017
1 parent d3d2fbb commit 23f4242
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions modules/xcode/xcode_common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -980,52 +980,52 @@
end


xcode.cLanguageStandards = {
["Default"] = "compiler-default", -- explicit compiler default
["C89"] = "c89",
["C90"] = "c90",
["C99"] = "c99",
["C11"] = "c11",
["gnu89"] = "gnu89",
["gnu90"] = "gnu90",
["gnu99"] = "gnu99",
["gnu11"] = "gnu11"
}

function xcode.XCBuildConfiguration_CLanguageStandard(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


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"
}

function xcode.XCBuildConfiguration_CppLanguageStandard(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
Expand Down

0 comments on commit 23f4242

Please sign in to comment.