1 # pylint:disable=I0011,W0401,W0614,C0103,E0602 2 ############################################################################ 3 # Copyright 2016-2019 Intel Corporation 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 ############################################################################ 17 """Build configuration for Ipp Crypto 18 """ 19 import os 20 Import('*') 21 22 env.PartVersion("2019.0.1") 23 env.PartName("ippcp") 24 ippcp_libname = '${PART_SHORT_NAME}' 25 26 include_files = Pattern( 27 src_dir='include/', includes=['*.h'], excludes=[], recursive=True) 28 29 src_files = Pattern( 30 src_dir='sources/ippcp/', 31 includes=[ 32 '*.c', 33 ], 34 excludes=[ 35 'pcparcfour*.c', 36 'pcpmain.c', 37 '*sm2.c', 38 'pcpsha1ca.c', 39 'pcpaes*.c', 40 'pcpdes*.c', 41 'pcpdlp*.c', 42 'pcphmac*.c', 43 'pcpmd5*.c', 44 'pcpng*.c', 45 'pcpprime*.c', 46 'pcprij*.c', 47 'pcprsa*.c', 48 'pcpsm3*.c', 49 'pcpsms4*.c', 50 'pcptdes*.c', 51 'pcpmont_expbinbnu_sscm.c', 52 'pcpmont_expwinbnu.c', 53 'pcpmont_expwinbnu_sscm.c', 54 ], 55 recursive=False) 56 57 env.Append(CPPPATH=[AbsDir('include/')]) 58 env.ExportCPPPATH([AbsDir('include/')]) 59 env.Append(CPPPATH=[AbsDir('sources/include/')]) 60 env.Append(CPPPATH=[AbsDir('sources/ippcp/')]) 61 62 # ipp defines 63 if env['TARGET_ARCH'] == 'x86': 64 env.Append(CPPDEFINES='_ARCH_IA32') 65 else: 66 env.Append(CPPDEFINES='_ARCH_EM64T') 67 # env.Append(CPPDEFINES = '_IPP_BE') #only for BE targets 68 env.Append(CPPDEFINES='_IPP_DEBUG') #enable function sanity checking 69 env.Append(CPPDEFINES='_IPP_C99') 70 env.Append(CPPDEFINES='_IPP_v50_') 71 env.Append(CPPDEFINES='_PX') 72 env.Append(CPPDEFINES='_ABL_') 73 74 env.Append(CPPDEFINES=['_DISABLE_ECP_SM2_']) 75 env.Append(CPPDEFINES=[ 76 '_DISABLE_ALG_SHA224_', '_DISABLE_ALG_SHA512_224_', '_DISABLE_ALG_MD5_', 77 '_DISABLE_ALG_SM3_' 78 ]) #disable unused hash algs 79 80 env.SdkInclude(include_files) 81 82 if 'use_commercial_ipp' in env['MODE']: 83 env['CCOPY_LOGIC'] = 'copy' 84 try: 85 IPPCRYPTOROOT = os.environ['IPPCRYPTOROOT'] 86 except KeyError, e: 87 env.PrintError( 88 "Necessary environment variable not set: ", e, show_stack=False) 89 if env['TARGET_PLATFORM']['OS'] == 'win32': 90 libpre = '' 91 libpost = '.lib' 92 IPP_TH_SYMBOL = 'mt' 93 else: 94 libpre = 'lib' 95 libpost = '.a' 96 IPP_TH_SYMBOL = '' 97 if env['TARGET_PLATFORM']['ARCH'] == 'x86': 98 archdir = 'ia32/' 99 else: 100 archdir = 'intel64/' 101 102 ippcp_libname = libpre + 'ippcp' + IPP_TH_SYMBOL + libpost 103 ippcp_dir = IPPCRYPTOROOT + '/lib/' + archdir 104 env.SdkLib(ippcp_dir + ippcp_libname) 105 else: 106 all_c_files = src_files.files() 107 if 'build_ipp_shared' in env['MODE']: 108 env.Append(CPPDEFINES=['IPP_W32DLL']) 109 outputs = env.SharedLibrary(ippcp_libname, all_c_files) 110 env.InstallTarget(outputs) 111 else: 112 outputs = env.Library(ippcp_libname, all_c_files) 113 env.SdkLib(outputs) 114 if 'install_lib' in env['MODE']: 115 env.InstallLib(outputs) 116