|
11 | 11 | import type_manager |
12 | 12 |
|
13 | 13 | src_files = [ |
14 | | - '/usr/include/opencv4/opencv2/core/types.hpp', |
15 | | - '/usr/include/opencv4/opencv2/core/mat.hpp', |
16 | | - '/usr/include/opencv4/opencv2/core.hpp', |
17 | | - '/usr/include/opencv4/opencv2/imgproc.hpp', |
18 | | - '/usr/include/opencv4/opencv2/videoio.hpp', |
19 | | - '/usr/include/opencv4/opencv2/highgui.hpp', |
| 14 | + 'opencv4/opencv2/core/types.hpp', |
| 15 | + 'opencv4/opencv2/core/mat.hpp', |
| 16 | + 'opencv4/opencv2/core.hpp', |
| 17 | + 'opencv4/opencv2/imgproc.hpp', |
| 18 | + 'opencv4/opencv2/videoio.hpp', |
| 19 | + 'opencv4/opencv2/highgui.hpp', |
| 20 | +] |
| 21 | + |
| 22 | +system_include_dir_search = [ |
| 23 | + '/usr/include/', |
| 24 | + '/usr/local/include', |
20 | 25 | ] |
21 | 26 |
|
22 | 27 | c_reserved = { |
@@ -343,9 +348,24 @@ def param_sub(match): |
343 | 348 |
|
344 | 349 |
|
345 | 350 | if __name__ == '__main__': |
| 351 | + if len(sys.argv) < 2: |
| 352 | + print('No output folder specified!') |
| 353 | + exit(1) |
| 354 | + |
346 | 355 | dest = sys.argv[1] |
347 | 356 | print('Output directory: {}'.format(dest)) |
348 | 357 |
|
| 358 | + if len(sys.argv) > 2: |
| 359 | + system_include_dir_search.insert(0, sys.argv[2]) |
| 360 | + |
| 361 | + system_include_dir = None |
| 362 | + for include_dir in system_include_dir_search: |
| 363 | + if os.path.exists(os.path.join(include_dir, src_files[0])): |
| 364 | + system_include_dir = include_dir |
| 365 | + break |
| 366 | + |
| 367 | + print('Using include dir: {}'.format(system_include_dir)) |
| 368 | + |
349 | 369 | # TODO enable UMat support, and make a wrapper for handling both Mat and UMat identically |
350 | 370 | generate_umat = False |
351 | 371 |
|
@@ -475,7 +495,7 @@ def sanitize_param(param): |
475 | 495 |
|
476 | 496 | decls = [] |
477 | 497 | for hname in src_files: |
478 | | - decls += parser.parse(hname, wmode=False) |
| 498 | + decls += parser.parse(os.path.join(system_include_dir, hname), wmode=False) |
479 | 499 |
|
480 | 500 | # first pass to collect classes and add types |
481 | 501 | for decl in decls: |
|
0 commit comments