Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added documentation for static and shared linking suffixes #1826

Merged
merged 1 commit into from
Mar 30, 2022
Merged
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
19 changes: 16 additions & 3 deletions website/docs/links.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ filter { "system:linux" }
filter { "system:macosx" }
-- OS X frameworks need the extension to be handled properly
links { "Cocoa.framework", "png" }
```
```

In a workspace with two projects, link the library into the executable. Note that the project name is used to specify the link; Premake will automatically figure out the correct library file name and directory and create a project dependency.

```lua
workspace "MyWorkspace"
```lua
workspace "MyWorkspace"
configurations { "Debug", "Release" }
language "C++"

Expand All @@ -59,6 +59,19 @@ filter { "system:macosx" }
files "**.cpp"
```

You may specify the linking mechanism explicitly for each library. To set the link type of a library explicitly, add a `:static` or `:shared` suffix to the library. Note that this functionality is only available for the `gcc` and `clang` toolsets.

```lua
workspace "MyWorkspace"
configurations { "Debug", "Release" }
language "C++"

project "MyExecutable"
kind "ConsoleApp"
files "**.cpp"
links { "LibraryA:static", "LibraryB:shared" }
```

You may also create links between non-library projects. In this case, Premake will generate a build dependency (the linked project will build first), but not an actual link. In this example, MyProject uses a build dependency to ensure that MyTool gets built first. It then uses MyTool as part of its build process.

```lua
Expand Down