def LinkArchive(name,objectfiles): """ Links an archive :param: name name of the binary with out prefix or suffix. :param: objectfiles object files that is linked :return: target name """ target = plumbing.target( plumbing.archive_name_path( name), name) return plumbing.link( platform().link_archive, target, objectfiles, [])
def Compile( sourcefile, objectfile = None, directive = ''): """ Compiles a source file to an object file, with excplicit directives :param sourcefile: name of the sourcefile (src/myfile.cpp) :param objectfile: optional name of the output object file (obj/myfile.o) :param directive: optional compile directive for this TU, default '' :return: the target (which contains the name of the objectfile) """ if not objectfile: objectfile = platform().default_object_name( sourcefile) target = plumbing.target( plumbing.normalize_path( objectfile), objectfile, 'target_' + plumbing.normalize_string( objectfile)) target.source = plumbing.normalize_path( sourcefile); object_directory = os.path.dirname( target.file) dependency_file = plumbing.dependency_file_name( target.file) cross_object_file = plumbing.cross_object_name( target.file) print "#" print "# compiling {0} to {1}".format( sourcefile, objectfile) print print "-include " + dependency_file print print 'compile: ' + target.name print print target.name + ': ' + target.file print print target.file + ": " + target.source + ' | ' + object_directory print '\t' + platform().compile( target.source, target.file, directive) print '\t' + platform().header_dependency( target.source, [ cross_object_file, target.file], dependency_file) print print 'cross: ' + cross_object_file print print cross_object_file + ": " + target.source + ' | ' + object_directory print '\t' + platform().cross_compile( target.source, cross_object_file, directive) print '\t' + platform().header_dependency( target.source, [ cross_object_file, target.file], dependency_file) print plumbing.register_object_path_for_clean( object_directory) plumbing.register_path_for_create( object_directory) return target
def LinkLibrary(output,objectfiles,libs = []): """ Links a shared library :param name name of the binary with out prefix or suffix. :param objectfiles object files that is linked :param libs dependent libraries :return: target name """ target = plumbing.target( output, output, operation = plumbing.shared_library_name_path) plumbing.link( platform().link_library, target, objectfiles, libs) plumbing.deploy( target, 'lib') return target
def LinkExecutable( name, objectfiles, libraries = []): """ Links an executable :param name name of the binary with out prefix or suffix. :param objectfiles object files that is linked :param libs dependent libraries :return: target name """ target = plumbing.target( plumbing.executable_name_path( name), name) plumbing.link( platform().link_executable, target, objectfiles, libraries) plumbing.deploy( target, 'exe') return target;
def LinkUnittest(name,objectfiles,libraries = [], test_target = True): """ LinkIsolatedUnittest(name,objectfiles,libs) :param: name name of the unittest executable :param: objectfiles object files that is linked :param: libraries dependent libraries (optional) :param: tets_target if true, a test target is generated. (True is the default) """ target = plumbing.target( plumbing.executable_name_path( name)) # # We add the unittest lib for the user... # plumbing.link( platform().link_executable, target, objectfiles, libraries + platform().unittest_libraries) plumbing.deploy( target, 'client') if test_target: plumbing.set_ld_path() print "test: " + 'test_' + target.name print print 'test_' + target.name + ": " + target.name print "\t @LD_LIBRARY_PATH=$(LOCAL_LD_LIBRARY_PATH) $(PRE_UNITTEST_DIRECTIVE) " + target.file + " $(ISOLATED_UNITTEST_DIRECTIVES)" print return target