OpenASIP
2.0
|
#include <CompiledSimCompiler.hh>
Public Member Functions | |
CompiledSimCompiler () | |
virtual | ~CompiledSimCompiler () |
int | compileDirectory (const std::string &dirName, const std::string &flags="", bool verbose=false) const |
int | compileFile (const std::string &path, const std::string &flags="", const std::string &outputExtension=".o", bool verbose=false) const |
int | compileToSO (const std::string &path, const std::string &flags="", bool verbose=false) const |
Static Public Attributes | |
static const char * | COMPILED_SIM_CPP_FLAGS |
cpp flags used for compiled simulation More... | |
static const char * | COMPILED_SIM_SO_FLAGS = " -shared -fpic " |
flags used when compiling .so files More... | |
Private Member Functions | |
CompiledSimCompiler (const CompiledSimCompiler &) | |
Copying not allowed. More... | |
CompiledSimCompiler & | operator= (const CompiledSimCompiler &) |
Assignment not allowed. More... | |
Private Attributes | |
int | threadCount_ |
Number of threads to use while compiling through a Makefile. More... | |
std::string | compiler_ |
The compiler to use. More... | |
std::string | globalCompileFlags_ |
Global compile flags (from env variable) More... | |
A class for compiling the dynamic libraries used by the compiled simulator
Definition at line 41 of file CompiledSimCompiler.hh.
CompiledSimCompiler::CompiledSimCompiler | ( | ) |
The constructor
Definition at line 79 of file CompiledSimCompiler.cc.
References compiler_, Environment::environmentVariable(), globalCompileFlags_, threadCount_, and Conversion::toInt().
|
virtual |
|
private |
Copying not allowed.
int CompiledSimCompiler::compileDirectory | ( | const std::string & | dirName, |
const std::string & | flags = "" , |
||
bool | verbose = false |
||
) | const |
Compiles a directory with given flags using a pre-generated makefile
In case environment variable TTASIM_COMPILER is set, it is used to compile the simulation code, otherwise 'gcc' is used. The count of compiler threads is read from TTASIM_COMPILER_THREADS, and defaults to 3.
dirName | a source directory containing the .cpp files and the Makefile |
flags | additional compile flags given by the user. for instance, "-O3" |
verbose | Print information of the compilation progress. |
Definition at line 125 of file CompiledSimCompiler.cc.
References compiler_, globalCompileFlags_, Application::logStream(), threadCount_, and Conversion::toString().
Referenced by CompiledSimController::reset().
int CompiledSimCompiler::compileFile | ( | const std::string & | path, |
const std::string & | flags = "" , |
||
const std::string & | outputExtension = ".o" , |
||
bool | verbose = false |
||
) | const |
Compiles a single C++ file using the set flags
path | Path to the file |
flags | custom flags to be used for compiling |
outputExtension | extension to append to the filename. default is ".o" |
verbose | Print information of the compilation progress. |
Definition at line 168 of file CompiledSimCompiler.cc.
References COMPILED_SIM_CPP_FLAGS, compiler_, FileSystem::DIRECTORY_SEPARATOR, FileSystem::directoryOfPath(), DS, FileSystem::fileNameBody(), FileSystem::fileOfPath(), globalCompileFlags_, Environment::includeDirPaths(), and Application::logStream().
Referenced by compileToSO(), and CompiledSimController::reset().
int CompiledSimCompiler::compileToSO | ( | const std::string & | path, |
const std::string & | flags = "" , |
||
bool | verbose = false |
||
) | const |
Compiles a single C++ file to a shared library (.so)
Used for generating .so files in dynamic compiled simulation
path | Path to the file |
flags | custom flags to be used for compiling |
verbose | Print information of the compilation progress. |
Definition at line 210 of file CompiledSimCompiler.cc.
References COMPILED_SIM_SO_FLAGS, and compileFile().
Referenced by CompiledSimulation::compileAndLoadFunction(), and CompiledSimController::reset().
|
private |
Assignment not allowed.
|
static |
cpp flags used for compiled simulation
Definition at line 63 of file CompiledSimCompiler.hh.
Referenced by compileFile(), and CompiledSimCodeGenerator::generateMakefile().
|
static |
flags used when compiling .so files
Definition at line 66 of file CompiledSimCompiler.hh.
Referenced by compileToSO(), and CompiledSimCodeGenerator::generateMakefile().
|
private |
The compiler to use.
Definition at line 77 of file CompiledSimCompiler.hh.
Referenced by compileDirectory(), CompiledSimCompiler(), and compileFile().
|
private |
Global compile flags (from env variable)
Definition at line 79 of file CompiledSimCompiler.hh.
Referenced by compileDirectory(), CompiledSimCompiler(), and compileFile().
|
private |
Number of threads to use while compiling through a Makefile.
Definition at line 75 of file CompiledSimCompiler.hh.
Referenced by compileDirectory(), and CompiledSimCompiler().