backup
This commit is contained in:
67
build/make.linux64.so.py
Normal file
67
build/make.linux64.so.py
Normal file
@ -0,0 +1,67 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import os,sys,math
|
||||
import subprocess
|
||||
import shutil
|
||||
from shutil import copytree
|
||||
|
||||
from amsbuildlib4 import *
|
||||
|
||||
libname = "amscimglib4.linux64" #static library name to generate
|
||||
binname = "tests" #create this executable when compiling main.c or main.cpp
|
||||
commondir = "../../linux64" #common directory to pul libraries and includes from
|
||||
depdir = "./dependencies/linux64" #local pre-compiled dependency libraries and their includes
|
||||
installdir = "../../linux64" #directory to install to when finished
|
||||
builddir = "./build_linux64"
|
||||
|
||||
doinstall = True #copies the build_output to the install dir when finished
|
||||
cc = "gcc" #compiler
|
||||
cflags = "-fPIC -O3 -DEXPORT_TEMPLATEDLL"
|
||||
libraries = "-l{}".format(libname)
|
||||
libdirs = "-L{} -L{}/lib -L{}/lib".format(builddir,commondir,depdir)
|
||||
linkerflags = "-shared -Wl,-rpath=. -Wl,--out-implib={}/lib{}.a".format(builddir,libname)
|
||||
srcexts = [".c",".cpp"]
|
||||
binsrc = ["main.c","main.cpp"] #ignore these files when compiling the static library
|
||||
|
||||
#keyword list to control the compilers/linkers
|
||||
kwargs = dict()
|
||||
include = "-I./include -I{}/include -I{}/include".format(commondir, depdir)
|
||||
kwargs["include"] = include
|
||||
kwargs["flags"] = cflags
|
||||
kwargs["libdir"] = libdirs
|
||||
kwargs["libflags"] = libraries
|
||||
kwargs["linkerflags"] = linkerflags
|
||||
kwargs["recurse"] = True
|
||||
kwargs["objstore"] = "{}/objstore".format(builddir)
|
||||
kwargs["searchincdirs"] = "./include"
|
||||
|
||||
#Find all source files, except the main project files
|
||||
srcfiles = flist('./src',exts = srcexts, recurse=True)
|
||||
srcfiles = except_contains(srcfiles,binsrc)
|
||||
|
||||
#compile all the source files in the list
|
||||
#gs_compile_list(cc,files,**kwargs)
|
||||
gs_incremental_compile_list(cc,srcfiles,**kwargs)
|
||||
|
||||
#Link the resulting object files and compile to a dynamic link library
|
||||
objlist = flist(kwargs['objstore'],exts='.o',recurse=True)
|
||||
sobjlist = list_to_sss(objlist)
|
||||
gs_link_list(cc,sobjlist,"{}/lib{}.so".format(builddir,libname),**kwargs)
|
||||
|
||||
#Strip - call the strip command to remove exposed symbols in the dll
|
||||
callproc("strip --strip-all --discard-all {}/lib{}.so".format(builddir,libname))
|
||||
|
||||
if(doinstall):
|
||||
#Push any libraries to the common lib folder
|
||||
shutil.copy(
|
||||
'{}/lib{}.a'.format(builddir,libname),
|
||||
"{}/lib".format(installdir)
|
||||
)
|
||||
|
||||
shutil.copy(
|
||||
'{}/lib{}.so'.format(builddir,libname),
|
||||
"{}/lib".format(installdir)
|
||||
)
|
||||
|
||||
#Copy include files to the common include folder
|
||||
copytree('./include/',installdir+'/include/',dirs_exist_ok=True)
|
Reference in New Issue
Block a user