-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Substitute @CURRENT_SOURCE_DIR@ in run_target() and custom_target()
run_target() does some variable substitutions since 0.57.0. This is a new behavior, and undocumented, caused by sharing more code with custom_target(). More consistency is better, so document it now. custom_target() was doing variable substitution in the past, because it shared some code with generator(), but that was undocumented. Some refactoring in 0.57.0 caused it to not replace @CURRENT_SOURCE_DIR@, @SOURCE_DIR@, and @BUILD_DIR@ anymore. This patch adds back @CURRENT_SOURCE_DIR@ and document it. It does not add back @SOURCE_DIR@ because it is duplicate with @SOURCE_ROOT@ that has a better name. Also do not add back @BUILD_DIR@ which is duplicate of @PRIVATE_DIR@, and not @BUILD_ROOT@ surprisingly, adding to the confusion.
- Loading branch information
Showing
5 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import os, sys | ||
from pathlib import Path | ||
|
||
assert 'MESON_SOURCE_ROOT' in os.environ | ||
assert 'MESON_BUILD_ROOT' in os.environ | ||
assert 'MESON_SUBDIR' in os.environ | ||
assert 'MESONINTROSPECT' in os.environ | ||
assert 'MY_ENV' in os.environ | ||
|
||
# Environment has absolute paths and argv has relative paths when using ninja | ||
# backend and absolute paths when using vs backend. What matters is once | ||
# resolved they point to same location. | ||
env_source_root = Path(os.environ['MESON_SOURCE_ROOT']).resolve() | ||
env_build_root = Path(os.environ['MESON_BUILD_ROOT']).resolve() | ||
env_current_source_dir = Path(env_source_root, os.environ['MESON_SUBDIR']).resolve() | ||
argv_paths = [Path(i).resolve() for i in sys.argv[1:]] | ||
source_root, build_root, current_source_dir = argv_paths | ||
|
||
assert source_root == env_source_root | ||
assert build_root == env_build_root | ||
assert current_source_dir == env_current_source_dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters