Using ProjectIds and Projects

dougbinks edited this page Sep 8, 2014 · 3 revisions

Overview

Projects are an RCC++ concept which allows developers to manage multiple different compilation settings. Include directories, library directories and additional compile and link options can be specified on a per-project basis.

Projects are specified using an unsigned short project identifier, the projectId. The default projectId is 0, and all functionality defaults to this if the projectId is not passed in a function to provide backwards comparability to code built before projectIds were introduced.

ProjectIds do not need to be created - your application code should manage this, for example through an enumeration. Since RCC++ uses an array to access projects, we advise developers stick to a small contiguous range of Ids close to 0.

Setting ProjectIds

ProjectIds can be set on a per-class basis through the RCC++ csontructor:

IObjectConstructor::SetProjectId( unsigned short projectId_ )

A general use-case for projects is to use a projectId for each module, so we also provide a utility function in the per-module interface for setting all RCC++ classes to belong to a project through:

IPerModuleInterface::SetProjectIdForAllConstructors( unsigned short projectId_ )

Using ProjectIds

The following RuntimeObjectSystem functions can take a projectId to control settings for that project:

virtual void CompileAllInProject(           bool bForcerecompile_,  unsigned short projectId_ = 0 );
virtual void AddToRuntimeFileList(          const char* filename,   unsigned short projectId_ = 0 );
virtual void RemoveFromRuntimeFileList(     const char* filename,   unsigned short projectId_ = 0 );
virtual void AddIncludeDir(                 const char* path_,      unsigned short projectId_ = 0 );
virtual void AddLibraryDir(                 const char* path_,      unsigned short projectId_ = 0 );
virtual void SetAdditionalCompileOptions(   const char* options,    unsigned short projectId_ = 0 );
virtual void SetAdditionalLinkOptions(      const char* options,    unsigned short projectId_ = 0 );
virtual void SetOptimizationLevel( RCppOptimizationLevel optimizationLevel_,    unsigned short projectId_ = 0 ) = 0;
virtual RCppOptimizationLevel GetOptimizationLevel(                 unsigned short projectId_ = 0 ) = 0;