示例#1
0
    def _common_cmake_on_uninstall(self, context, build_type):
        # Figure out if there is a setup file to source
        prefix = self._get_command_prefix('uninstall', context)

        if IS_LINUX:
            build_action = self._make_uninstall(context, build_type, prefix)
            if build_action:
                yield build_action
        elif IS_WINDOWS:
            if MSBUILD_EXECUTABLE is None:
                raise VerbExecutionError("Could not find 'msbuild' executable")
            uninstall_project_file = project_file_exists_at(
                context.build_space, 'UNINSTALL')
            if uninstall_project_file is not None:
                yield BuildAction(prefix +
                                  [MSBUILD_EXECUTABLE, uninstall_project_file])
            else:
                self.warn(
                    "Could not find Visual Studio project file 'UNINSTALL.vcxproj'"
                )
        elif IS_MACOSX:
            if self._using_xcode_generator(context):
                if XCODEBUILD_EXECUTABLE is None:
                    raise VerbExecutionError(
                        "Could not find 'xcodebuild' executable")
                cmd = prefix + [XCODEBUILD_EXECUTABLE]
                cmd += ['-target', 'uninstall']
                yield BuildAction(cmd)
            else:
                build_action = self._make_uninstall(context, build_type,
                                                    prefix)
                if build_action:
                    yield build_action
        else:
            raise VerbExecutionError('Could not determine operating system')
示例#2
0
 def _common_cmake_on_test(self, context, build_type):
     assert context.build_tests
     # Figure out if there is a setup file to source
     prefix = self._get_command_prefix('test', context)
     if not IS_WINDOWS:
         if has_make_target(context.build_space, 'test') or context.dry_run:
             cmd = prefix + [MAKE_EXECUTABLE, 'test']
             if 'ARGS' not in os.environ:
                 cmd.append('ARGS="-V"')
             yield BuildAction(cmd)
         else:
             self.warn(
                 "Could not run tests for '{0}' package because it has no "
                 "'test' target".format(build_type))
     else:
         if MSBUILD_EXECUTABLE is None:
             raise VerbExecutionError("Could not find 'msbuild' executable")
         run_tests_project_file = project_file_exists_at(
             context.build_space, 'RUN_TESTS')
         if run_tests_project_file is not None or context.dry_run:
             yield BuildAction(prefix +
                               [MSBUILD_EXECUTABLE, run_tests_project_file])
         else:
             self.warn(
                 "Could not find Visual Studio project file 'RUN_TESTS.vcxproj'"
             )
示例#3
0
    def _common_cmake_on_uninstall(self, context, build_type):
        # Figure out if there is a setup file to source
        prefix = self._get_command_prefix('uninstall', context)

        if not IS_WINDOWS:
            if has_make_target(context.build_space, 'uninstall'):
                if MAKE_EXECUTABLE is None:
                    raise VerbExecutionError(
                        "Could not find 'make' executable")
                cmd = prefix + [MAKE_EXECUTABLE, 'uninstall']
                yield BuildAction(cmd)
            else:
                self.warn(
                    "Could not run uninstall for '{0}' package because it has no "
                    "'uninstall' target".format(build_type))
        else:
            if MSBUILD_EXECUTABLE is None:
                raise VerbExecutionError("Could not find 'msbuild' executable")
            uninstall_project_file = project_file_exists_at(
                context.build_space, 'UNINSTALL')
            if uninstall_project_file is not None:
                yield BuildAction(prefix +
                                  [MSBUILD_EXECUTABLE, uninstall_project_file])
            else:
                self.warn(
                    "Could not find Visual Studio project file 'UNINSTALL.vcxproj'"
                )
示例#4
0
    def _common_cmake_on_uninstall(self, context, build_type):
        # Figure out if there is a setup file to source
        prefix = self._get_command_prefix('uninstall', context)

        if IS_LINUX:
            build_action = self._make_uninstall(context, build_type, prefix)
            if build_action:
                yield build_action
        elif IS_WINDOWS:
            if MSBUILD_EXECUTABLE is None:
                raise VerbExecutionError("Could not find 'msbuild' executable")
            uninstall_project_file = project_file_exists_at(context.build_space, 'UNINSTALL')
            if uninstall_project_file is not None:
                yield BuildAction(prefix + [MSBUILD_EXECUTABLE, uninstall_project_file])
            else:
                self.warn("Could not find Visual Studio project file 'UNINSTALL.vcxproj'")
        elif IS_MACOSX:
            if self._using_xcode_generator(context):
                if XCODEBUILD_EXECUTABLE is None:
                    raise VerbExecutionError("Could not find 'xcodebuild' executable")
                cmd = prefix + [XCODEBUILD_EXECUTABLE]
                cmd += ['-target', 'uninstall']
                yield BuildAction(cmd)
            else:
                build_action = self._make_uninstall(context, build_type, prefix)
                if build_action:
                    yield build_action
        else:
            raise VerbExecutionError('Could not determine operating system')
示例#5
0
    def _common_cmake_on_install(self, context):
        # Figure out if there is a setup file to source
        prefix = self._get_command_prefix('install', context)

        if not IS_WINDOWS:
            if has_make_target(context.build_space,
                               'install') or context.dry_run:
                if MAKE_EXECUTABLE is None:
                    raise VerbExecutionError(
                        "Could not find 'make' executable")
                yield BuildAction(prefix + [MAKE_EXECUTABLE, 'install'])
            else:
                self.warn(
                    'Could not run installation for package because it has no '
                    "'install' target")
        else:
            install_project_file = project_file_exists_at(
                context.build_space, 'INSTALL')
            if install_project_file is not None:
                if MSBUILD_EXECUTABLE is None:
                    raise VerbExecutionError(
                        "Could not find 'msbuild' executable")
                yield BuildAction(prefix + [
                    MSBUILD_EXECUTABLE, '/p:Configuration=' +
                    self._get_visual_studio_configuration(context),
                    install_project_file
                ])
            else:
                self.warn(
                    "Could not find Visual Studio project file 'INSTALL.vcxproj'"
                )
示例#6
0
    def _common_cmake_on_install(self, context):
        # Figure out if there is a setup file to source
        prefix = self._get_command_prefix('install', context)

        if not IS_WINDOWS:
            if has_make_target(context.build_space, 'install') or context.dry_run:
                if MAKE_EXECUTABLE is None:
                    raise VerbExecutionError("Could not find 'make' executable")
                yield BuildAction(prefix + [MAKE_EXECUTABLE, 'install'])
            else:
                self.warn('Could not run installation for package because it has no '
                          "'install' target")
        else:
            install_project_file = project_file_exists_at(
                context.build_space, 'INSTALL')
            if install_project_file is not None:
                if MSBUILD_EXECUTABLE is None:
                    raise VerbExecutionError("Could not find 'msbuild' executable")
                yield BuildAction(
                    prefix + [
                        MSBUILD_EXECUTABLE,
                        '/p:Configuration=' + self._get_visual_studio_configuration(context),
                        install_project_file])
            else:
                self.warn("Could not find Visual Studio project file 'INSTALL.vcxproj'")
示例#7
0
    def _common_cmake_on_install(self, context):
        # Figure out if there is a setup file to source
        prefix = self._get_command_prefix('install', context)

        if IS_LINUX:
            build_action = self._make_or_ninja_install(context, prefix)
            if build_action:
                yield build_action
        elif IS_WINDOWS:
            install_project_file = project_file_exists_at(
                context.build_space, 'INSTALL')
            if install_project_file is not None:
                if MSBUILD_EXECUTABLE is None:
                    raise VerbExecutionError(
                        "Could not find 'msbuild' executable")
                yield BuildAction(prefix + [
                    MSBUILD_EXECUTABLE, '/p:Configuration=' +
                    self._get_configuration_from_cmake(context),
                    install_project_file
                ])
            else:
                self.warn(
                    "Could not find Visual Studio project file 'INSTALL.vcxproj'"
                )
        elif IS_MACOSX:
            if self._using_xcode_generator(context):
                # The Xcode CMake generator will produce a file named
                # install_postBuildPhase.makeRelease in the CMakeScripts directory if there is an
                # install command in the CMakeLists.txt file of the package. We use that to only
                # call xcodebuild's install target if there is anything to install
                install_cmake_file_path = os.path.join(
                    context.build_space, 'CMakeScripts',
                    'install_postBuildPhase.makeRelease')
                install_cmake_file = os.path.isfile(install_cmake_file_path)
                if install_cmake_file:
                    if XCODEBUILD_EXECUTABLE is None:
                        raise VerbExecutionError(
                            "Could not find 'xcodebuild' executable")
                    cmd = prefix + [XCODEBUILD_EXECUTABLE]
                    cmd += ['-target', 'install']
                    cmd += [
                        '-configuration',
                        self._get_configuration_from_cmake(context)
                    ]
                    if self._get_sdk_from_cmake(context) != "":
                        cmd += ['-sdk', self._get_sdk_from_cmake(context)]
                        cmd += ['EFFECTIVE_PLATFORM_NAME=']
                    yield BuildAction(cmd)
            else:
                build_action = self._make_or_ninja_install(context, prefix)
                if build_action:
                    yield build_action
        else:
            raise VerbExecutionError('Could not determine operating system')
示例#8
0
    def _common_cmake_on_install(self, context):
        # Figure out if there is a setup file to source
        prefix = self._get_command_prefix("install", context)

        if not IS_WINDOWS:
            # Assumption: install target exists
            if MAKE_EXECUTABLE is None:
                raise VerbExecutionError("Could not find 'make' executable")
            yield BuildAction(prefix + [MAKE_EXECUTABLE, "install"])
        else:
            if MSBUILD_EXECUTABLE is None:
                raise VerbExecutionError("Could not find 'msbuild' executable")
            install_project_file = project_file_exists_at(context.build_space, "INSTALL")
            if install_project_file is None:
                raise VerbExecutionError("Could not find Visual Studio project file 'INSTALL.vcxproj'")
            yield BuildAction(prefix + [MSBUILD_EXECUTABLE, install_project_file])
示例#9
0
    def _common_cmake_on_uninstall(self, context, build_type):
        # Figure out if there is a setup file to source
        prefix = self._get_command_prefix('uninstall', context)

        if not IS_WINDOWS:
            if has_make_target(context.build_space, 'uninstall'):
                cmd = prefix + [MAKE_EXECUTABLE, 'uninstall']
                yield BuildAction(cmd)
            else:
                self.warn("Could not run uninstall for '{0}' package because it has no "
                          "'uninstall' target".format(build_type))
        else:
            if MSBUILD_EXECUTABLE is None:
                raise VerbExecutionError("Could not find 'msbuild' executable")
            uninstall_project_file = project_file_exists_at(context.build_space, 'UNINSTALL')
            if uninstall_project_file is not None:
                yield BuildAction(prefix + [MSBUILD_EXECUTABLE, uninstall_project_file])
            else:
                self.warn("Could not find Visual Studio project file 'UNINSTALL.vcxproj'")
示例#10
0
    def _common_cmake_on_install(self, context):
        # Figure out if there is a setup file to source
        prefix = self._get_command_prefix('install', context)

        if IS_LINUX:
            build_action = self._make_or_ninja_install(context, prefix)
            if build_action:
                yield build_action
        elif IS_WINDOWS:
            install_project_file = project_file_exists_at(
                context.build_space, 'INSTALL')
            if install_project_file is not None:
                if MSBUILD_EXECUTABLE is None:
                    raise VerbExecutionError("Could not find 'msbuild' executable")
                yield BuildAction(
                    prefix + [
                        MSBUILD_EXECUTABLE,
                        '/p:Configuration=' + self._get_configuration_from_cmake(context),
                        install_project_file])
            else:
                self.warn("Could not find Visual Studio project file 'INSTALL.vcxproj'")
        elif IS_MACOSX:
            if self._using_xcode_generator(context):
                # The Xcode CMake generator will produce a file named
                # install_postBuildPhase.makeRelease in the CMakeScripts directory if there is an
                # install command in the CMakeLists.txt file of the package. We use that to only
                # call xcodebuild's install target if there is anything to install
                install_cmake_file_path = os.path.join(
                    context.build_space, 'CMakeScripts', 'install_postBuildPhase.makeRelease')
                install_cmake_file = os.path.isfile(install_cmake_file_path)
                if install_cmake_file:
                    if XCODEBUILD_EXECUTABLE is None:
                        raise VerbExecutionError("Could not find 'xcodebuild' executable")
                    cmd = prefix + [XCODEBUILD_EXECUTABLE]
                    cmd += ['-target', 'install']
                    yield BuildAction(cmd)
            else:
                build_action = self._make_or_ninja_install(context, prefix)
                if build_action:
                    yield build_action
        else:
            raise VerbExecutionError('Could not determine operating system')
示例#11
0
 def _common_cmake_on_test(self, context, build_type):
     assert context.build_tests
     # Figure out if there is a setup file to source
     prefix = self._get_command_prefix("test", context)
     if not IS_WINDOWS:
         if has_make_target(context.build_space, "test") or context.dry_run:
             cmd = prefix + [MAKE_EXECUTABLE, "test"]
             if "ARGS" not in os.environ:
                 cmd.append('ARGS="-V"')
             yield BuildAction(cmd)
         else:
             self.warn("Could not run tests for '{0}' package because it has no " "'test' target".format(build_type))
     else:
         if MSBUILD_EXECUTABLE is None:
             raise VerbExecutionError("Could not find 'msbuild' executable")
         run_tests_project_file = project_file_exists_at(context.build_space, "RUN_TESTS")
         if run_tests_project_file is not None or context.dry_run:
             yield BuildAction(prefix + [MSBUILD_EXECUTABLE, run_tests_project_file])
         else:
             self.warn("Could not find Visual Studio project file 'RUN_TESTS.vcxproj'")
示例#12
0
    def _common_cmake_on_install(self, context):
        # Figure out if there is a setup file to source
        prefix = self._get_command_prefix('install', context)

        if not IS_WINDOWS:
            # Assumption: install target exists
            if MAKE_EXECUTABLE is None:
                raise VerbExecutionError("Could not find 'make' executable")
            yield BuildAction(prefix + [MAKE_EXECUTABLE, 'install'])
        else:
            if MSBUILD_EXECUTABLE is None:
                raise VerbExecutionError("Could not find 'msbuild' executable")
            install_project_file = project_file_exists_at(
                context.build_space, 'INSTALL')
            if install_project_file is None:
                raise VerbExecutionError(
                    "Could not find Visual Studio project file 'INSTALL.vcxproj'"
                )
            yield BuildAction(prefix +
                              [MSBUILD_EXECUTABLE, install_project_file])