 
   componentGen = componentLibDefinitions componentLib, 'createComponent'
   files = {}
+  files[outputDir + "/componentlib-ports.h"] = componentGen.ports
   files[outputDir + "/componentlib-ids.h"] = componentGen.ids
-  files[outputDir + "/componentlib-ports.h"] = componentGen.ports
+  files[outputDir + "/componentlib-factory.hpp"] = componentGen.factory
   files[outputDir + "/componentlib-map.json"] = componentGen.map
-  files[outputDir + "/componentlib.hpp"] = componentGen.all
+
+  lib = componentGen.components + '\n' + componentGen.ids + componentGen.factory 
+  files[outputDir + "/componentlib.hpp"] = lib
 
   graphData = commandstream.cmdStreamFromGraph(componentLib, graph, null, true)
   graphMaps = generateGraphMaps componentLib, graph

  files[outputBase + "_maps.h"] = graphMaps

  includes = "// !!! generated by: microflo generate\n"
  includes += cmdStreamToCDefinition(graphData, target) + '\n'
  includes += "#define MICROFLO_EMBED_GRAPH 1" + '\n'

  includes += include(path.join(microfloDir, 'microflo.h')) + '\n'

  if enableMaps
    includes += "// Graph metadata\n" 
    includes += graphMaps + "\n"

  includes += include(mainFile) + '\n'
  includes += include('./componentlib.hpp') + '\n'

  files[outputFile] = includes


  map[key].id

componentLibDefinitions = (componentLib, factoryMethodName) ->
  r =
    ids: generateConstInt("Id", componentLib.getComponents(true, true))
    ports: generateComponentPortDefinitions(componentLib)
    components: generateComponentIncludes(componentLib)
    factory: generateComponentFactory(componentLib, factoryMethodName)
    map: generateComponentMap componentLib
  return r

getDefinitions = (baseDir) ->
