Lines Matching +full:ndk +full:- +full:path
1 # -*- coding: utf-8 -*-
3 #-------------------------------------------------------------------------
5 # --------------------------------------
13 # http://www.apache.org/licenses/LICENSE-2.0
21 #-------------------------------------------------------------------------
23 # \todo [2017-04-10 pyry]
25 # * cmake -E copy_directory doesn't copy timestamps which will cause
26 # assets to be always re-packaged
27 # * Consider adding an option for downloading SDK & NDK
40 sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
47 def __init__(self, path, desired_version): argument
48 self.path = path
49 self.buildToolsVersion = SDKEnv.selectBuildToolsVersion(self.path, desired_version)
52 def getBuildToolsVersions (path): argument
53 buildToolsPath = os.path.join(path, "build-tools")
56 if os.path.exists(buildToolsPath):
58 m = re.match(r'^([0-9]+)\.([0-9]+)\.([0-9]+)$', item)
65 def selectBuildToolsVersion (path, preferred): argument
66 versions = SDKEnv.getBuildToolsVersions(path)
71 if preferred == -1:
83 return os.path.join(self.path, "platforms", "android-%d" % apiVersion, "android.jar")
86 return os.path.join(self.path, "build-tools", "%d.%d.%d" % self.buildToolsVersion)
89 def __init__(self, path): argument
90 self.path = path
91 self.version = NDKEnv.detectVersion(self.path)
92 self.hostOsName = NDKEnv.detectHostOsName(self.path)
96 return ["armeabi-v7a", "arm64-v8a", "x86", "x86_64"]
101 "armeabi-v7a": 'android-arm',
102 "arm64-v8a": 'android-arm64',
103 "x86": 'android-x86',
104 "x86_64": 'android-x86_64',
113 def detectVersion (path): argument
114 propFilePath = os.path.join(path, "source.properties")
127 …raise Exception("Failed to detect NDK version (does %s/source.properties have Pkg.Revision?)" % pa…
133 hostOsParts = hostOsName.split('-')
152 def detectHostOsName (path): argument
155 "windows-x86_64",
156 "darwin-x86",
157 "darwin-x86_64",
158 "linux-x86",
159 "linux-x86_64"
163 if os.path.exists(os.path.join(path, "prebuilt", name)):
166 raise Exception("Failed to determine NDK host OS")
169 def __init__(self, sdk, ndk): argument
171 self.ndk = ndk
194 if not os.path.exists(self.env.ndk.path):
195 raise Exception("Android NDK not found at %s" % self.env.ndk.path)
197 if not NDKEnv.isHostOsSupported(self.env.ndk.hostOsName):
198 raise Exception("NDK '%s' is not supported on this machine" % self.env.ndk.hostOsName)
200 if self.env.ndk.version[0] < 15:
201 …raise Exception("Android NDK version %d is not supported; build requires NDK version >= 15" % (sel…
204 …raise Exception("Requires: min-api (%d) <= java-api (%d) <= native-api (%d)" % (self.minApi, self.…
207 …ise Exception("No build tools directory found at %s" % os.path.join(self.env.sdk.path, "build-tool…
209 … if not os.path.exists(os.path.join(self.env.sdk.path, "platforms", "android-%d" % self.javaApi)):
210 …ion %d directory found at %s for Java Api" % (self.javaApi, os.path.join(self.env.sdk.path, "platf…
225 raise Exception("%s not in PATH" % tool)
236 # Path components
263 packageDir = os.path.join(*packageComps)
265 … return os.path.join(config.buildPath, self.package.getAppDirName(), "src", packageDir, "R.java")
267 def resolvePath (config, path): argument
270 for component in path:
276 return os.path.join(*resolvedComps)
295 of files. Any non-existent input paths are preserved as is.
301 yield os.path.join(root, file)
304 for path in paths:
305 if os.path.isdir(path):
306 files += list(getFiles(path))
308 files.append(path)
321 existingInputs = list(filter(os.path.exists, expandedInputs))
322 existingOutputs = list(filter(os.path.exists, expandedOutputs))
333 lastInputChange = max(map(os.path.getmtime, existingInputs))
334 firstOutputChange = min(map(os.path.getmtime, existingOutputs))
342 …return os.path.join(config.buildPath, "%s-%s-%d" % (abiName, config.nativeBuildType, config.native…
346 args.append('-UANGLE_LIBS')
347 args.append('-UGLES1_LIBRARY')
348 args.append('-UGLES2_LIBRARY')
349 args.append('-UEGL_LIBRARY')
357 args = ['-DDEQP_TARGET=android',
358 '-DDEQP_TARGET_TOOLCHAIN=ndk-modern',
359 '-DCMAKE_C_FLAGS=-Werror',
360 '-DCMAKE_CXX_FLAGS=-Werror',
361 '-DANDROID_NDK_PATH=%s' % config.env.ndk.path,
362 '-DANDROID_ABI=%s' % abiName,
363 '-DDE_ANDROID_API=%s' % config.nativeApi,
364 '-DGLCTS_GTF_TARGET=%s' % config.gtfTarget]
369 cMakeCachePath = os.path.join(getNativeBuildPath(config, abi), "CMakeCache.txt")
376 cMakeCachePath = os.path.join(getNativeBuildPath(config, abiName), "CMakeCache.txt")
377 angleLibsDir = os.path.join(config.angle, abiName)
384 args.append('-DANGLE_LIBS=%s' % angleLibsDir)
474 dstDir = os.path.dirname(resolvePath(config, [GeneratedResSourcePath(self.package)]))
476 if not os.path.exists(dstDir):
482 "-f",
483 "-m",
484 "-S", resolvePath(config, self.package.getResPath()),
485 "-M", resolvePath(config, self.package.getManifestPath()),
486 "-J", resolvePath(config, [BuildRoot(), self.package.getAppDirName(), "src"]),
487 "-I", config.env.sdk.getPlatformLibrary(config.javaApi)
523 if os.path.exists(objPath):
531 "-source", "1.7",
532 "-target", "1.7",
533 "-d", objPath,
534 "-bootclasspath", config.env.sdk.getPlatformLibrary(config.javaApi),
535 "-classpath", pathSep.join(classPaths),
536 "-sourcepath", pathSep.join(srcPaths),
540 if not os.path.exists(os.path.dirname(jarPath)):
541 os.makedirs(os.path.dirname(jarPath))
575 args.append("--lib")
578 args.append("--dex")
579 args.append("--output")
592 return os.path.exists(resolvePath(config, self.keystorePath))
597 "-genkeypair",
598 "-keystore", resolvePath(config, self.keystorePath),
599 "-storepass", "android",
600 "-alias", "androiddebugkey",
601 "-keypass", "android",
602 "-keyalg", "RSA",
603 "-keysize", "2048",
604 "-validity", "10000",
605 "-dname", "CN=, OU=, O=, L=, S=, C=",
632 if not os.path.exists(os.path.dirname(dstPath)):
633 os.makedirs(os.path.dirname(dstPath))
638 "-f",
639 "--min-sdk-version", str(config.minApi),
640 "--target-sdk-version", str(config.javaApi),
641 "-M", resolvePath(config, self.package.getManifestPath()),
642 "-I", config.env.sdk.getPlatformLibrary(config.javaApi),
643 "-F", dstPath,
644 "-0", "arsc" # arsc files need to be uncompressed for SDK version 30 and up
648 args += ["-S", resolvePath(config, resPath)]
651 args.append("-v")
663 if os.path.sep == "\\":
673 "-f", apkPath,
687 self.dstPath = [BuildRoot(), self.package.getAppDirName(), "tmp", "with-java.apk"]
704 addFileToAPK(config, dstPath, os.path.dirname(dexPath), os.path.basename(dexPath))
711 self.dstPath = [BuildRoot(), self.package.getAppDirName(), "tmp", "with-assets.apk"]
724 allFiles = BuildStep.expandPathsToFiles([os.path.join(buildPath, "assets")])
725 return [os.path.relpath(p, buildPath) for p in allFiles]
742 self.dstPath = [BuildRoot(), self.package.getAppDirName(), "tmp", "with-native-libs.apk"]
762 libRelPath = os.path.join("lib", abi, "libdeqp.so")
763 libAbsPath = os.path.join(pkgPath, libRelPath)
765 if not os.path.exists(os.path.dirname(libAbsPath)):
766 os.makedirs(os.path.dirname(libAbsPath))
773 layersGlob = os.path.join(config.layers, abi, "*")
776 layerFilename = os.path.basename(layer)
777 layerRelPath = os.path.join("lib", abi, layerFilename)
778 layerAbsPath = os.path.join(pkgPath, layerRelPath)
784 angleGlob = os.path.join(config.angle, abi, "lib*_angle.so")
787 libFilename = os.path.basename(lib)
788 libRelPath = os.path.join("lib", abi, libFilename)
789 libAbsPath = os.path.join(pkgPath, libRelPath)
818 "--ks", resolvePath(config, self.keystorePath),
819 "--ks-key-alias", "androiddebugkey",
820 "--ks-pass", "pass:android",
821 "--key-pass", "pass:android",
822 "--min-sdk-version", str(config.minApi),
823 "--max-sdk-version", str(config.javaApi),
824 "--out", dstPath,
829 return os.path.join(package.getAppDirName(), package.getAppName() + ".apk")
847 zipalignPath = os.path.join(config.env.sdk.getBuildToolsPath(), "zipalign")
851 "-f", "4",
896 ctsPackage = PackageDescription("openglcts", "Khronos-CTS", hasResources = False)
906 ndkBuildPath = which('ndk-build')
908 return os.path.dirname(ndkBuildPath)
915 return os.path.dirname(os.path.dirname(sdkBuildPath))
920 return os.path.join(tempfile.gettempdir(), "deqp-android-build")
928 parser = argparse.ArgumentParser(os.path.basename(__file__),
930 parser.add_argument('--native-build-type',
935 parser.add_argument('--build-root',
939 parser.add_argument('--abis',
943 parser.add_argument('--native-api',
948 parser.add_argument('--java-api',
953 parser.add_argument('--tool-api',
956 default=-1,
957 help="Android Tools level to target (-1 being maximum present)")
958 parser.add_argument('--min-api',
963 parser.add_argument('--sdk',
966 help="Android SDK path",
968 parser.add_argument('--ndk',
971 help="Android NDK path",
973 parser.add_argument('-v', '--verbose',
978 parser.add_argument('--target',
983 parser.add_argument('--kc-cts-target',
987 help="KC-CTS (GTF) target API (only used in openglcts target)")
988 parser.add_argument('--layers-path',
992 parser.add_argument('--angle-path',
1015 raise Exception("--abis can't be empty")
1019 sys.exit(-1)
1026 ndk = NDKEnv(os.path.realpath(args.ndkPath)) variable
1027 sdk = SDKEnv(os.path.realpath(args.sdkPath), args.toolApi)
1028 buildPath = os.path.realpath(args.buildRoot)
1029 env = Environment(sdk, ndk)
1039 print(" --sdk=%s" % args.sdkPath)
1040 print(" --ndk=%s" % args.ndkPath)
1041 sys.exit(-1)
1049 print("Built %s" % os.path.join(buildPath, getBuildRootRelativeAPKPath(pkg)))