1. A computer-implemented method for generating code based on a graphical model, the method comprising: translating, using at least one processor, the graphical model into a graphical model code, the graphical model code compiled into an executable program and including a first graphical model code function, the first graphical model code function being a member of a group of graphical model code functions; receiving a selection of a first hardware specific library from a plurality of hardware specific libraries, the hardware specific libraries corresponding to one of a first target environment and a second target environment, the first hardware specific library corresponding to the first target environment; the hardware specific libraries comprising a plurality of relationships between the group of graphical model code functions and hardware specific functions, the hardware specific functions being compilable into object code for execution in the first target environment, and performing a lookup of the first graphical model code function in the first hardware specific library; obtaining a matched hardware specific function based on the lookup, the matched hardware specific function matching at least one property of the graphical model code function and being one of the hardware specific functions from the first hardware specific library; and modifying the graphical model code based on the matched hardware specific function.