Skip to content

Commit d66d738

Browse files
committed
update readme
1 parent 95dd8a3 commit d66d738

File tree

4 files changed

+46
-41
lines changed

4 files changed

+46
-41
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ demo.c
1616
coverage/
1717
pkgs/
1818
__pycache__
19+
*.dll
20+
*.so
21+
*.a
1922

2023
# Files and directories created by pub
2124
.dart_tool/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ This package is in heavy development, dynamic libraries for Windows and linux ha
7676

7777
1. prepare a compiler.
7878

79-
windows: [MinGW-w64 GCC 13.2.0](https://github.com/brechtsanders/winlibs_mingw/releases/download/13.2.0posix-17.0.6-11.0.1-ucrt-r5/winlibs-x86_64-posix-seh-gcc-13.2.0-llvm-17.0.6-mingw-w64ucrt-11.0.1-r5.7z), and add it to PATH.
79+
windows: Install Visual Studio 2019 or Later
8080

8181
ubuntu: reference [opencv official build guide](https://docs.opencv.org/4.x/d7/d9f/tutorial_linux_install.html) to install
8282
2. install `cmake`, `python`, add to PATH

scripts/build.py

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,41 @@ def cmake_build(args: Namespace):
115115
cmd = f"cmake --build . -j {os.cpu_count()*2} --target install --config Release"
116116
os.system(cmd)
117117

118+
def copy_dlls(args, install_dir, lib_name_suffix, lib_copy_to_dir):
119+
lib_name_prefix: str = "lib" if args.os == "windows" else ""
120+
if args.copy_dlls:
121+
dependencies = pyldd.parse_to_list(
122+
pyldd.Args(
123+
format_="json",
124+
path=install_dir / f"{LIB_NAME}{lib_name_suffix}",
125+
sort_by="soname",
126+
recursive=True,
127+
unused=True,
128+
)
129+
)
130+
for dep in dependencies:
131+
skip = (
132+
dep["soname"] is None
133+
# skip system dlls
134+
or str(Path(dep["path"]).absolute()).startswith("C:\WINDOWS")
135+
or not Path(dep["path"]).is_absolute() # skip existed
136+
or not isinstance(dep["path"], str)
137+
)
138+
139+
if skip:
140+
print(f"skip {dep['soname']}: {dep['path']}")
141+
continue
142+
dep_path = Path(dep["path"])
143+
shutil.copyfile(dep["path"], lib_copy_to_dir / dep_path.name)
144+
145+
if str(Path(dep["path"])).startswith(str(install_dir)):
146+
print(f"skip {dep['soname']}: {dep['path']}")
147+
continue
148+
149+
dst = install_dir / f"{lib_name_prefix}{dep_path.name}"
150+
151+
shutil.copyfile(dep["path"], dst)
152+
print(f"{dep['path']} -> {dst}")
118153

119154
def main(args: Namespace):
120155
args.src = Path(args.src).absolute()
@@ -170,49 +205,15 @@ def main(args: Namespace):
170205
install_dir = Path(args.dst) / "install"
171206
_prefix: str = "" if args.os == "windows" else "lib"
172207
shutil.copy(install_dir / f"{_prefix}{LIB_NAME}{lib_name_suffix}", lib_copy_to_dir)
173-
# lib_pub = publish_dir / f"{LIB_NAME}-{args.os}-{args.arch}{lib_name_suffix}"
174-
# shutil.copy(lib, lib_pub)
175-
# print(f"copy {lib} to {lib_pub}")
176208

177-
if args.copy_dlls:
178-
dependencies = pyldd.parse_to_list(
179-
pyldd.Args(
180-
format_="json",
181-
path=install_dir / f"{LIB_NAME}{lib_name_suffix}",
182-
sort_by="soname",
183-
recursive=True,
184-
unused=True,
185-
)
186-
)
187-
for dep in dependencies:
188-
skip = (
189-
dep["soname"] is None
190-
# skip system dlls
191-
or str(Path(dep["path"]).absolute()).startswith("C:\WINDOWS")
192-
or not Path(dep["path"]).is_absolute() # skip existed
193-
or not isinstance(dep["path"], str)
194-
)
195-
196-
if skip:
197-
print(f"skip {dep['soname']}: {dep['path']}")
198-
continue
199-
dep_path = Path(dep["path"])
200-
shutil.copyfile(dep["path"], lib_copy_to_dir / dep_path.name)
201-
202-
if str(Path(dep["path"])).startswith(str(install_dir)):
203-
print(f"skip {dep['soname']}: {dep['path']}")
204-
continue
205-
206-
dst = install_dir / f"{lib_name_prefix}{dep_path.name}"
207-
208-
shutil.copyfile(dep["path"], dst)
209-
print(f"{dep['path']} -> {dst}")
209+
# copy_dlls()
210210

211211
# archive
212-
lib_name_prefix: str = "lib" if args.os == "windows" else ""
213-
fname = publish_dir / f"{lib_name_prefix}{LIB_NAME}-{args.os}-{args.arch}.tar.gz"
212+
fname = publish_dir / f"lib{LIB_NAME}-{args.os}-{args.arch}.tar.gz"
214213
with tarfile.open(fname, mode="w:gz") as tar:
215-
tar.add(install_dir, arcname=f"{args.os}")
214+
for file in install_dir.glob("*"):
215+
if file.is_file():
216+
tar.add(file, arcname=file.name)
216217
print(f"published: {fname}")
217218

218219

test/video_test.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ void main() async {
190190
// cv.imwrite("cv.VideoCapture.fromFile.png", frame);
191191
});
192192

193-
test('cv.VideoCapture.fromDevice', () {
193+
// Disable for github
194+
test('cv.VideoCapture.fromDevice', skip: true, () {
194195
final vc = cv.VideoCapture.fromDevice(0);
195196
expect(vc.isOpened, true);
196197
final frame = cv.Mat.empty();

0 commit comments

Comments
 (0)