mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2025-04-11 03:20:46 +01:00
CMake first working compilation for library
This commit is contained in:
parent
0b5c6e851c
commit
4419139bd1
@ -3,7 +3,7 @@ project(
|
|||||||
LatAnalyze
|
LatAnalyze
|
||||||
VERSION 3.6
|
VERSION 3.6
|
||||||
LANGUAGES C CXX)
|
LANGUAGES C CXX)
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
include(FindPackageMessage)
|
include(FindPackageMessage)
|
||||||
|
@ -1,33 +1,37 @@
|
|||||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
|
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
|
||||||
|
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
|
||||||
|
|
||||||
include(FindBISON)
|
include(FindBISON)
|
||||||
include(FindFLEX)
|
include(FindFLEX)
|
||||||
find_package(BISON REQUIRED)
|
find_package(BISON REQUIRED)
|
||||||
find_package(FLEX REQUIRED)
|
find_package(FLEX REQUIRED)
|
||||||
|
|
||||||
bison_target(AsciiParser LatAnalyze/Io/AsciiParser.ypp
|
bison_target(
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/AsciiParser.cpp
|
AsciiParser LatAnalyze/Io/AsciiParser.ypp
|
||||||
COMPILE_FLAGS "-Wno-deprecated")
|
${CMAKE_CURRENT_BINARY_DIR}/AsciiParser.cpp COMPILE_FLAGS "-Wno-deprecated")
|
||||||
flex_target(AsciiLexer LatAnalyze/Io/AsciiLexer.lpp
|
flex_target(AsciiLexer LatAnalyze/Io/AsciiLexer.lpp
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/AsciiLexer.cpp)
|
${CMAKE_CURRENT_BINARY_DIR}/AsciiLexer.cpp)
|
||||||
add_flex_bison_dependency(AsciiLexer AsciiParser)
|
add_flex_bison_dependency(AsciiLexer AsciiParser)
|
||||||
|
|
||||||
bison_target(MathParser LatAnalyze/Core/MathParser.ypp
|
bison_target(
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/MathParser.cpp
|
MathParser LatAnalyze/Core/MathParser.ypp
|
||||||
COMPILE_FLAGS "-Wno-deprecated")
|
${CMAKE_CURRENT_BINARY_DIR}/MathParser.cpp COMPILE_FLAGS "-Wno-deprecated")
|
||||||
flex_target(MathLexer LatAnalyze/Core/MathLexer.lpp
|
flex_target(MathLexer LatAnalyze/Core/MathLexer.lpp
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/MathLexer.cpp)
|
${CMAKE_CURRENT_BINARY_DIR}/MathLexer.cpp)
|
||||||
add_flex_bison_dependency(MathLexer MathParser)
|
add_flex_bison_dependency(MathLexer MathParser)
|
||||||
|
|
||||||
add_library(LatAnalyze SHARED)
|
add_library(LatAnalyze SHARED)
|
||||||
file(GLOB_RECURSE EIGEN_HEADERS Eigen/*)
|
file(GLOB_RECURSE EIGEN_HEADERS Eigen/*)
|
||||||
|
target_include_directories(LatAnalyze PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
target_sources(
|
target_sources(
|
||||||
LatAnalyze
|
LatAnalyze
|
||||||
PRIVATE ${BISON_AsciiParser_OUTPUTS}
|
PRIVATE ${BISON_AsciiParser_OUTPUTS}
|
||||||
${FLEX_AsciiLexer_OUTPUTS}
|
${FLEX_AsciiLexer_OUTPUTS}
|
||||||
${BISON_MathParser_OUTPUTS}
|
${BISON_MathParser_OUTPUTS}
|
||||||
${FLEX_MathLexer_OUTPUTS}
|
${FLEX_MathLexer_OUTPUTS}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/config.h
|
||||||
LatAnalyze/Core/Exceptions.cpp
|
LatAnalyze/Core/Exceptions.cpp
|
||||||
LatAnalyze/Core/Mat.cpp
|
LatAnalyze/Core/Mat.cpp
|
||||||
LatAnalyze/Core/Math.cpp
|
LatAnalyze/Core/Math.cpp
|
||||||
@ -128,4 +132,5 @@ target_sources(
|
|||||||
LatAnalyze/Statistics/XYSampleData.hpp
|
LatAnalyze/Statistics/XYSampleData.hpp
|
||||||
LatAnalyze/Statistics/XYStatData.hpp
|
LatAnalyze/Statistics/XYStatData.hpp
|
||||||
LatAnalyze/includes.hpp)
|
LatAnalyze/includes.hpp)
|
||||||
target_link_libraries(LatAnalyze PUBLIC GSL::gsl HDF5 Minuit2 NLopt)
|
target_link_libraries(LatAnalyze PUBLIC GSL::gsl hdf5::hdf5 hdf5::hdf5_cpp
|
||||||
|
Minuit2::Minuit2 NLopt::nlopt)
|
||||||
|
@ -72,7 +72,7 @@ string PlotObject::dumpToTmpFile(const DMat &m)
|
|||||||
for (Index j = 0; j < m.cols(); ++j)
|
for (Index j = 0; j < m.cols(); ++j)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
sprintf(tmpFileName, "%s/latan_plot_tmp.XXXXXX.dat", P_tmpdir);
|
snprintf(tmpFileName, sizeof(tmpFileName), "%s/latan_plot_tmp.XXXXXX.dat", P_tmpdir);
|
||||||
fd = mkstemps(tmpFileName, 4);
|
fd = mkstemps(tmpFileName, 4);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
@ -699,7 +699,7 @@ Plot & Plot::operator<<(PlotModifier &&modifier)
|
|||||||
|
|
||||||
// find gnuplot ////////////////////////////////////////////////////////////////
|
// find gnuplot ////////////////////////////////////////////////////////////////
|
||||||
#define SEARCH_DIR(dir) \
|
#define SEARCH_DIR(dir) \
|
||||||
sprintf(buf, "%s/%s", dir, gnuplotBin_.c_str());\
|
snprintf(buf, sizeof(buf), "%s/%s", dir, gnuplotBin_.c_str());\
|
||||||
if (access(buf, X_OK) == 0)\
|
if (access(buf, X_OK) == 0)\
|
||||||
{\
|
{\
|
||||||
return dir;\
|
return dir;\
|
||||||
|
@ -25,11 +25,10 @@ using namespace Latan;
|
|||||||
|
|
||||||
PlaceHolder Latan::_;
|
PlaceHolder Latan::_;
|
||||||
|
|
||||||
const string Env::fullName = PACKAGE_STRING;
|
const string Env::fullName = strFrom(PROJECT_NAME) + " v" + strFrom(PROJECT_VERSION);
|
||||||
const string Env::name = PACKAGE_NAME;
|
const string Env::name = PROJECT_NAME;
|
||||||
const string Env::version = PACKAGE_VERSION;
|
const string Env::version = PROJECT_VERSION;
|
||||||
const string Env::msgPrefix = "[" + strFrom(PACKAGE_NAME) + " v"
|
const string Env::msgPrefix = "[" + Env::fullName + "] ";
|
||||||
+ strFrom(PACKAGE_VERSION) + "] ";
|
|
||||||
|
|
||||||
void Env::function(void)
|
void Env::function(void)
|
||||||
{}
|
{}
|
||||||
|
@ -30,8 +30,12 @@ namespace ROOT
|
|||||||
};
|
};
|
||||||
|
|
||||||
// macros necessary in the ROOT-based version of Minuit2
|
// macros necessary in the ROOT-based version of Minuit2
|
||||||
|
#ifndef ROOT_Math_VecTypes
|
||||||
#define ROOT_Math_VecTypes
|
#define ROOT_Math_VecTypes
|
||||||
|
#endif
|
||||||
|
#ifndef MATHCORE_STANDALONE
|
||||||
#define MATHCORE_STANDALONE
|
#define MATHCORE_STANDALONE
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <Minuit2/Minuit2Minimizer.h>
|
#include <Minuit2/Minuit2Minimizer.h>
|
||||||
#include <Math/Functor.h>
|
#include <Math/Functor.h>
|
||||||
|
@ -108,15 +108,15 @@ void SampleFitResult::print(const bool printXsi, ostream &out) const
|
|||||||
Index pMax = printXsi ? size() : nPar_;
|
Index pMax = printXsi ? size() : nPar_;
|
||||||
DMat err = this->variance().cwiseSqrt();
|
DMat err = this->variance().cwiseSqrt();
|
||||||
|
|
||||||
sprintf(buf, "chi^2/dof= %.1e/%d= %.2e -- chi^2 CCDF= %.2e -- p-value= %.2e",
|
snprintf(buf, sizeof(buf), "chi^2/dof= %.1e/%d= %.2e -- chi^2 CCDF= %.2e -- p-value= %.2e",
|
||||||
getChi2(), static_cast<int>(getNDof()), getChi2PerDof(), getCcdf(),
|
getChi2(), static_cast<int>(getNDof()), getChi2PerDof(), getCcdf(),
|
||||||
getPValue());
|
getPValue());
|
||||||
out << buf << endl;
|
out << buf << endl;
|
||||||
sprintf(buf, "correlation dynamic range= %.1f dB", getCorrRangeDb());
|
snprintf(buf, sizeof(buf), "correlation dynamic range= %.1f dB", getCorrRangeDb());
|
||||||
out << buf << endl;
|
out << buf << endl;
|
||||||
for (Index p = 0; p < pMax; ++p)
|
for (Index p = 0; p < pMax; ++p)
|
||||||
{
|
{
|
||||||
sprintf(buf, "%12s= % e +/- %e", parName_[p].c_str(),
|
snprintf(buf, sizeof(buf), "%12s= % e +/- %e", parName_[p].c_str(),
|
||||||
(*this)[central](p), err(p));
|
(*this)[central](p), err(p));
|
||||||
out << buf << endl;
|
out << buf << endl;
|
||||||
}
|
}
|
||||||
|
@ -76,15 +76,15 @@ void FitResult::print(const bool printXsi, ostream &out) const
|
|||||||
char buf[256];
|
char buf[256];
|
||||||
Index pMax = printXsi ? size() : nPar_;
|
Index pMax = printXsi ? size() : nPar_;
|
||||||
|
|
||||||
sprintf(buf, "chi^2/dof= %.1e/%d= %.2e -- chi^2 CCDF= %.2e -- p-value= %.2e",
|
snprintf(buf, sizeof(buf), "chi^2/dof= %.1e/%d= %.2e -- chi^2 CCDF= %.2e -- p-value= %.2e",
|
||||||
getChi2(), static_cast<int>(getNDof()), getChi2PerDof(), getCcdf(),
|
getChi2(), static_cast<int>(getNDof()), getChi2PerDof(), getCcdf(),
|
||||||
getPValue());
|
getPValue());
|
||||||
out << buf << endl;
|
out << buf << endl;
|
||||||
sprintf(buf, "correlation dynamic range= %.1f dB", getCorrRangeDb());
|
snprintf(buf, sizeof(buf), "correlation dynamic range= %.1f dB", getCorrRangeDb());
|
||||||
out << buf << endl;
|
out << buf << endl;
|
||||||
for (Index p = 0; p < pMax; ++p)
|
for (Index p = 0; p < pMax; ++p)
|
||||||
{
|
{
|
||||||
sprintf(buf, "%12s= %e", parName_[p].c_str(), (*this)(p));
|
snprintf(buf, sizeof(buf), "%12s= %e", parName_[p].c_str(), (*this)(p));
|
||||||
out << buf << endl;
|
out << buf << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
lib/config.h.in
Normal file
2
lib/config.h.in
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#cmakedefine PROJECT_NAME "@PROJECT_NAME@"
|
||||||
|
#cmakedefine PROJECT_VERSION "@PROJECT_VERSION@"
|
Loading…
x
Reference in New Issue
Block a user