parameters: (self)
docstring: Generates compliation flags.
docstring_summary: Generates compliation flags.
docstring_tokens: Generates compliation flags .
function: def generate_compliation_flags(self):
          """Generates compliation flags. """
          toolchain_dir = os.environ.get('TOOLCHAIN_DIR', '')
          if toolchain_dir and not toolchain_dir.endswith('/'):
              toolchain_dir += '/'
          cpp_str = toolchain_dir + os.environ.get('CPP', 'cpp')
          cc_str = toolchain_dir + os.environ.get('CC', 'gcc')
          cxx_str = toolchain_dir + os.environ.get('CXX', 'g++')
          nvcc_str = toolchain_dir + os.environ.get('NVCC', 'nvcc')
          ld_str = toolchain_dir + os.environ.get('LD', 'g++')
          console.info('CPP=%s' % cpp_str)
          console.info('CC=%s' % cc_str)
          console.info('CXX=%s' % cxx_str)
          console.info('NVCC=%s' % nvcc_str)
          console.info('LD=%s' % ld_str)
  
          self.ccflags_manager.set_cpp_str(cpp_str)
  
          # To modify CC, CXX, LD according to the building environment and
          # project configuration
          build_with_distcc = (self.distcc_enabled and
                               self.build_environment.distcc_env_prepared)
          cc_str = self._append_prefix_to_building_var(
                           prefix='distcc',
                           building_var=cc_str,
                           condition=build_with_distcc)
  
          cxx_str = self._append_prefix_to_building_var(
                           prefix='distcc',
                           building_var=cxx_str,
                           condition=build_with_distcc)
  
          build_with_ccache = self.build_environment.ccache_installed
          cc_str = self._append_prefix_to_building_var(
                           prefix='ccache',
                           building_var=cc_str,
                           condition=build_with_ccache)
  
          cxx_str = self._append_prefix_to_building_var(
                           prefix='ccache',
                           building_var=cxx_str,
                           condition=build_with_ccache)
  
          build_with_dccc = (self.dccc_enabled and
                             self.build_environment.dccc_env_prepared)
          ld_str = self._append_prefix_to_building_var(
                          prefix='dccc',
                          building_var=ld_str,
                          condition=build_with_dccc)
  
          cc_env_str = 'CC="%s", CXX="%s"' % (cc_str, cxx_str)
          ld_env_str = 'LINK="%s"' % ld_str
          nvcc_env_str = 'NVCC="%s"' % nvcc_str
  
          cc_config = configparse.blade_config.get_config('cc_config')
          extra_incs = cc_config['extra_incs']
          extra_incs_str = ', '.join(['"%s"' % inc for inc in extra_incs])
          if not extra_incs_str:
              extra_incs_str = '""'
  
          (cppflags_except_warning, linkflags) = self.ccflags_manager.get_flags_except_warning()
  
          builder_list = []
          cuda_incs_str = ' '.join(['-I%s' % inc for inc in self.cuda_inc])
          self._add_rule(
              'nvcc_object_bld = Builder(action = MakeAction("%s -ccbin g++ %s '
              '$NVCCFLAGS -o $TARGET -c $SOURCE", compile_source_message))' % (
                      nvcc_str, cuda_incs_str))
          builder_list.append('BUILDERS = {"NvccObject" : nvcc_object_bld}')
  
          self._add_rule(
              'nvcc_binary_bld = Builder(action = MakeAction("%s %s '
              '$NVCCFLAGS -o $TARGET ", link_program_message))' % (
                      nvcc_str, cuda_incs_str))
          builder_list.append('BUILDERS = {"NvccBinary" : nvcc_binary_bld}')
  
          for builder in builder_list:
              self._add_rule('top_env.Append(%s)' % builder)
  
          self._add_rule('top_env.Replace(%s, %s, '
                         'CPPPATH=[%s, "%s", "%s"], '
                         'CPPFLAGS=%s, CFLAGS=%s, CXXFLAGS=%s, '
                         '%s, LINKFLAGS=%s)' %
                         (cc_env_str, nvcc_env_str,
                          extra_incs_str, self.build_dir, self.python_inc,
                          cc_config['cppflags'] + cppflags_except_warning,
                          cc_config['cflags'],
                          cc_config['cxxflags'],
                          ld_env_str, linkflags))
  
          self._setup_cache()
  
          if build_with_distcc:
              self.build_environment.setup_distcc_env()
  
          for rule in self.build_environment.get_rules():
              self._add_rule(rule)
  
          self._setup_warnings()
function_tokens: def generate_compliation_flags ( self ) : toolchain_dir = os . environ . get ( 'TOOLCHAIN_DIR' , '' ) if toolchain_dir and not toolchain_dir . endswith ( '/' ) : toolchain_dir += '/' cpp_str = toolchain_dir + os . environ . get ( 'CPP' , 'cpp' ) cc_str = toolchain_dir + os . environ . get ( 'CC' , 'gcc' ) cxx_str = toolchain_dir + os . environ . get ( 'CXX' , 'g++' ) nvcc_str = toolchain_dir + os . environ . get ( 'NVCC' , 'nvcc' ) ld_str = toolchain_dir + os . environ . get ( 'LD' , 'g++' ) console . info ( 'CPP=%s' % cpp_str ) console . info ( 'CC=%s' % cc_str ) console . info ( 'CXX=%s' % cxx_str ) console . info ( 'NVCC=%s' % nvcc_str ) console . info ( 'LD=%s' % ld_str ) self . ccflags_manager . set_cpp_str ( cpp_str ) # To modify CC, CXX, LD according to the building environment and # project configuration build_with_distcc = ( self . distcc_enabled and self . build_environment . distcc_env_prepared ) cc_str = self . _append_prefix_to_building_var ( prefix = 'distcc' , building_var = cc_str , condition = build_with_distcc ) cxx_str = self . _append_prefix_to_building_var ( prefix = 'distcc' , building_var = cxx_str , condition = build_with_distcc ) build_with_ccache = self . build_environment . ccache_installed cc_str = self . _append_prefix_to_building_var ( prefix = 'ccache' , building_var = cc_str , condition = build_with_ccache ) cxx_str = self . _append_prefix_to_building_var ( prefix = 'ccache' , building_var = cxx_str , condition = build_with_ccache ) build_with_dccc = ( self . dccc_enabled and self . build_environment . dccc_env_prepared ) ld_str = self . _append_prefix_to_building_var ( prefix = 'dccc' , building_var = ld_str , condition = build_with_dccc ) cc_env_str = 'CC="%s", CXX="%s"' % ( cc_str , cxx_str ) ld_env_str = 'LINK="%s"' % ld_str nvcc_env_str = 'NVCC="%s"' % nvcc_str cc_config = configparse . blade_config . get_config ( 'cc_config' ) extra_incs = cc_config [ 'extra_incs' ] extra_incs_str = ', ' . join ( [ '"%s"' % inc for inc in extra_incs ] ) if not extra_incs_str : extra_incs_str = '""' ( cppflags_except_warning , linkflags ) = self . ccflags_manager . get_flags_except_warning ( ) builder_list = [ ] cuda_incs_str = ' ' . join ( [ '-I%s' % inc for inc in self . cuda_inc ] ) self . _add_rule ( 'nvcc_object_bld = Builder(action = MakeAction("%s -ccbin g++ %s ' '$NVCCFLAGS -o $TARGET -c $SOURCE", compile_source_message))' % ( nvcc_str , cuda_incs_str ) ) builder_list . append ( 'BUILDERS = {"NvccObject" : nvcc_object_bld}' ) self . _add_rule ( 'nvcc_binary_bld = Builder(action = MakeAction("%s %s ' '$NVCCFLAGS -o $TARGET ", link_program_message))' % ( nvcc_str , cuda_incs_str ) ) builder_list . append ( 'BUILDERS = {"NvccBinary" : nvcc_binary_bld}' ) for builder in builder_list : self . _add_rule ( 'top_env.Append(%s)' % builder ) self . _add_rule ( 'top_env.Replace(%s, %s, ' 'CPPPATH=[%s, "%s", "%s"], ' 'CPPFLAGS=%s, CFLAGS=%s, CXXFLAGS=%s, ' '%s, LINKFLAGS=%s)' % ( cc_env_str , nvcc_env_str , extra_incs_str , self . build_dir , self . python_inc , cc_config [ 'cppflags' ] + cppflags_except_warning , cc_config [ 'cflags' ] , cc_config [ 'cxxflags' ] , ld_env_str , linkflags ) ) self . _setup_cache ( ) if build_with_distcc : self . build_environment . setup_distcc_env ( ) for rule in self . build_environment . get_rules ( ) : self . _add_rule ( rule ) self . _setup_warnings ( )