You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
#!/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"
|
|
kwargs['libdir'] = "-L{} -L{}".format(localbindir,commonlibdir)
|
|
kwargs['libflags'] = "-l{}".format(libname)
|
|
kwargs['linkerflags'] = "-Wl,-rpath=."
|
|
kwargs['recurse'] = True
|
|
|
|
#find all source files, except the main project files
|
|
files = flist('./src',exts = srcexts, recurse=True)
|
|
files = except_contains(files,mainsrc)
|
|
objfiles = replaceexts(files,'.o')
|
|
objfiles_sss = list_to_sss(objfiles)
|
|
|
|
#compile all the source files in the list
|
|
gs_compile_list(cc,files,**kwargs)
|
|
|
|
#archive all the source files into a static library
|
|
ar_list(objfiles,'{}/lib{}.a'.format(localbindir,libname))
|
|
|
|
#Push any libraries to the common lib folder
|
|
shutil.copy('{}/lib{}.a'.format(localbindir,libname),commonlibdir)
|
|
|
|
#Copy include files to the common include folder
|
|
copy_tree('./include/',commonincdir+'/')
|