Skip to content

Commit

Permalink
rdmd: Use .dylib instead of .so on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberShadow committed May 1, 2023
1 parent b7d2ef2 commit c950a65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion changelog/rdmd_shared.dd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rdmd supports `-shared`

rdmd now understands DMD's `-shared` switch, and sets the default output file name appropriately (`.dll` or `so` depending on the platform), in the same way as `-lib`.
rdmd now understands DMD's `-shared` switch, and sets the default output file name appropriately (`.dll`, `.so`, or `.dylib` depending on the platform), in the same way as `-lib`.
9 changes: 6 additions & 3 deletions rdmd.d
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ version (Posix)
enum objExt = ".o";
enum binExt = "";
enum libExt = ".a";
enum dllExt = ".so";
version (OSX)
enum dllExt = ".dylib";
else
enum dllExt = ".so";
enum altDirSeparator = "";
}
else version (Windows)
Expand Down Expand Up @@ -367,7 +370,7 @@ size_t indexOfProgram(string[] args)
{
auto arg = args[i];
if (!arg.startsWith('-', '@') &&
!arg.endsWith(".obj", ".o", ".lib", ".a", ".dll", ".so", ".def", ".map", ".res") &&
!arg.endsWith(".obj", ".o", ".lib", ".a", ".dll", ".so", ".dylib", ".def", ".map", ".res") &&
args[i - 1] != "--eval")
{
return i;
Expand Down Expand Up @@ -634,7 +637,7 @@ private string[string] getDependencies(string rootModule, string workDir,
string[] names = [libName ~ ".lib"];
else
{
string[] names = ["lib" ~ libName ~ ".a", "lib" ~ libName ~ ".so"];
string[] names = ["lib" ~ libName ~ ".a", "lib" ~ libName ~ ".so", "lib" ~ libName ~ ".dylib"];
dirs ~= ["/lib", "/usr/lib"];
}
foreach (dir; dirs)
Expand Down

0 comments on commit c950a65

Please sign in to comment.