Exemplo n.º 1
0
bool RuntimeObjectSystem::Initialise( ICompilerLogger * pLogger, SystemTable* pSystemTable  )
{
	m_pCompilerLogger = pLogger;
	m_pSystemTable = pSystemTable;

	m_pBuildTool->Initialise(m_pCompilerLogger);

	// We start by using the code in the current module
	IPerModuleInterface* pPerModuleInterface = PerModuleInterface::GetInstance();
    pPerModuleInterface->SetModuleFileName( "Main Exe" );

	m_pObjectFactorySystem->SetLogger( m_pCompilerLogger );
    m_pObjectFactorySystem->SetRuntimeObjectSystem( this );

    FileSystemUtils::Path initialDir = FileSystemUtils::GetCurrentPath();
    m_FoundSourceDirectoryMappings[initialDir] = initialDir;

	SetupObjectConstructors(pPerModuleInterface);

	//add this dir to list of include dirs
	FileSystemUtils::Path includeDir = FindFile(__FILE__);
	includeDir = includeDir.ParentPath();
	AddIncludeDir(includeDir.c_str());

	//also add the runtime compiler dir to list of dirs
	includeDir = includeDir.ParentPath() / Path("RuntimeCompiler");
	AddIncludeDir(includeDir.c_str());

	return true;
}
bool RuntimeObjectSystem::Initialise( ICompilerLogger * pLogger, SystemTable* pSystemTable  )
{
	m_pCompilerLogger = pLogger;
	m_pSystemTable = pSystemTable;

	m_pBuildTool = new BuildTool();
	m_pBuildTool->Initialise(m_pCompilerLogger);

	// We start by using the code in the current module
	GETPerModuleInterface_PROC pPerModuleInterfaceProcAdd = NULL;
#ifdef _WIN32
	HMODULE module = GetModuleHandle(NULL);

	pPerModuleInterfaceProcAdd = (GETPerModuleInterface_PROC) GetProcAddress(module, "GetPerModuleInterface");
#else
    void* this_process = dlopen(NULL,0);
    pPerModuleInterfaceProcAdd = (GETPerModuleInterface_PROC) dlsym(this_process,"GetPerModuleInterface");
    
#endif

	if (!pPerModuleInterfaceProcAdd)
	{
		m_pCompilerLogger->LogError( "Failed GetProcAddress for GetPerModuleInterface in current module\n" );
		return false;
	}
       pPerModuleInterfaceProcAdd()->SetModuleFileName( "Main Exe" );
       pPerModuleInterfaceProcAdd()->SetSystemTable( m_pSystemTable );

	m_pObjectFactorySystem = new ObjectFactorySystem();
	m_pObjectFactorySystem->SetLogger( m_pCompilerLogger );

	m_pFileChangeNotifier = new FileChangeNotifier();


	SetupObjectConstructors(pPerModuleInterfaceProcAdd);

	//add this dir to list of include dirs
	FileSystemUtils::Path includeDir( __FILE__ );
	includeDir = includeDir.ParentPath();
	AddIncludeDir(includeDir.c_str());

	//also add the runtime compiler dir to list of dirs
	includeDir = includeDir.ParentPath() / Path("RuntimeCompiler");
	AddIncludeDir(includeDir.c_str());



	return true;
}
void RuntimeObjectSystem::AddLibraryDir( const char *path_ )
{
	m_LibraryDirList.push_back(Path(path_));
}
void RuntimeObjectSystem::AddIncludeDir( const char *path_ )
{
	m_IncludeDirList.push_back(Path(path_));
}