initProjectFromFolder {BuildSys}R Documentation

Initialise an S4 BSysProject Instance based on a Project Folder

Description

Calling initProjectFromFolder initialises a project specification in an S4 BSysProject object instance. That object instance can then be used to compile and debug the resulting shared library. A new BSysProject object instance can be constructed by calling new("BSysProject", ...) where the argument list (...) is the same as for initProjectFromFolder.

Usage

## S4 method for signature 'BSysProject'
initProjectFromFolder(.Object,
                      WorkingFolder = "NULL",
                      Name = "",
                      SourceFiles = "NULL",
                      SourceName = "src",
                      IncludeName = "include",
                      ObjName = "obj",
                      InstallLibraryName = as.character(NULL),
                      InstallIncludeName = as.character(NULL),
                      Flat = TRUE,
                      Packages = as.character(c()),
                      Includes = as.character(c()),
                      Defines = as.character(c()),
                      Libraries = as.character(c()),
                      CFLAGS = as.character(c()),
                      CXXFLAGS = as.character(c()),
                      FFLAGS = as.character(c()),
                      LDFLAGS = as.character(c()),
                      LDLIBS = as.character(c()),
                      DEFINES = as.character(c()),
                      Debug = TRUE)

Arguments

.Object

.Object is an S4 object instance of class BSysProject that the code project will be based off.

WorkingFolder

The path to the root folder of the project, either relative or absolute and must be supplied.

Name

The name given to the project and will form the basename of the shared library.

SourceFiles

The a list of file names in WorkingFolder that should be compiled as part of the project or NULL. If NULL then all compilable source files in WorkingFolder are included.

SourceName

The sub-path / sub-drectory of the source folder (containing .c, .cpp files) in the project.

IncludeName

The sub-path / sub-drectory of the include folder (containing .h, .hpp files) in the project.

ObjName

The sub-path / sub-drectory of the object folder (containing the compiled .o files) in the project.

InstallLibraryName

The sub-path / sub-drectory of the folder to install the compiled shared library to.

InstallIncludeName

The sub-path / sub-drectory of the folder to install the shared library header files to.

Flat

A Boolean determining if the project is assumed flat or heirarchical. If flat then all the source and include files are assumed to reside in the WorkingFolder, otherwise they are assumed to be in the sub-folders descibed by the SourceName, IncludeName and ObjName arguments.

Packages

A string list that names the packages that this library is depenedent on (C/C++ include dependencies)

Includes

A string list that contains the include paths of external dependencies of the library code

Defines

A string list that contains preprocessor (#defines) defines required to compile the code

Libraries

A string list that names the additional library dependencies needed to link the library. The format is as required by gcc. For instance, "-L/usr/local/lib -lexpat" would constitute a single item in the list.

CFLAGS

A string list naming additional gcc flags to apply when compiling .c files

CXXFLAGS

A string list naming additional gcc flags to apply when compiling .cpp files

FFLAGS

A string list naming additional gcc flags to apply when compiling .f files

LDFLAGS

A string list naming additional gcc flags to apply when linking .o files

LDLIBS

A string list naming additional gcc linker flags to apply when linking .o files

DEFINES

A string list that contains preprocessor (#defines) defines supplied when compiling the code

Debug

A Boolean that indicates whether to create a debug build

Details

initProjectFromFolder constructs a project specification by scanning the WorkingFolder and relevant sourceName sub path for source files to add to the project. If the SourceFiles is included the the source file scan is omitted and only the named source files included. The named files are assumed relative to the Working Folder so if a hierarchical project is being created then the relative path to the source folder will need to be included in the SourceFiles list. Any .c, .cpp and .f files it finds are added to the project. In the case of Fortran files the following extensions are scanned; .f, .for, .f90, .f95 and .f77. Any added files are scanned for include directives and those includes are added as project dependencies. If the dependency is not found in the path described by the includeName it is regarded as an external dependency.

If the external dependency is known (TMB.hpp for example) then the appropriate Includes, Defines and Libraries are added to the project definition. BuildSys is currently aware of TMB, Rcpp, RcppEigen and the BLAS library support in R. External dependencies not know to BuildSys need to be handle by adding the appropriate Includes, Defines and Libraries to the Project manually with the arguments provided above.

initProjectFromFolder has useful defaults meaning in most cases very few arguments need be provided. At most, the WorkingFolder and Name arguments will be required but if the project has only a single source file then even Name can be omitted as the name will be inferred from the source file name.

Value

returns an S4 object instance of class BSysProject that describes the code project.

Note

see BuildSys-package for examples of use.

Author(s)

Paavo Jumppanen [aut, cre]

Maintainer: Paavo Jumppanen <paavo.jumppanen@csiro.au>

See Also

make buildMakefile vcDebug loadLibrary unloadLibrary libraryPath sourcePath includePath objPath installLibraryPath installIncludePath BuildSys-package


[Package BuildSys version 1.1.2 Index]