Skip to content

Commit

Permalink
android: update build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
alalek committed Jun 20, 2016
1 parent 31952fb commit 7188e6e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
5 changes: 5 additions & 0 deletions platforms/android/build-tests/test_cmake_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import unittest
import os, sys, subprocess, argparse, shutil, re
import logging as log

log.basicConfig(format='%(message)s', level=log.DEBUG)

CMAKE_TEMPLATE='''\
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
Expand Down Expand Up @@ -83,10 +86,12 @@ def runTest(self):
"-DANDROID_TOOLCHAIN_NAME=%s" % self.toolchain,
self.srcdir
]
log.info("Executing: %s" % cmd)
retcode = subprocess.call(cmd)
self.assertEqual(retcode, 0, "cmake failed")

cmd = ["ninja"]
log.info("Executing: %s" % cmd)
retcode = subprocess.call(cmd)
self.assertEqual(retcode, 0, "make failed")

Expand Down
14 changes: 2 additions & 12 deletions platforms/android/build_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ def __init__(self, platform_id, name, toolchain, cmake_name=None):
def __str__(self):
return "%s (%s)" % (self.name, self.toolchain)
def haveIPP(self):
return False
# return self.name == "x86" or self.name == "x86_64"
return self.name == "x86" or self.name == "x86_64"

ABIs = [
ABI("2", "armeabi-v7a", "arm-linux-androideabi-4.8", cmake_name="armeabi-v7a with NEON"),
Expand Down Expand Up @@ -143,7 +142,7 @@ def build_library(self, abi, do_install):
cmd.append(self.opencvdir)

if self.use_ccache == True:
cmd.extend(["-DNDK_CCACHE=ccache", "-DENABLE_PRECOMPILED_HEADERS=OFF"])
cmd.append("-DNDK_CCACHE=ccache")
if do_install:
cmd.extend(["-DBUILD_TESTS=ON", "-DINSTALL_TESTS=ON"])
execute(cmd)
Expand Down Expand Up @@ -238,15 +237,6 @@ def gather_results(self, engines):
log.info("Copy docs: %s", self.docdest)
shutil.copytree(self.docdest, os.path.join(self.resultdest, "sdk", "java", "javadoc"))

# Patch cmake config
with open(os.path.join(self.resultdest, "sdk", "native", "jni", "OpenCVConfig.cmake"), "r+t") as f:
contents = f.read()
contents, count = re.subn(r'OpenCV_ANDROID_NATIVE_API_LEVEL \d+', "OpenCV_ANDROID_NATIVE_API_LEVEL 8", contents)
f.seek(0)
f.write(contents)
f.truncate()
log.info("Patch cmake config: %s (%d changes)", f.name, count)

# Clean samples
path = os.path.join(self.resultdest, "samples")
for item in os.listdir(path):
Expand Down

0 comments on commit 7188e6e

Please sign in to comment.