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.
50 lines
1.8 KiB
Python
50 lines
1.8 KiB
Python
#!/usr/bin/python3
|
|
|
|
import os,sys,math
|
|
import subprocess
|
|
import shutil
|
|
from shutil import copytree
|
|
|
|
from amsbuildlib4 import *
|
|
|
|
libname = "amscimglib4.mingw64" #static library name to generate
|
|
binname = "tests" #create this executable when compiling main.c or main.cpp
|
|
commondir = "../../winx64" #common directory to pul libraries and includes from
|
|
depdir = "./dependencies/winx64" #local pre-compiled dependency libraries and their includes
|
|
installdir = "../../winx64" #directory to install to when finished
|
|
builddir = "./build_mingw64"
|
|
|
|
doinstall = False #copies the build_output to the install dir when finished
|
|
cc = "x86_64-w64-mingw32-gcc" #compiler
|
|
cflags = "-fPIC -O3"
|
|
libraries = "-l{}".format(libname)
|
|
libdirs = "-L{} -L{}/lib -L{}/lib".format(builddir,commondir,depdir)
|
|
linkerflags = "-static -static-libgcc -Wl,-rpath=."
|
|
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"
|
|
|
|
#Pull required binary dynamic libraries to the bin folder
|
|
#shutil.copy('{}/lib/libcamsimg3.linux64.so'.format(commondir),builddir);
|
|
#shutil.copy('{}/lib/libamsimg.dll'.format(commondir),builddir);
|
|
#shutil.copy('{}/lib/glew32.dll','./bin_winx64');
|
|
|
|
#Designate source files for main test program
|
|
fsrc = ['./src/main.cpp']
|
|
fobj = replaceexts(fsrc,'.o')
|
|
|
|
#Compile test programs
|
|
gs_compile_list(cc,fsrc,**kwargs)
|
|
gs_link_list(cc,list_to_sss(fobj),'{}/{}'.format(builddir,binname),**kwargs)
|