def on_build(self, context): # Regardless of dry-run, try to determine if CMake should be invoked should_run_configure = False if context.force_ament_cmake_configure or context.force_cmake_configure: should_run_configure = True elif context.use_ninja and not ninjabuild_exists_at( context.build_space): should_run_configure = True elif not makefile_exists_at(context.build_space) or \ not cmakecache_exists_at(context.build_space): # If either the Makefile or the CMake cache does not exist # we must configure should_run_configure = True cached_ament_cmake_config = get_cached_config(context.build_space, 'ament_cmake_args') ament_cmake_config = { 'cmake_args': context.cmake_args, 'ament_cmake_args': context.ament_cmake_args, 'build_tests': context.build_tests, 'install_space': context.install_space, 'symlink_install': context.symlink_install, } if ament_cmake_config != cached_ament_cmake_config: should_run_configure = True self.warn("Running cmake because arguments have changed.") # Store the ament_cmake_args for next invocation set_cached_config(context.build_space, 'ament_cmake_args', ament_cmake_config) # Figure out if there is a setup file to source prefix = self._get_command_prefix('build', context) # Calculate any extra cmake args which are not common between cmake build types extra_cmake_args = [] if should_run_configure: extra_cmake_args += [ "-DBUILD_TESTING=%d" % int(context.build_tests) ] if context.symlink_install: extra_cmake_args += ['-DAMENT_CMAKE_SYMLINK_INSTALL=1'] extra_cmake_args += context.cmake_args extra_cmake_args += context.ament_cmake_args if context.use_ninja: extra_cmake_args += ['-G', 'Ninja'] # Yield the cmake common on_build (defined in CmakeBuildType) for step in self._common_cmake_on_build(should_run_configure, context, prefix, extra_cmake_args): yield step
def on_build(self, context): # Regardless of dry-run, try to determine if CMake should be invoked should_run_configure = False if context.force_ament_cmake_configure or context.force_cmake_configure: should_run_configure = True elif context.use_ninja and not ninjabuild_exists_at(context.build_space): should_run_configure = True elif not makefile_exists_at(context.build_space) or \ not cmakecache_exists_at(context.build_space): # If either the Makefile or the CMake cache does not exist # we must configure should_run_configure = True cached_ament_cmake_config = get_cached_config(context.build_space, 'ament_cmake_args') ament_cmake_config = { 'cmake_args': context.cmake_args, 'ament_cmake_args': context.ament_cmake_args, 'build_tests': context.build_tests, 'install_space': context.install_space, 'symlink_install': context.symlink_install, } if ament_cmake_config != cached_ament_cmake_config: should_run_configure = True self.warn('Running cmake because arguments have changed.') # Store the ament_cmake_args for next invocation set_cached_config(context.build_space, 'ament_cmake_args', ament_cmake_config) # Figure out if there is a setup file to source prefix = self._get_command_prefix('build', context) # Calculate any extra cmake args which are not common between cmake build types extra_cmake_args = [] if should_run_configure: extra_cmake_args += ['-DBUILD_TESTING=%d' % int(context.build_tests)] if context.symlink_install: extra_cmake_args += ['-DAMENT_CMAKE_SYMLINK_INSTALL=1'] extra_cmake_args += context.cmake_args extra_cmake_args += context.ament_cmake_args if context.use_ninja: extra_cmake_args += ['-G', 'Ninja'] # Yield the cmake common on_build (defined in CmakeBuildType) for step in self._common_cmake_on_build( should_run_configure, context, prefix, extra_cmake_args ): yield step