Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/codelite/codelite_project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
end

local toolset = m.getcompiler(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))
local flags = table.join(toolset.getldflags(cfg), toolset.getincludedirs(cfg, {}, nil, cfg.frameworkdirs), toolset.getrunpathdirs(cfg, table.join(cfg.runpathdirs, config.getsiblingtargetdirs(cfg))), toolset.getSections(cfg), cfg.linkoptions, toolset.getlinks(cfg))

_x(3, '<Linker Options="%s" Required="yes">', table.concat(flags, ";"))

Expand Down
2 changes: 1 addition & 1 deletion modules/gmake/gmake_cpp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@


function cpp.ldFlags(cfg, toolset)
local flags = table.join(toolset.getLibraryDirectories(cfg), toolset.getrunpathdirs(cfg, table.join(cfg.runpathdirs, config.getsiblingtargetdirs(cfg))), toolset.getldflags(cfg), cfg.linkoptions)
local flags = table.join(toolset.getLibraryDirectories(cfg), toolset.getrunpathdirs(cfg, table.join(cfg.runpathdirs, config.getsiblingtargetdirs(cfg))), toolset.getSections(cfg), toolset.getldflags(cfg), cfg.linkoptions)
p.outln('ALL_LDFLAGS += $(LDFLAGS)' .. gmake.list(flags))
end

Expand Down
5 changes: 4 additions & 1 deletion modules/ninja/ninja_cpp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,10 @@ function m.getLdFlags(cfg, toolset)

local libdirs = toolset.getLibraryDirectories(cfg)
flags = table.join(flags, libdirs)


local sections = toolset.getSections(cfg)
flags = table.join(flags, sections)

if toolset.getrunpathdirs then
local runpathdirs = table.join(cfg.runpathdirs, config.getsiblingtargetdirs(cfg))
local rpaths = toolset.getrunpathdirs(cfg, runpathdirs)
Expand Down
22 changes: 22 additions & 0 deletions modules/xcode/tests/test_xcode_project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2130,6 +2130,28 @@
]]
end

function suite.XCBuildConfigurationTarget_infoplist()
files { "./a/b/c/MyProject-Info.plist" }
infoplist "./a/b/c/Override.plist"
prepare()
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
test.capture [[
0141F3FC0D9EB3163D17DF0F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CONFIGURATION_BUILD_DIR = bin/Debug;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_DYNAMIC_NO_PIC = NO;
INFOPLIST_FILE = a/b/c/Override.plist;
INSTALL_PATH = /usr/local/bin;
PRODUCT_NAME = MyProject;
};
name = Debug;
};
]]
end


function suite.XCBuildConfigurationTarget_OnSymbols()
symbols "On"
Expand Down
4 changes: 4 additions & 0 deletions modules/xcode/xcode_common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,10 @@
end
end

if cfg.infoplist then
settings["INFOPLIST_FILE"] = p.tools.getrelative(cfg.project, cfg.infoplist)
end

--ms not by default ...add it manually if you need it
--settings['COMBINE_HIDPI_IMAGES'] = 'YES'

Expand Down
7 changes: 7 additions & 0 deletions src/_premake_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,13 @@
tokens = true,
}

api.register {
name = "infoplist",
scope = "config",
kind = "path",
tokens = true,
}

api.register {
name = "bindirs",
scope = "config",
Expand Down
1 change: 1 addition & 0 deletions src/tools/clang.lua
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
clang.getstructuredimplicitincludedirs = gcc.getstructuredimplicitincludedirs

clang.getrunpathdirs = gcc.getrunpathdirs
clang.getSections = gcc.getSections

--
-- get the right output flag.
Expand Down
13 changes: 13 additions & 0 deletions src/tools/gcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,19 @@
end

--
-- get the link-time file embedding flags
--
function gcc.getSections(cfg)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

99% of the code is all lower case. Should we make this match?

local result = {}
if table.contains(os.getSystemTags(cfg.system), "darwin") then
if cfg.infoplist then
local relative = p.tools.getrelative(cfg.project, cfg.infoplist)
table.insert(result, "-Wl,-sectcreate,__TEXT,__info_plist," .. p.quoted(relative))
end
end
return result
end
--
-- get the right output flag.
--
function gcc.getsharedlibarg(cfg)
Expand Down
4 changes: 4 additions & 0 deletions src/tools/msc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@
return {}
end

function msc.getSections()
return {}
end

--
-- Decorate include file search paths for the MSVC command line.
--
Expand Down
1 change: 1 addition & 0 deletions src/tools/snc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
snc.getstructuredincludedirs = gcc.getstructuredincludedirs
snc.getstructuredimplicitincludedirs = gcc.getstructuredimplicitincludedirs
snc.getrunpathdirs = gcc.getrunpathdirs
snc.getSections = gcc.getSections
snc.getLibraryDirectories = gcc.getLibraryDirectories
snc.getlinks = gcc.getlinks

Expand Down
31 changes: 30 additions & 1 deletion tests/tools/test_gcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1550,6 +1550,35 @@ end
test.contains({ "-Wl,-rpath,'/usr/local/lib/mylibs'" }, gcc.getrunpathdirs(cfg, paths))
end

--
-- Check Info.plist embedding on Apple platforms.
--
function suite.onMacOSXInfoPlist()
system "MacOSX"
infoplist "./MyInfo.plist"

prepare()

local actual = gcc.getSections(cfg)
local expected = "-Wl,-sectcreate,__TEXT,__info_plist,MyInfo.plist"
test.contains({expected}, actual)
end

function suite.notOnMacOSXInfoPlist()
system "Linux"
infoplist "./MyInfo.plist"

prepare()

local actual = gcc.getSections(cfg)
local notExpected = "-Wl,-sectcreate,__TEXT,__info_plist,MyInfo.plist"
test.excludes({notExpected}, actual)
--test.contains ("", "")
--test.contains ("", "")
Comment on lines +1576 to +1577

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented code to remove

end



--
-- Make sure unicode support is handled properly.
--
Expand Down Expand Up @@ -1594,4 +1623,4 @@ end
characterset "Unicode"
prepare()
test.excludes({ "-municode" }, gcc.getldflags(cfg))
end
end
1 change: 1 addition & 0 deletions website/docs/Project-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
| [includedirs](includedirs.md) | |
| [includedirsafter](includedirsafter.md) | |
| [includeexternal](globals/includeexternal.md) | |
| [infoplist](infoplist.md) | Sets the Apple ap bundle infos. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| [infoplist](infoplist.md) | Sets the Apple ap bundle infos. |
| [infoplist](infoplist.md) | Sets the Apple application bundle infos. |

?

| [inlining](inlining.md) | Tells the compiler when it should inline functions |
| [intrinsics](intrinsics.md) | |
| [kind](kind.md) | |
Expand Down
35 changes: 35 additions & 0 deletions website/docs/infoplist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Sets the application bundle information file for any Apple platform application.

```lua
infoplist ("path")
```

When generating Xcode action, this command will override the auto-detected Info.plist from the project file list.

When used in Console application projects, the Info.plist is embedded in the application binary using Apple toolchain specific linker flags.

### Parameters ###

`path` is the file system path to the Apple property list file to use as Info.plist.

### Applies To ###

Project configurations.

### Availability ###

Premake 5.0 or later for Apple platform applications.

### Examples ###

This project defines a default Info.plist and a different one for the Debug configuration.

```lua
project "MyProject"

infoplist "Default.plist"

filter { "configurations:Debug" }
infoplist "DebugInfo.plist"
```

1 change: 1 addition & 0 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ module.exports = {
'includedirsafter',
'incrementallink',
'inheritdependencies',
'infoplist',
'inlinesvisibility',
'inlining',
'intrinsics',
Expand Down
Loading