Commit d78145bf authored by BRAMAS Berenger's avatar BRAMAS Berenger

Add a show compile to all exec (but we need to update the cmake)

parent 9e880dbf
......@@ -102,4 +102,11 @@
#include <string>
const std::string SCALFMMDataPath("@CMAKE_SOURCE_DIR@/Data/");
///////////////////////////////////////////////////////
// Flags and libs used to compile
///////////////////////////////////////////////////////
const std::string SCALFMMCompileFlags("@CMAKE_COMPILE_FLAGS@");
const std::string SCALFMMCompileLibs("@CMAKE_COMPILE_LIBS@");
#endif // CONFIG_H
......@@ -45,6 +45,11 @@ static const FParameterNames Help = {
"To have print the options used by the application."
};
static const FParameterNames Compile = {
{"-show-compile", "--show-compile", "--flags"} ,
"To have the list of flags and lib linked to scalfmm."
};
static const FParameterNames NbParticles = {
{"-nb", "--number-of-particles", "-N"} ,
"The number of particles if they are generated by the executable."
......@@ -178,12 +183,23 @@ inline void PrintUsedOptions(const std::vector<FParameterNames>& options){
}
}
inline void PrintFlags(){
std::cout << "This executable has been compiled with:\n";
std::cout << "Flags = " << SCALFMMCompileFlags << "\n";
std::cout << "Libs = " << SCALFMMCompileLibs << "\n";
std::cout.flush();
}
}// End of namespace
/** This should be include at the beginin of all main file
* @code FHelpAndExit(argc, argv, FParameterDefinitions::NbParticles, FParameterNames OctreeSubHeight );
*/
#define FHelpAndExit(argc, argv, ...) \
if(FParameters::existParameter(argc, argv, FParameterDefinitions::Compile.options)) {\
FParameterDefinitions::PrintFlags();\
return 0;\
} \
if(FParameters::existParameter(argc, argv, FParameterDefinitions::Help.options)) {\
const std::vector<FParameterNames> optionsvec = {__VA_ARGS__};\
FParameterDefinitions::PrintUsedOptions(optionsvec);\
......@@ -196,6 +212,10 @@ inline void PrintUsedOptions(const std::vector<FParameterNames>& options){
* @code FParameterDefinitions::NbParticles, FParameterNames OctreeSubHeight );
*/
#define FHelpDescribeAndExit(argc, argv, description, ...) \
if(FParameters::existParameter(argc, argv, FParameterDefinitions::Compile.options)) {\
FParameterDefinitions::PrintFlags();\
return 0;\
} \
if(FParameters::existParameter(argc, argv, FParameterDefinitions::Help.options)) {\
std::cout << argv[0] << " : " << description << "\n"; \
const std::vector<FParameterNames> optionsvec = {__VA_ARGS__};\
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment