Skip to content

Android build improvements - #13939

Merged
alalek merged 2 commits into
opencv:masterfrom
komakai:android-build-improvements
Mar 4, 2019
Merged

alalek merged 2 commits into
opencv:masterfrom
komakai:android-build-improvements

Conversation

@komakai

@komakai komakai commented Mar 1, 2019

Copy link
Copy Markdown
Contributor

This pullrequest changes platform/android/build_sdk.py

  • look for NDK in "ndk-bundle" directory under the SDK directory if location not specified
  • look for cmake and ninja in "cmake" directory under the SDK directory if not found in the path
  • disable use of ccache if not found in the path

* look for NDK in "ndk-bundle" directory under the SDK directory if location not specified
* look for cmake and ninja in "cmake" directory under the SDK directory if not found in the path
* disable use of ccache if not found in the path

@alalek alalek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for contribution!
What is about adding script parameter with force using of CMake/Ninja from Android SDK?

Comment thread platforms/android/build_sdk.py Outdated
files = [cmd]
else:
files = [cmd + ext for ext in pathext]
else:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code is not complete.

I believe we can use something like this instead:

def check_executable(cmd)
    try:
        retcode = subprocess.call(cmd, shell=shell)
        if retcode < 0:
            return False
        return True
    except:
        return False

if not check_executable(['ninja', "--version"])
    ... fallback for manual searching ...
if not check_executable(['cmake', "--version"])
    ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will add something like this and push a new commit

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Pushed a new commit to address this.
I tested the changes on Windows and Mac and they seem to work well

@komakai

komakai commented Mar 2, 2019

Copy link
Copy Markdown
Contributor Author

What about adding script parameter with force using of CMake/Ninja from Android SDK?

Might be a good idea - but probably something for a separate PR

@alalek alalek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Well done! Thank you 👍

@alalek
alalek merged commit 7444f0c into opencv:master Mar 4, 2019
@komakai
komakai deleted the android-build-improvements branch March 11, 2019 11:05
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
* Android build improvements
* look for NDK in "ndk-bundle" directory under the SDK directory if location not specified
* look for cmake and ninja in "cmake" directory under the SDK directory if not found in the path
* disable use of ccache if not found in the path

* Redo build tool existence checks
SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
* Android build improvements
* look for NDK in "ndk-bundle" directory under the SDK directory if location not specified
* look for cmake and ninja in "cmake" directory under the SDK directory if not found in the path
* disable use of ccache if not found in the path

* Redo build tool existence checks
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.

2 participants