void LSCompiler::initialize() { AssemblyReader::addLibraryAssemblyPath("./libs"); if (rootBuildFile.length() != 0) { rootBuildInfo = loadBuildFile(rootBuildFile); } else { rootBuildInfo = BuildInfo::createDefaultBuildFile(); } if (!rootBuildInfo) { lmLog(compilerLogGroup, "Unable to open build info file '%s'", rootBuildFile.c_str()); exit(EXIT_FAILURE); } if (rootBuildInfo->parseErrors) { lmLog(compilerLogGroup, "Please fix the following parser errors and recompile"); LSCompilerLog::dump(); exit(EXIT_FAILURE); } generateRootDependencies(); compileRootBuildDependencies(); compileAssembly(rootBuildInfo); }
void LSCompiler::generateRootDependenciesRecursive(const utString& ref) { // We're either going to be compiling against an existing loom assembly // or compiling from a build file char cref[2048]; snprintf(cref, 2048, "%s", ref.c_str()); if (strstr(cref, ".loomlib")) { *(strstr(cref, ".loomlib")) = 0; } for (UTsize i = 0; i < rootBuildDependencies.size(); i++) { BuildInfo *buildInfo = rootBuildDependencies.at(i); if (buildInfo->getAssemblyName() == cref) { return; } } // first look in the src folders for an existing build file BuildInfo *buildInfo = loadBuildFile(cref); if (buildInfo) { utString assemblyLib = buildInfo->getOutputDir() + platform_getFolderDelimiter() + buildInfo->getAssemblyName() + ".loomlib"; // If the assembly is not built yet, build it if (!platform_mapFileExists(assemblyLib.c_str())) { for (UTsize i = 0; i < buildInfo->getNumReferences(); i++) { utString rref = buildInfo->getReference(i); generateRootDependenciesRecursive(rref); } rootBuildDependencies.push_back(buildInfo); } else { rootLibDependencies.push_back(ref); } } if (rootDependencies.find(ref) == UT_NPOS) { if (!buildInfo) { // we're compiling against a .loomlib and won't be rebuilding it rootLibDependencies.push_back(ref); } rootDependencies.push_back(ref); } }
bool Animator::load(const char* fileName, const char* animFileName) { return loadBuildFile(fileName) && loadAnimFile(animFileName); }