BSysProject Instance based on a Project FolderCalling 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.
# S4 method for 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).Object is an S4 object instance of class BSysProject that the code project will be based off.
The path to the root folder of the project, either relative or absolute and must be supplied.
The name given to the project and will form the basename of the shared library.
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.
The sub-path / sub-drectory of the source folder (containing .c, .cpp files) in the project.
The sub-path / sub-drectory of the include folder (containing .h, .hpp files) in the project.
The sub-path / sub-drectory of the object folder (containing the compiled .o files) in the project.
The sub-path / sub-drectory of the folder to install the compiled shared library to.
The sub-path / sub-drectory of the folder to install the shared library header files to.
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.
A string list that names the packages that this library is depenedent on (C/C++ include dependencies)
A string list that contains the include paths of external dependencies of the library code
A string list that contains preprocessor (#defines) defines required to compile the code
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.
A string list naming additional gcc flags to apply when compiling .c files
A string list naming additional gcc flags to apply when compiling .cpp files
A string list naming additional gcc flags to apply when compiling .f files
A string list naming additional gcc flags to apply when linking .o files
A string list naming additional gcc linker flags to apply when linking .o files
A string list that contains preprocessor (#defines) defines supplied when compiling the code
A Boolean that indicates whether to create a debug build
returns an S4 object instance of class BSysProject that describes the code project.
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.
make
buildMakefile
vcDebug
loadLibrary
unloadLibrary
libraryPath
sourcePath
includePath
objPath
installLibraryPath
installIncludePath
BuildSys-package