示例#1
0
    def prepareMake(self, platformState, configuration, args, androidAbi,
                    androidHome, cmakeBuildDir):
        self.cmake.open(self.sourceDirectory, cmakeBuildDir, "Unix Makefiles")

        android_abi_arg = self.getAndroidABIFromArch(configuration.arch)
        if not android_abi_arg:
            raise error.InvalidArchitectureError(
                "No target architecture specified. The architecture parameter is required for makefile build systems."
            )

        cmakeArguments = [
            "-DCMAKE_TOOLCHAIN_FILE=%s/ndk-bundle/build/cmake/android.toolchain.cmake"
            % (androidHome),
            "-DANDROID_ABI=%s" % (android_abi_arg),
            "-DANDROID_NATIVE_API_LEVEL=%s" % (self.androidBuildApiVersion),
            "-DCMAKE_BUILD_TYPE=%s" % (configuration.config),
            "-DBDN_BUILD_TESTS=Off",
            "-DBDN_BUILD_EXAMPLES=Off",
        ]

        if args.cmake_option:
            for option in args.cmake_option:
                cmakeArguments += ["-D" + option]

        if args.package_generator:
            cmakeArguments += [
                "-DCPACK_GENERATOR=%s" % (args.package_generator)
            ]

        if args.package_folder:
            packageFolder = args.package_folder
            if not os.path.isabs(packageFolder):
                packageFolder = os.path.join(
                    self.buildFolder.getBaseBuildDir(), packageFolder)

            cmakeArguments += [
                "-DCPACK_OUTPUT_FILE_PREFIX=%s" % (packageFolder)
            ]

        self.logger.warning(
            "Disabling examples and tests, as we cannot build apk's yet.")

        self.logger.debug("Starting configure ...")
        self.logger.debug(" Source Directory: %s", self.sourceDirectory)
        self.logger.debug(" Output Directory: %s", cmakeBuildDir)
        self.logger.debug(" Config: %s", configuration.config)
        self.logger.debug(" Arguments: %s", cmakeArguments)
        self.logger.debug(" Generator: %s", "Unix Makefiles")

        self.cmake.configure(cmakeArguments)

        pass
示例#2
0
    def prepare(self, platformState, configuration, args):
        self.logger.debug("prepare(%s)", configuration)

        cmakeBuildDir = self.buildFolder.getBuildDir(configuration)

        toolChainFileName = None
        needsCleanBuildDir = False
        cmakeEnvironment = ""
        cmakeArch = configuration.arch
        cmakeArguments = []

        self.generatorInfo.ensureHaveCmake()

        generatorName = self.generatorInfo.getCMakeGeneratorName(
            configuration.buildsystem)

        commandIsInQuote = False

        if args.package_generator:
            cmakeArguments += [
                "-DCPACK_GENERATOR=%s" % (args.package_generator)
            ]

        if args.package_folder:
            packageFolder = args.package_folder
            if not os.path.isabs(packageFolder):
                packageFolder = os.path.join(
                    self.buildFolder.getBaseBuildDir(), packageFolder)

            cmakeArguments += [
                "-DCPACK_OUTPUT_FILE_PREFIX=%s" % (packageFolder)
            ]

        if configuration.platform == "mac":
            if configuration.arch != "std":
                raise error.InvalidArchitectureError(arch)

            if args.macos_sdk_path:
                cmakeArguments.extend(
                    ["-DCMAKE_OSX_SYSROOT=%s" % (args.macos_sdk_path)])
            if args.macos_min_version:
                cmakeArguments.extend([
                    "-DCMAKE_OSX_DEPLOYMENT_TARGET=%s" %
                    (args.macos_min_version)
                ])

        elif configuration.platform == "ios":
            if generatorName == 'Xcode' and configuration.arch == "std":
                toolChainFileName = "ios.xcode.toolchain.cmake"
                xcodeDevPath = subprocess.check_output(
                    ['xcode-select', '-p']).decode("utf-8").strip()
                whichCxx = subprocess.check_output(['which', 'c++'
                                                    ]).decode("utf-8").strip()

                self.logger.debug("Environment info:")
                self.logger.debug('\t"xcode-select -p": "%s"' % (xcodeDevPath))
                self.logger.debug('\t"which c++": "%s"' % (whichCxx))
                expected_clangxx_location = os.path.join(
                    xcodeDevPath,
                    "Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++")

                if not os.path.isfile(expected_clangxx_location):
                    self.logger.warning(
                        'Expected file "%s" to exist but it did not' %
                        (expected_clangxx_location))

            else:
                if configuration.arch == "std" or configuration.arch == "simulator":
                    cmakeArguments.extend(["-DIOS_PLATFORM=SIMULATOR64"])
                elif configuration.arch == "device":
                    cmakeArguments.extend(["-DIOS_PLATFORM=OS64"])
                else:
                    raise error.InvalidArchitectureError(arch)

                toolChainFileName = "ios.make.toolchain.cmake"

        if toolChainFileName:
            toolChainFilePath = os.path.join(self.rootDirectory,
                                             "cmake/toolchains",
                                             toolChainFileName)

            if not os.path.isfile(toolChainFilePath):
                self.logger.error(
                    "Required CMake toolchain file not found: %s",
                    toolChainFilePath)
                return 5

            cmakeArguments += ["-DCMAKE_TOOLCHAIN_FILE=" + toolChainFilePath]

        if configuration.config:
            cmakeArguments += ["-DCMAKE_BUILD_TYPE=" + configuration.config]

        if cmakeArch:
            cmakeArguments += ["-A " + cmakeArch]

        if args.cmake_option:
            for option in args.cmake_option:
                cmakeArguments += ["-D" + option]

        if needsCleanBuildDir:
            shutil.rmtree(cmakeBuildDir)

        self.cmake.open(self.sourceDirectory,
                        cmakeBuildDir,
                        generatorName,
                        extraGeneratorName="",
                        extraEnv=cmakeEnvironment)

        self.logger.debug("Starting configure ...")
        self.logger.debug(" Source Directory: %s", self.sourceDirectory)
        self.logger.debug(" Output Directory: %s", cmakeBuildDir)
        self.logger.debug(" Arguments: %s", cmakeArguments)
        self.logger.debug(" Generator: %s", generatorName)

        self.cmake.configure(cmakeArguments)
示例#3
0
    def prepare(self, platformState, configuration, args):
        self.logger.debug("prepare(%s)", configuration)

        cmakeBuildDir = self.buildFolder.getBuildDir(configuration)

        toolChainFileName = None
        needsCleanBuildDir = False
        cmakeEnvironment = ""
        cmakeArch = configuration.arch
        cmakeArguments = []

        self.generatorInfo.ensureHaveCmake()

        generatorName = self.generatorInfo.getCMakeGeneratorName(
            configuration.buildsystem)

        commandIsInQuote = False

        if args.package_generator:
            cmakeArguments += [
                "-DCPACK_GENERATOR=%s" % (args.package_generator)
            ]

        if args.package_folder:
            packageFolder = args.package_folder
            if not os.path.isabs(packageFolder):
                packageFolder = os.path.join(
                    self.buildFolder.getBaseBuildDir(), packageFolder)

            cmakeArguments += [
                "-DCPACK_OUTPUT_FILE_PREFIX=%s" % (packageFolder)
            ]

        if configuration.platform == "mac":
            if configuration.arch != "std":
                raise error.InvalidArchitectureError(arch)

            if args.macos_sdk_path:
                cmakeArguments.extend(
                    ["-DCMAKE_OSX_SYSROOT=%s" % (args.macos_sdk_path)])
            if args.macos_min_version:
                cmakeArguments.extend([
                    "-DCMAKE_OSX_DEPLOYMENT_TARGET=%s" %
                    (args.macos_min_version)
                ])

        elif configuration.platform == "ios":
            if generatorName == 'Xcode' and configuration.arch == "std":
                toolChainFileName = "ios.xcode.toolchain.cmake"
            else:
                if configuration.arch == "std" or configuration.arch == "simulator":
                    cmakeArguments.extend(["-DIOS_PLATFORM=SIMULATOR64"])
                elif configuration.arch == "device":
                    cmakeArguments.extend(["-DIOS_PLATFORM=OS64"])
                else:
                    raise error.InvalidArchitectureError(arch)

                toolChainFileName = "ios.make.toolchain.cmake"

        if toolChainFileName:
            toolChainFilePath = os.path.join(self.rootDirectory,
                                             "cmake/toolchains",
                                             toolChainFileName)

            if not os.path.isfile(toolChainFilePath):
                self.logger.error(
                    "Required CMake toolchain file not found: %s",
                    toolChainFilePath)
                return 5

            cmakeArguments += ["-DCMAKE_TOOLCHAIN_FILE=" + toolChainFilePath]

        if configuration.config:
            cmakeArguments += ["-DCMAKE_BUILD_TYPE=" + configuration.config]

        if cmakeArch:
            cmakeArguments += ["-A " + cmakeArch]

        if args.cmake_option:
            for option in args.cmake_option:
                cmakeArguments += ["-D" + option]

        if needsCleanBuildDir:
            shutil.rmtree(cmakeBuildDir)

        self.cmake.open(self.sourceDirectory,
                        cmakeBuildDir,
                        generatorName,
                        extraGeneratorName="",
                        extraEnv=cmakeEnvironment)

        self.logger.debug("Starting configure ...")
        self.logger.debug(" Source Directory: %s", self.sourceDirectory)
        self.logger.debug(" Output Directory: %s", cmakeBuildDir)
        self.logger.debug(" Arguments: %s", cmakeArguments)
        self.logger.debug(" Generator: %s", generatorName)

        self.cmake.configure(cmakeArguments)