#!/usr/bin/python3 import os,sys,subprocess,math from complib2 import * import shutil from shutil import copytree as copytree libname = 'assetcuda.msvc64' #prefix static library name to generate targetname = 'main' #create this executable when compiling tests commonincdir = "../../winx64/include" commonlibdir = "../../winx64/lib" localbindir = "./bin_winx64" cc = 'nvcc' #compiler srcexts = ['.c','.cpp'] mainsrc = ['main.c','main.cpp','main.cu'] #ignore these files when compiling the static library kwargs = dict() include = "-I./include -I{}".format(commonincdir) kwargs['include'] = include kwargs['flags'] = "/O2" kwargs['libdir'] = "/LIBPATH:{} /LIBPATH:{}".format(localbindir,commonlibdir) kwargs['libflags'] = "-l{}".format(libname) kwargs['linkerflags'] = "" 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,'.obj') objfiles_sss = list_to_sss(objfiles) #compile all the source files in the list msvc_compile_list(cc,files,**kwargs) #gs_compile_list(cc,files,**kwargs) #archive all the source files into a static library #ar_list(objfiles,'{}/lib{}.a'.format(localbindir,libname)) msvc_lib_list(objfiles,'{}/lib{}.lib'.format(localbindir,libname)) #Push any libraries to the common lib folder shutil.copy('{}/lib{}.lib'.format(localbindir,libname),commonlibdir) #Copy include files to the common include folder copytree('./include/',commonincdir+'/',dirs_exist_ok=True)