Skip to content

Commit

Permalink
duplicate OPENCV_INCLUDE_DIR path if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
UrielCh committed Apr 16, 2024
1 parent becb7a8 commit b995059
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
20 changes: 17 additions & 3 deletions install/compileLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,23 @@ function getOPENCV4NODEJS_INCLUDES(env) {
if (OPENCV_INCLUDE_DIR) {
explicitIncludeDir = (0, commons_js_1.resolvePath)(OPENCV_INCLUDE_DIR);
}
const includes = env.isAutoBuildDisabled
? (explicitIncludeDir ? [explicitIncludeDir] : getDefaultIncludeDirs(env))
: [(0, commons_js_1.resolvePath)(env.opencvInclude), (0, commons_js_1.resolvePath)(env.opencv4Include)];
let includes = [];
if (env.isAutoBuildDisabled) {
if (explicitIncludeDir) {
if (explicitIncludeDir.endsWith('opencv4')) {
includes = [explicitIncludeDir, path.resolve(explicitIncludeDir, '..')];
}
else {
includes = [explicitIncludeDir, path.resolve(explicitIncludeDir, 'opencv4')];
}
}
else {
includes = getDefaultIncludeDirs(env);
}
}
else {
includes = [(0, commons_js_1.resolvePath)(env.opencvInclude), (0, commons_js_1.resolvePath)(env.opencv4Include)];
}
log('info', 'install', `${os_1.EOL}Setting the following includes:`);
includes.forEach(inc => log('info', 'includes', pc.green(inc)));
return includes;
Expand Down
17 changes: 14 additions & 3 deletions install/compileLib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,20 @@ function getOPENCV4NODEJS_INCLUDES(env: OpenCVBuildEnv): string[] {
if (OPENCV_INCLUDE_DIR) {
explicitIncludeDir = resolvePath(OPENCV_INCLUDE_DIR)
}
const includes = env.isAutoBuildDisabled
? (explicitIncludeDir ? [explicitIncludeDir] : getDefaultIncludeDirs(env))
: [resolvePath(env.opencvInclude), resolvePath(env.opencv4Include)]
let includes: string[] = [];
if (env.isAutoBuildDisabled) {
if (explicitIncludeDir) {
if (explicitIncludeDir.endsWith('opencv4')) {
includes = [explicitIncludeDir, path.resolve(explicitIncludeDir, '..')];
} else {
includes = [explicitIncludeDir, path.resolve(explicitIncludeDir, 'opencv4')];
}
} else {
includes = getDefaultIncludeDirs(env);
}
} else {
includes = [resolvePath(env.opencvInclude), resolvePath(env.opencv4Include)];
}
log('info', 'install', `${EOL}Setting the following includes:`)
includes.forEach(inc => log('info', 'includes', pc.green(inc)))
return includes;
Expand Down

0 comments on commit b995059

Please sign in to comment.