#!/usr/bin/python3 import os,sys,subprocess,math from complib2 import * import shutil from distutils.dir_util import copy_tree as copy_tree #this version does overwrites libname = 'amsclil1.linux64' #prefix static library name to generate targetname = 'tests' #create this executable when compiling tests commonincdir = "../../linux64/include" commonlibdir = "../../linux64/lib" localbindir = "./bin_linux64" cc = 'gcc' #compiler srcexts = ['.c','.cpp'] mainsrc = ['main.c'] #ignore these files when compiling the static library kwargs = dict() include = "-I./include -I{}".format(commonincdir) kwargs['include'] = include kwargs['flags'] = "-O3" #-fPIC kwargs['libdir'] = "-L{} -L{}".format(localbindir,commonlibdir) kwargs['libflags'] = "-lamscutil1.linux64 -l{}".format(libname) kwargs['linkerflags'] = "-Wl,-rpath=." kwargs['recurse'] = True #Pull required binary dynamic libraries to the bin folder #shutil.copy('{}/libamsimg.dll.a'.format(commonlibdir),localbindir); #shutil.copy('{}/libamsimg.dll'.format(commonlibdir),localbindir); #shutil.copy('../../lib_winx64/glew32.dll','./bin_winx64'); #Designate source files for main test program fsrc = ['./src/main.c'] fobj = replaceexts(fsrc,'.o') #Compile test programs gs_compile_list(cc,fsrc,**kwargs) gs_link_list(cc,list_to_sss(fobj),'{}/{}'.format(localbindir,targetname),**kwargs)