def _cmake_version(cmake_path): command = os.path.join(cmake_path, "cmake") try: simple_exe.output = "" simple_exe('%s --version' % command) version_match = re.search('cmake version ([0-9.]+)', simple_exe.output) del simple_exe.output if version_match: return Version(version_match.group(1)) except OSError: # WindowsError pass return None
def _build(self, *parameters): paths_to_add = self.prepare_build_path() with CustomEnvPath(paths_to_add=paths_to_add): paths = self.bii.bii_paths if len(parameters) == 1: # It's tuple, first element is list with actual parameters parameters = parameters[0] self._handle_parallel_build(parameters) build_options = ' '.join(parameters) # Necessary for building in windows (cygwin in path) cmd = '"%s" --build . %s' % (cmake_command(paths), build_options) self.bii.user_io.out.write('Building: %s\n' % cmd) retcode = simple_exe(cmd, cwd=paths.build) if retcode != 0: raise BiiException('Build failed')
def _build(self, *parameters): paths_to_add = self.prepare_build_path() with CustomEnvPath(paths_to_add=paths_to_add): paths = self.bii.bii_paths if len( parameters ) == 1: # It's tuple, first element is list with actual parameters parameters = parameters[0] self._handle_parallel_build(parameters) build_options = ' '.join(parameters) # Necessary for building in windows (cygwin in path) cmd = '"%s" --build . %s' % (cmake_command(paths), build_options) self.bii.user_io.out.write('Building: %s\n' % cmd) retcode = simple_exe(cmd, cwd=paths.build) if retcode != 0: raise BiiException('Build failed')
def _test(self, parameters): ''' Method to execute tests with CTest Attributes: parameters: list of entered flags ''' paths = self.bii.bii_paths _ctest_command = ctest_command(paths) # If generator is Visual Stdio, biicode'll pass a default build config hive_disk_image = self.bii.hive_disk_image is_visual = "Visual Studio" in hive_disk_image.settings.cmake.generator build_config = '-C Debug' if is_visual and '-C' not in parameters else '' # By default, if user don't pass any argument, biicode'll pass --extra-verbose if not parameters: cmd = '"%s" -VV %s' % (_ctest_command, build_config) else: cmd = '"%s" %s %s' % (_ctest_command, ' '.join(parameters), build_config) self.bii.user_io.out.write('Running tests: %s\n' % cmd) retcode = simple_exe(cmd, cwd=paths.build) if retcode != 0: raise BiiException('CTest failed')
def _build(self, *parameters): paths_to_add = self.prepare_build_path() with CustomEnvPath(paths_to_add=paths_to_add): paths = self.bii.bii_paths if len(parameters) == 1: # It's tuple, first element is list with actual parameters parameters = parameters[0] self._handle_parallel_build(parameters) build_options = ' '.join(parameters) # Necessary for building in windows (cygwin in path) cmd = '"%s" --build . %s' % (cmake_command(paths), build_options) self.bii.user_io.out.write('Building: %s\n' % cmd) retcode = simple_exe(cmd, cwd=paths.build) if 'Eclipse' in self.bii.hive_disk_image.settings.cmake.generator: ide = Eclipse(paths) try: ide.configure_project() except IOError: pass if retcode != 0: raise BiiException('Build failed')
def _build(self, *parameters): paths_to_add = self.prepare_build_path() with CustomEnvPath(paths_to_add=paths_to_add): paths = self.bii.bii_paths if len( parameters ) == 1: # It's tuple, first element is list with actual parameters parameters = parameters[0] self._handle_parallel_build(parameters) build_options = ' '.join(parameters) # Necessary for building in windows (cygwin in path) cmd = '"%s" --build . %s' % (cmake_command(paths), build_options) self.bii.user_io.out.write('Building: %s\n' % cmd) retcode = simple_exe(cmd, cwd=paths.build) if 'Eclipse' in self.bii.hive_disk_image.settings.cmake.generator: ide = Eclipse(paths) try: ide.configure_project() except IOError: pass if retcode != 0: raise BiiException('Build failed')
def _execute_command(self, command, cwd=None): retcode = simple_exe(command, cwd=cwd) if retcode != 0: raise BiiException('Upload failed')