Framewave Build System

 

New Platform Setup

HOWTO

 

Prerequisite Documents

 

Framewave Build System - Architecture.doc

Framewave Build System - Compiler Flags Setup.doc

 

 

Introduction

 

To setup a new platform (platform meaning either a new compiler and operating system combo or just one of the two), these are the basic steps that need to be followed;

 

·         Establish a name for this toolset and add the build factor shortcut (not required if setting up an existing compiler)

·         Create a flags file for the compiler (not required if setting up an existing compiler)

·         Add code to fwflags.py to load the correct compiler based on our toolset

·         Add code to the fwbuild.py file to setup the correct default toolset (not required if setting up on an existing operating system)

·         Add the needed flags

 

 

Description

 

Establish and setup a name:

 

The name of the toolset should be a unique string that indicates typically the name of the compiler. Next the shortcut should be a three character abbreviation which needs to be setup in the fwflagsbase.py file:

gcc = 'gcc'

msv = 'msvc'

scc = 'suncc'

 

 

Create flags file:

 

Technically the name of the flags file can be anything, but conventionally we have named the files fwflags_[toolsetname].py (ie. fwflags_msvc.py). This file needs to exist in the /BuildTools/buildscripts/ directory. To simplify development, copy the code from an existing flags file and strip out the flags.

 

This file needs to contain two dictionaries and one class. The dictionaries are;

 

dctCCFlags: This contains our CC flags

dctLDFlags: This contains our link flags

 

The class needs to inherit from fwFlagsBase and the name of the class should be,

fwFlags_[toolsetname]

( ie. class fwFlags_msvc(fwFlagsBase) )

 

Again, the naming convention is not required but it’s a rule used throughout the Framewave build scripts. Copy the code from one of the existing classes from another flags files identically. The class code will not change between flags files.

 

class fwFlags_[toolsetname] (fwFlagsBase):

    def __init__ (self, oEnv, lstBuildFactors, sObjectType):

        # Call constructor for base class

        fwFlagsBase.__init__(self, oEnv)

       

        # Select flags to setup based on what kind of

        # build object are we setting up flags for

        if sObjectType=='library':

            self.lstLDFlags = self.determineFlags(lstBuildFactors, dctLDFlags)

            self.lstLDFlags = self.translateFlags(self.lstLDFlags)

        else:

            self.lstCCFlags = self.determineFlags(lstBuildFactors, dctCCFlags)

            self.lstCCFlags = self.translateFlags(self.lstCCFlags)

 

        self.applyFlags()

 

 

Changes to fwflags.py:

 

In the constructor for the fwFlags class, we need to check if our toolset name exists in the build factors sent in to us. If it does, we need to import our flags class from the correct flags file. After that we need to instantiate an object of that flags class and set our flags member variable to that object.

Example:

        if 'msvc'   in lstBuildFactors:

            from fwflags_msvc import fwFlags_msvc

            self.flags = fwFlags_msvc  (oEnv, lstBuildFactors, sObjectType)

 

 

Changes to fwbuild.py:

 

In the constructor for the fwBuildRoot class, there is code that checks if our toolset is “---”. This is a canary value indicating that the user did not specify a toolset. The code then checks which operating system we are running on and sets the respective toolset.

 

If a new operating system is added, extra code needs to be added to detect the operating system, and to set the toolset to whichever compiler we wish to be using by default on that operating system.

if   sys.platform=='win32':

                self.dctFwVars['toolset'] = 'msvc'



Adding flags:

 

Flags can be added into the flags file now. This is the final step. To see how flags are used, please look at the “Framewave Build System - Compiler Flags Setup” document.