diff --git a/Src/ScalFmmConfig.h.cmake b/Src/ScalFmmConfig.h.cmake index 93782236564d5da6862a17b78007b8f18a3529bf..60c4df12a97bf56a97d5017e903428fec2050c14 100755 --- a/Src/ScalFmmConfig.h.cmake +++ b/Src/ScalFmmConfig.h.cmake @@ -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 diff --git a/Src/Utils/FParameterNames.hpp b/Src/Utils/FParameterNames.hpp index 44efed19868d310ecd1ca5eeab4553057281808d..ea9c85b483feb67cdad2bb084ec5122dca276e1a 100644 --- a/Src/Utils/FParameterNames.hpp +++ b/Src/Utils/FParameterNames.hpp @@ -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__};\