Merge pull request #1661 from depinxi/toolset-frameworkdirs
Add frameworkdirs support to gmake and gmake2 with gcc/clang toolsets
This commit is contained in:
commit
0dd9c4bbdb
@ -195,7 +195,7 @@
|
||||
end
|
||||
|
||||
local toolset = m.getcompiler(cfg)
|
||||
local sysincludedirs = toolset.getincludedirs(cfg, {}, cfg.sysincludedirs)
|
||||
local sysincludedirs = toolset.getincludedirs(cfg, {}, cfg.sysincludedirs, cfg.frameworkdirs)
|
||||
local forceincludes = toolset.getforceincludes(cfg)
|
||||
local cxxflags = table.concat(table.join(sysincludedirs, toolset.getcxxflags(cfg), forceincludes, cfg.buildoptions), ";")
|
||||
local cflags = table.concat(table.join(sysincludedirs, toolset.getcflags(cfg), forceincludes, cfg.buildoptions), ";")
|
||||
@ -225,7 +225,7 @@
|
||||
end
|
||||
|
||||
local toolset = m.getcompiler(cfg)
|
||||
local flags = table.join(toolset.getldflags(cfg), cfg.linkoptions, toolset.getlinks(cfg))
|
||||
local flags = table.join(toolset.getldflags(cfg), toolset.getincludedirs(cfg, {}, nil, cfg.frameworkdirs), toolset.getrunpathdirs(cfg, table.join(cfg.runpathdirs, config.getsiblingtargetdirs(cfg))), cfg.linkoptions, toolset.getlinks(cfg))
|
||||
|
||||
_x(3, '<Linker Required="yes" Options="%s">', table.concat(flags, ";"))
|
||||
|
||||
|
@ -521,7 +521,7 @@ end
|
||||
|
||||
|
||||
function make.includes(cfg, toolset)
|
||||
local includes = toolset.getincludedirs(cfg, cfg.includedirs, cfg.sysincludedirs)
|
||||
local includes = toolset.getincludedirs(cfg, cfg.includedirs, cfg.sysincludedirs, cfg.frameworkdirs)
|
||||
_p(' INCLUDES +=%s', make.list(includes))
|
||||
end
|
||||
|
||||
|
@ -386,7 +386,7 @@
|
||||
|
||||
|
||||
function cpp.includes(cfg, toolset)
|
||||
local includes = toolset.getincludedirs(cfg, cfg.includedirs, cfg.sysincludedirs)
|
||||
local includes = toolset.getincludedirs(cfg, cfg.includedirs, cfg.sysincludedirs, cfg.frameworkdirs)
|
||||
p.outln('INCLUDES +=' .. gmake2.list(includes))
|
||||
end
|
||||
|
||||
@ -531,8 +531,8 @@
|
||||
end
|
||||
end
|
||||
|
||||
if fcfg.includedirs or fcfg.sysincludedirs then
|
||||
local includes = toolset.getincludedirs(cfg, fcfg.includedirs, fcfg.sysincludedirs)
|
||||
if fcfg.includedirs or fcfg.sysincludedirs or fcfg.frameworkdirs then
|
||||
local includes = toolset.getincludedirs(cfg, fcfg.includedirs, fcfg.sysincludedirs, fcfg.frameworkdirs)
|
||||
if #includes > 0 then
|
||||
value = value .. gmake2.list(includes)
|
||||
end
|
||||
|
@ -186,10 +186,10 @@
|
||||
-- An array of symbols with the appropriate flag decorations.
|
||||
--
|
||||
|
||||
function clang.getincludedirs(cfg, dirs, sysdirs)
|
||||
function clang.getincludedirs(cfg, dirs, sysdirs, frameworkdirs)
|
||||
|
||||
-- Just pass through to GCC for now
|
||||
local flags = gcc.getincludedirs(cfg, dirs, sysdirs)
|
||||
local flags = gcc.getincludedirs(cfg, dirs, sysdirs, frameworkdirs)
|
||||
return flags
|
||||
|
||||
end
|
||||
|
@ -284,12 +284,20 @@
|
||||
-- Decorate include file search paths for the GCC command line.
|
||||
--
|
||||
|
||||
function gcc.getincludedirs(cfg, dirs, sysdirs)
|
||||
function gcc.getincludedirs(cfg, dirs, sysdirs, frameworkdirs)
|
||||
local result = {}
|
||||
for _, dir in ipairs(dirs) do
|
||||
dir = project.getrelative(cfg.project, dir)
|
||||
table.insert(result, '-I' .. p.quoted(dir))
|
||||
end
|
||||
|
||||
if table.contains(os.getSystemTags(cfg.system), "darwin") then
|
||||
for _, dir in ipairs(frameworkdirs or {}) do
|
||||
dir = project.getrelative(cfg.project, dir)
|
||||
table.insert(result, '-F' .. p.quoted(dir))
|
||||
end
|
||||
end
|
||||
|
||||
for _, dir in ipairs(sysdirs or {}) do
|
||||
dir = project.getrelative(cfg.project, dir)
|
||||
table.insert(result, '-isystem ' .. p.quoted(dir))
|
||||
@ -481,6 +489,13 @@
|
||||
table.insert(flags, '-L' .. p.quoted(dir))
|
||||
end
|
||||
|
||||
if table.contains(os.getSystemTags(cfg.system), "darwin") then
|
||||
for _, dir in ipairs(cfg.frameworkdirs) do
|
||||
dir = project.getrelative(cfg.project, dir)
|
||||
table.insert(flags, '-F' .. p.quoted(dir))
|
||||
end
|
||||
end
|
||||
|
||||
if cfg.flags.RelativeLinks then
|
||||
for _, dir in ipairs(config.getlinks(cfg, "siblings", "directory")) do
|
||||
local libFlag = "-L" .. p.project.getrelative(cfg.project, dir)
|
||||
|
@ -231,7 +231,7 @@
|
||||
-- Decorate include file search paths for the MSVC command line.
|
||||
--
|
||||
|
||||
function msc.getincludedirs(cfg, dirs, sysdirs)
|
||||
function msc.getincludedirs(cfg, dirs, sysdirs, frameworkdirs)
|
||||
local result = {}
|
||||
dirs = table.join(dirs, sysdirs)
|
||||
for _, dir in ipairs(dirs) do
|
||||
|
@ -674,6 +674,54 @@
|
||||
test.contains("-L/usr/local/lib", gcc.getLibraryDirectories(cfg))
|
||||
end
|
||||
|
||||
--
|
||||
-- Check handling of Apple frameworks search paths
|
||||
--
|
||||
function suite.includeDirs_notDarwin_onFrameworkDirs()
|
||||
system "Linux"
|
||||
frameworkdirs { "/Library/Frameworks" }
|
||||
prepare()
|
||||
test.excludes("-F/Library/Frameworks", gcc.getincludedirs(cfg, {}, {}, cfg.frameworkdirs))
|
||||
end
|
||||
|
||||
function suite.libDirs_notDarwin_onFrameworkDirs()
|
||||
system "Windows"
|
||||
frameworkdirs { "/Library/Frameworks" }
|
||||
prepare()
|
||||
test.excludes("-F/Library/Frameworks", gcc.getLibraryDirectories(cfg))
|
||||
end
|
||||
|
||||
function suite.includeDirs_macosx_onFrameworkDirs()
|
||||
system "MacOSX"
|
||||
location "subdir"
|
||||
frameworkdirs {
|
||||
"/Library/Frameworks",
|
||||
"subdir/Relative/Frameworks"
|
||||
}
|
||||
prepare()
|
||||
test.contains("-F/Library/Frameworks", gcc.getincludedirs(cfg, {}, {}, cfg.frameworkdirs))
|
||||
test.contains("-FRelative/Frameworks", gcc.getincludedirs(cfg, {}, {}, cfg.frameworkdirs))
|
||||
end
|
||||
|
||||
function suite.libDirs_macosx_onFrameworkDirs()
|
||||
system "MacOSX"
|
||||
location "subdir"
|
||||
frameworkdirs {
|
||||
"/Library/Frameworks",
|
||||
"subdir/Relative/Frameworks"
|
||||
}
|
||||
prepare()
|
||||
test.contains("-F/Library/Frameworks", gcc.getLibraryDirectories(cfg))
|
||||
test.contains("-FRelative/Frameworks", gcc.getLibraryDirectories(cfg))
|
||||
end
|
||||
|
||||
function suite.includeDirs_ios_onFrameworkDirs()
|
||||
system "iOS"
|
||||
frameworkdirs { "/Library/Frameworks" }
|
||||
prepare()
|
||||
test.contains("-F/Library/Frameworks", gcc.getincludedirs(cfg, {}, {}, cfg.frameworkdirs))
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of link time optimization flag.
|
||||
|
Loading…
Reference in New Issue
Block a user