def __init__(self, module): """ Args: module : BrocModule_pb.Module object """ self._module = module self._build_mode = 'debug' # debug | release # compiler infos self._cc = 'gcc' self._cxx = 'g++' self._compiler_dir = '' # global preporcess and compile flags in one BROC file self._g_cppflags = SyntaxTag.TagCPPFLAGS() self._g_cflags = SyntaxTag.TagCFLAGS() self._g_cxxflags = SyntaxTag.TagCXXFLAGS() self._g_incpaths = SyntaxTag.TagINCLUDE() self._g_incpaths.AddV('. broc_out') self._g_linkflags = SyntaxTag.TagLDFLAGS() # for tag PUBLISH self._publish_cmd = [] self._sources = [] self._targets = []
def test_LDFlags(self): """ test Syntax.LDFlags """ #test case of debug mode Environment.SetCurrent(self._env) self._env._build_mode = 'debug' tag = Syntax.LDFlags("-lpthread -lcrypto", "-lprotobuf -lpthread") self.assertTrue("-lpthread -lcrypto" in tag.V() \ and "-lprotobuf -lpthread" not in tag.V()) #reset g_linkflags self._env._g_linkflags = SyntaxTag.TagLDFLAGS() #test case of release mode self._env._build_mode = 'release' tag = Syntax.LDFlags("-lpthread -lcrypto", "-lprotobuf -lpthread") self.assertTrue("-lprotobuf -lpthread" in tag.V() \ and "-lpthread -lcrypto" not in tag.V())