<commit_before>#!/usr/bin/env python
# -*- python -*-
#BEGIN_LEGAL
#
#Copyright (c) 2017 Intel Corporation
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#  
#END_LEGAL

"""Setup functions for the ms/gnu compiler environment"""

import os
import sys
import platform
from .base import *
from .util import *
from .env import *
from . import msvs


def set_compiler_env_common(env):
    """Set up some common stuff that depends heavily on the compiler setting"""
    
    # This whole section was really an experiment in how dynamically I
    # could do substitutions.
    
    env['debug_flag'] = ( 'debug', { True: '%(DEBUGFLAG)s',
                                     False:''})
    env['debug_flag_link'] = ( 'debug', { True: '%(DEBUGFLAG_LINK)s',
                                          False:''})

    win_shared_compile_dict = ( 'compiler', { 'ms': '/MD',
                                              'icl': '/MD', 
                                              'otherwise': '',
                                              })

    shared_compile_dict = ( 'host_os', { 'android': '-fPIC',
                                          'lin': '-fPIC',
                                          'win': win_shared_compile_dict,
                                          'bsd': '-fPIC',
                                          'otherwise': '',
                                          })
    
    env['shared_compile_flag'] =  ( 'shared', { True: shared_compile_dict,
                                                False:''})
    
    shared_link_dict =  ('compiler', { 'ms':'/dll',
                                       'icl':'/dll',
                                       'icc':'-shared',
                                       'gnu':'-shared'})
    
    env['shared_link'] = ( 'shared', { True:  shared_link_dict,
                                       False:''})
    
    env['OPTOPT'] = ( 'compiler', { 'gnu':'-O',
                                    'clang':'-O',
                                    'iclang':'-O',<commit_msg>Correct Windows runtime flags<commit_after>#!/usr/bin/env python
# -*- python -*-
#BEGIN_LEGAL
#
#Copyright (c) 2017 Intel Corporation
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#  
#END_LEGAL

"""Setup functions for the ms/gnu compiler environment"""

import os
import sys
import platform
from .base import *
from .util import *
from .env import *
from . import msvs


def set_compiler_env_common(env):
    """Set up some common stuff that depends heavily on the compiler setting"""
    
    # This whole section was really an experiment in how dynamically I
    # could do substitutions.
    
    env['debug_flag'] = ( 'debug', { True: '%(DEBUGFLAG)s',
                                     False:''})
    env['debug_flag_link'] = ( 'debug', { True: '%(DEBUGFLAG_LINK)s',
                                          False:''})

    win_shared_compile_dict = ( 'compiler', { 'ms': ( 'debug', { True: '/MDd', False: '/MD' }),
                                              'icl': ( 'debug', { True: '/MDd', False: '/MD' }), 
                                              'otherwise': '',
                                              })

    shared_compile_dict = ( 'host_os', { 'android': '-fPIC',
                                          'lin': '-fPIC',
                                          'win': win_shared_compile_dict,
                                          'bsd': '-fPIC',
                                          'otherwise': '',
                                          })
    
    win_static_compile_dict = ( 'compiler', { 'ms': ( 'debug', { True: '/MTd', False: '/MT' }),
                                              'icl': ( 'debug', { True: '/MTd', False: '/MT' }), 
                                              'otherwise': '',
                                              })

    static_compile_dict = ( 'host_os', { 'android': '',
                                          'lin': '',
                                          'win': win_static_compile_dict,
                                          'bsd': '',
                                          'otherwise': '',
                                          })
    
    env['shared_compile_flag'] =  ( 'shared', { True: shared_compile_dict,
                                                False: static_compile_dict
												})
    
    shared_link_dict =  ('compiler', { 'ms':'/dll',
                                       'icl':'/dll',
                                       'icc':'-shared',
                                       'gnu':'-shared'})
    
    env['shared_link'] = ( 'shared', { True:  shared_link_dict,
                                       False:''})
    
    env['OPTOPT'] = ( 'compiler', { 'gnu':'-O',
                                    'clang':'-O',
                                    'iclang':'-O',
{'fraction_non_alphanumeric': 0.1200750469043152, 'fraction_numerical': 0.0027289783387344363, 'mean_word_length': 1.2562524047710657, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 67, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6301394', 'n_tokens_mistral': 1436, 'n_tokens_neox': 1376, 'n_words': 414}