Skip to content

add component disable flag to android build#25190

Merged
asmorkalov merged 2 commits intoopencv:4.xfrom
klatism:android-config-flags-enhancement
Mar 27, 2024
Merged

add component disable flag to android build#25190
asmorkalov merged 2 commits intoopencv:4.xfrom
klatism:android-config-flags-enhancement

Conversation

@klatism
Copy link
Copy Markdown
Contributor

@klatism klatism commented Mar 9, 2024

Adding --disable flag to android sdk build script. The flag allows to exclude components from build by concatting -DWITH_XXX cmake flag to the build command. Example : --disable OPENEXR (uppercase).

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

Copy link
Copy Markdown
Contributor

@opencv-alalek opencv-alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, this could be handled by using own "config" file for your SDK recipe.

parser.add_argument('--no_kotlin', action="store_true", help="Disable Kotlin extensions")
parser.add_argument('--shared', action="store_true", help="Build shared libraries")
parser.add_argument('--no_media_ndk', action="store_true", help="Do not link Media NDK (required for video I/O support)")
parser.add_argument('--disable', metavar='FEATURE', default=[], action='append', help='OpenCV features to disable (add WITH_*=OFF). To disable multiple, specify this flag again, e.g. "--disable tbb --disable openmp"')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbb

Uppercase?

cmake_vars['WITH_ANDROID_MEDIANDK'] = "OFF"

if len(self.disable) > 0:
cmd.extend(["-DWITH_%s=OFF" % f for f in self.disable])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use cmake_vars instead.

May be even after this line: cmake_vars.update(abi.cmake_vars)

@klatism
Copy link
Copy Markdown
Contributor Author

klatism commented Mar 12, 2024

thanks for the review! made changes following the comments.

@klatism
Copy link
Copy Markdown
Contributor Author

klatism commented Mar 21, 2024

@opencv-alalek ready to merge?

Copy link
Copy Markdown
Contributor

@opencv-alalek opencv-alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Thank you for contribution!

@asmorkalov asmorkalov merged commit 43666e1 into opencv:4.x Mar 27, 2024
@asmorkalov asmorkalov mentioned this pull request Apr 1, 2024
klatism added a commit to klatism/opencv that referenced this pull request May 17, 2024
…ancement

Add component disable flag to android build opencv#25190

Adding --disable flag to android sdk build script. The flag allows to exclude components from build by concatting -DWITH_XXX cmake flag to the build command. Example : --disable OPENEXR (uppercase).

- [X] I agree to contribute to the project under Apache 2 License.
- [X] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [X] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants