authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-08-02 11:04:59-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-08-03 09:52:15-07:00
loga0e94ec576428e3b9f003c95e6538cb57f029263
tree48c4cc644d51578f7e7a0ad1a7d444cd0b74e8b5
parent986a3d23abcbdb61fd733d2340d4872b6ee55dca

CLI: add -search_paths_first_static to complete the API

There was no previous way to set preferred mode static, search strategy paths_first.

1 files changed, 7 insertions(+), 2 deletions(-)

src/main.zig+7-2
...@@ -477,9 +477,13 @@ const usage_build_generic =...@@ -477,9 +477,13 @@ const usage_build_generic =
477 \\ -l[lib], --library [lib] Link against system library (only if actually used)477 \\ -l[lib], --library [lib] Link against system library (only if actually used)
478 \\ -needed-l[lib], Link against system library (even if unused)478 \\ -needed-l[lib], Link against system library (even if unused)
479 \\ --needed-library [lib]479 \\ --needed-library [lib]
480 \\ -weak-l[lib] link against system library marking it and all
481 \\ -weak_library [lib] referenced symbols as weak
480 \\ -L[d], --library-directory [d] Add a directory to the library search path482 \\ -L[d], --library-directory [d] Add a directory to the library search path
481 \\ -search_paths_first For each library search path, check for dynamic483 \\ -search_paths_first For each library search path, check for dynamic
482 \\ lib then static lib before proceeding to next path.484 \\ lib then static lib before proceeding to next path.
485 \\ -search_paths_first_static For each library search path, check for static
486 \\ lib then dynamic lib before proceeding to next path.
483 \\ -search_dylibs_first Search for dynamic libs in all library search487 \\ -search_dylibs_first Search for dynamic libs in all library search
484 \\ paths, then static libs.488 \\ paths, then static libs.
485 \\ -search_static_first Search for static libs in all library search489 \\ -search_static_first Search for static libs in all library search
...@@ -536,8 +540,6 @@ const usage_build_generic =...@@ -536,8 +540,6 @@ const usage_build_generic =
536 \\ --subsystem [subsystem] (Windows) /SUBSYSTEM:<subsystem> to the linker540 \\ --subsystem [subsystem] (Windows) /SUBSYSTEM:<subsystem> to the linker
537 \\ --stack [size] Override default stack size541 \\ --stack [size] Override default stack size
538 \\ --image-base [addr] Set base address for executable image542 \\ --image-base [addr] Set base address for executable image
539 \\ -weak-l[lib] link against system library and mark it and all referenced symbols as weak
540 \\ -weak_library [lib]
541 \\ -framework [name] (Darwin) link against framework543 \\ -framework [name] (Darwin) link against framework
542 \\ -needed_framework [name] (Darwin) link against framework (even if unused)544 \\ -needed_framework [name] (Darwin) link against framework (even if unused)
543 \\ -needed_library [lib] link against system library (even if unused)545 \\ -needed_library [lib] link against system library (even if unused)
...@@ -1112,6 +1114,9 @@ fn buildOutputType(...@@ -1112,6 +1114,9 @@ fn buildOutputType(
1112 } else if (mem.eql(u8, arg, "-search_paths_first")) {1114 } else if (mem.eql(u8, arg, "-search_paths_first")) {
1113 lib_search_strategy = .paths_first;1115 lib_search_strategy = .paths_first;
1114 lib_preferred_mode = .Dynamic;1116 lib_preferred_mode = .Dynamic;
1117 } else if (mem.eql(u8, arg, "-search_paths_first_static")) {
1118 lib_search_strategy = .paths_first;
1119 lib_preferred_mode = .Static;
1115 } else if (mem.eql(u8, arg, "-search_dylibs_first")) {1120 } else if (mem.eql(u8, arg, "-search_dylibs_first")) {
1116 lib_search_strategy = .mode_first;1121 lib_search_strategy = .mode_first;
1117 lib_preferred_mode = .Dynamic;1122 lib_preferred_mode = .Dynamic;