Computer Assisted Medical Intervention Tool Kit version 6.0
 
Loading...
Searching...
No Matches
ExtensionBuilder Class Reference

Build an extension from the given CamiTK file. More...

#include <ExtensionBuilder.h>

+ Inheritance diagram for ExtensionBuilder:
+ Collaboration diagram for ExtensionBuilder:

Public Types

enum  ExtensionBuilderStage {
  Check_System , Generate_Source_Files , Configure_CMake , Build_Project ,
  Run_CamiTK_Config , Check_Integration , Cleanup
}
 Known stages that can be set in the stage configuration. More...
 

Signals

void allStagesFinished (bool status)
 sent when all the stage are finished (with the given overall status)
 
void stageFinished (const QString &stage, bool success, const QString &output)
 sent when the given stage is finished (with the given status and output)
 
void stageStarted (const QString &stage)
 sent when the given stage is starting
 

Public Member Functions

 ExtensionBuilder (const QString &camitkFilePath, QObject *parent=nullptr)
 constructor
 
QString getCurrentStage () const
 current stage
 
QString getStageName (ExtensionBuilderStage value) const
 utility method to get the QString equivalent of the given stage (underscores are replaced by space)
 
QStringList getStages () const
 get all the stages that were setup
 
void setStages (QList< ExtensionBuilderStage > stagesToPerform)
 you can override default stages by sending an non empty list of stages to perform
 
void start ()
 starts all the setup stages
 
bool success () const
 current value of the process
 
 ~ExtensionBuilder ()
 

Detailed Description

Build an extension from the given CamiTK file.

For python and C++ extensions, this class manages configuration check and source code generation stages. For C++ extensions it also manages the additional required CMake configure/build/check stages.

The following stages can be performed by calling related applications using QProcess:

  • Check_System: check that cmake, camitk-extensiongenerator and camitk-config are found and usable
  • Generate_Source_Files: calls camitk-extensiongenerator (first phase with destination dir equals to the CamiTK file path)
  • Configure_CMake: run cmake for configuration of the generated source files and creates the build directory
  • Build_Project: run "cmake --build build"
  • Run_CamiTK_Config: run "camitk-config --config", output can be check for new Standard extension
  • Check_Integration: (for Standard extension) check what is build action extensions defined in the CamiTK file were build and properly loaded by camitk-config
  • Cleanup: remove temporary directory used during the previous stages

Set the list of stages you want to perform using setStages (default is do them all) and call start(). Each stage will be performed up to the last stage or up to the first one that fails.

Connect your methods to three given signals to follow the status of each stage.

ExtensionBuilder manager(camitkFileFullPath);
// connect signals to follow progress
connect(&manager, &ExtensionBuilder::stageStarted, this, [ = ](const QString & stage) {
std::cout << "Starting stage \"" << stage << "\"..." << std::endl;
});
connect(&manager, &ExtensionBuilder::stageFinished, this, [ = ](const QString & stage, bool success, const QString & output) {
std::cout << "Stage \"" << stage << "\" finished." << std::endl;
std::cout << "Status: " << ((success) ? "[OK]" : "[FAILED]") << std::endl;
std::cout << "Output:\n" << output << std::endl;
});
connect(&manager, &ExtensionBuilder::allStagesFinished, this, [ = ](bool status) {
std::cout << "Stage \"" << stage << "\" finished." << std::endl;
std::cout << "Status: " << ((success) ? "[OK]" : "[FAILED]") << std::endl;
});
// starts the stages
manager.start();
Build an extension from the given CamiTK file.
Definition ExtensionBuilder.h:82
bool success() const
current value of the process
Definition ExtensionBuilder.cpp:112
void stageStarted(const QString &stage)
sent when the given stage is starting
void stageFinished(const QString &stage, bool success, const QString &output)
sent when the given stage is finished (with the given status and output)
void allStagesFinished(bool status)
sent when all the stage are finished (with the given overall status)
@ Generate_Source_Files
calls camitk-extensiongenerator (fist phase with destination dir equals to the CamiTK file path)
Definition ExtensionBuilder.h:90
@ Build_Project
cmake build (only for C++ extension)
Definition ExtensionBuilder.h:92
@ Configure_CMake
cmake configure (only for C++ extension)
Definition ExtensionBuilder.h:91
@ Check_System
check that camitk-extensiongenerator can be found and usable (for C++/python extensions) and that cma...
Definition ExtensionBuilder.h:89
STL namespace.

Member Enumeration Documentation

◆ ExtensionBuilderStage

Known stages that can be set in the stage configuration.

Enumerator
Check_System 

check that camitk-extensiongenerator can be found and usable (for C++/python extensions) and that cmake and camitk-config are found and usable (for C++ extension)

Generate_Source_Files 

calls camitk-extensiongenerator (fist phase with destination dir equals to the CamiTK file path)

Configure_CMake 

cmake configure (only for C++ extension)

Build_Project 

cmake build (only for C++ extension)

Run_CamiTK_Config 

check camitk-config –config (output can be check for new Standard extension) (only for C++ extension)

Check_Integration 

(for C++ Standard extension) check what is build action extensions defined in the CamiTK file were build and properly loaded by camitk-config

Cleanup 

remove temporary directory used during the previous stages (only for C++ extension)

Constructor & Destructor Documentation

◆ ExtensionBuilder()

ExtensionBuilder::ExtensionBuilder ( const QString &  camitkFilePath,
QObject *  parent = nullptr 
)

constructor

Parameters
camitkFilePaththe full path of the camitk file (with the .camitk extension)
parent(optional)

References Build_Project, Check_Integration, Check_System, Cleanup, Configure_CMake, Generate_Source_Files, CamiTKExtensionModel::load(), and Run_CamiTK_Config.

+ Here is the call graph for this function:

◆ ~ExtensionBuilder()

ExtensionBuilder::~ExtensionBuilder ( )

Member Function Documentation

◆ allStagesFinished

void ExtensionBuilder::allStagesFinished ( bool  status)
signal

sent when all the stage are finished (with the given overall status)

Referenced by ExtensionBuilderPresenter::ExtensionBuilderPresenter().

+ Here is the caller graph for this function:

◆ getCurrentStage()

QString ExtensionBuilder::getCurrentStage ( ) const

current stage

References getStageName().

+ Here is the call graph for this function:

◆ getStageName()

QString ExtensionBuilder::getStageName ( ExtensionBuilderStage  value) const

utility method to get the QString equivalent of the given stage (underscores are replaced by space)

Referenced by getCurrentStage(), and getStages().

+ Here is the caller graph for this function:

◆ getStages()

QStringList ExtensionBuilder::getStages ( ) const

get all the stages that were setup

References getStageName().

Referenced by ExtensionBuilderPresenter::ExtensionBuilderPresenter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setStages()

void ExtensionBuilder::setStages ( QList< ExtensionBuilderStage stagesToPerform)

you can override default stages by sending an non empty list of stages to perform

Referenced by ExtensionBuilderPresenter::ExtensionBuilderPresenter().

+ Here is the caller graph for this function:

◆ stageFinished

void ExtensionBuilder::stageFinished ( const QString &  stage,
bool  success,
const QString &  output 
)
signal

sent when the given stage is finished (with the given status and output)

Note
the output concatenates standard output and standard error of the subprocess in a QString of value: "Standard Output:\n%1\nStandard Error:%2\n", where %1 is the standard output and %2 is the standard error

Referenced by ExtensionBuilderPresenter::ExtensionBuilderPresenter().

+ Here is the caller graph for this function:

◆ stageStarted

void ExtensionBuilder::stageStarted ( const QString &  stage)
signal

sent when the given stage is starting

Referenced by ExtensionBuilderPresenter::ExtensionBuilderPresenter().

+ Here is the caller graph for this function:

◆ start()

void ExtensionBuilder::start ( )

starts all the setup stages

◆ success()

bool ExtensionBuilder::success ( ) const

current value of the process


The documentation for this class was generated from the following files: