Search in sources :

Example 1 with CCompiler

use of org.lflang.generator.c.CCompiler in project lingua-franca by lf-lang.

the class FedCLauncher method compileCommandForFederate.

/**
 * Return the compile command for a federate.
 *
 * @param federate The federate to compile.
 * @throws IOException
 */
@Override
protected String compileCommandForFederate(FederateInstance federate) {
    FedFileConfig fedFileConfig = null;
    TargetConfig localTargetConfig = targetConfig;
    try {
        fedFileConfig = new FedFileConfig(fileConfig, federate.name);
    } catch (IOException e) {
        errorReporter.reportError("Failed to create file config for federate " + federate.name);
        return "";
    }
    String commandToReturn = "";
    // FIXME: Hack to add platform support only for linux systems.
    // We need to fix the CMake build command for remote federates.
    String linuxPlatformSupport = "core" + File.separator + "platform" + File.separator + "lf_linux_support.c";
    if (!localTargetConfig.compileAdditionalSources.contains(linuxPlatformSupport)) {
        localTargetConfig.compileAdditionalSources.add(linuxPlatformSupport);
    }
    CCompiler cCompiler = new CCompiler(localTargetConfig, fedFileConfig, errorReporter);
    commandToReturn = String.join(" ", cCompiler.compileCCommand(fileConfig.name + "_" + federate.name, false).toString());
    return commandToReturn;
}
Also used : CCompiler(org.lflang.generator.c.CCompiler) IOException(java.io.IOException) FedFileConfig(org.lflang.federated.FedFileConfig) TargetConfig(org.lflang.TargetConfig)

Aggregations

IOException (java.io.IOException)1 TargetConfig (org.lflang.TargetConfig)1 FedFileConfig (org.lflang.federated.FedFileConfig)1 CCompiler (org.lflang.generator.c.CCompiler)1