forked from wpilibsuite/allwpilib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
16,686 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import shutil | ||
import subprocess | ||
|
||
from upstream_utils import ( | ||
walk_cwd_and_copy_if, | ||
Lib, | ||
) | ||
|
||
|
||
def copy_upstream_src(wpilib_root): | ||
wpical = os.path.join(wpilib_root, "wpimath") | ||
|
||
# Delete old install | ||
for d in [ | ||
"src/main/native/thirdparty/mrcal/src", | ||
"src/main/native/thirdparty/mrcal/include", | ||
]: | ||
shutil.rmtree(os.path.join(wpical, d), ignore_errors=True) | ||
|
||
walk_cwd_and_copy_if( | ||
lambda dp, f: (f.endswith(".h") or f.endswith(".hh")) | ||
and not f.endswith("mrcal-image.h") | ||
and not f.endswith("stereo.h") | ||
and not f.endswith("stereo-matching-libelas.h") | ||
and not dp.startswith(os.path.join(".", "test")), | ||
os.path.join(wpical, "src/main/native/thirdparty/mrcal/include"), | ||
) | ||
walk_cwd_and_copy_if( | ||
lambda dp, f: (f.endswith(".c") or f.endswith(".cc") or f.endswith(".pl")) | ||
and not f.endswith("mrcal-pywrap.c") | ||
and not f.endswith("image.c") | ||
and not f.endswith("stereo.c") | ||
and not f.endswith("stereo-matching-libelas.cc") | ||
and not f.endswith("uncertainty.c") | ||
and not dp.startswith(os.path.join(".", "doc")) | ||
and not dp.startswith(os.path.join(".", "test")), | ||
os.path.join(wpical, "src/main/native/thirdparty/mrcal/src"), | ||
) | ||
|
||
|
||
def main(): | ||
name = "mrcal" | ||
url = "https://github.com/dkogan/mrcal" | ||
tag = "71c89c4e9f268a0f4fb950325e7d551986a281ec" | ||
|
||
mrcal = Lib(name, url, tag, copy_upstream_src) | ||
mrcal.main() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env python3 | ||
|
||
|
||
import os | ||
import subprocess | ||
import sys | ||
import argparse | ||
from pathlib import Path | ||
|
||
|
||
def main(argv): | ||
script_path = Path(__file__).resolve() | ||
dirname = script_path.parent | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
"--output_directory", | ||
help="Optional. If set, will output the generated files to this directory, otherwise it will use a path relative to the script", | ||
default=dirname / "src/main/native/thirdparty/mrcal/generated/", | ||
type=Path, | ||
) | ||
args = parser.parse_args(argv) | ||
|
||
args.output_directory.mkdir(parents=True, exist_ok=True) | ||
result = subprocess.run( | ||
f"{dirname}/src/main/native/thirdparty/mrcal/src/minimath/minimath_generate.pl", | ||
capture_output=True, | ||
) | ||
(args.output_directory / "minimath_generated.h").write_text( | ||
str(result.stdout, encoding="UTF8") | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main(sys.argv[1:]) |
Oops, something went wrong.