1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-10 00:45:36 +00:00

fix and cleanup of library compilation

This commit is contained in:
Antonin Portelli 2024-02-08 14:50:29 +01:00
parent 4419139bd1
commit cce9faaba6
3 changed files with 142 additions and 104 deletions

View File

@ -7,6 +7,7 @@ set(CMAKE_CXX_STANDARD 14)
include(FetchContent)
include(FindPackageMessage)
include(GNUInstallDirs)
set(FETCHCONTENT_BASE_DIR ${CMAKE_BINARY_DIR}/deps)
FetchContent_Declare(
@ -25,18 +26,30 @@ find_package(GSL REQUIRED)
find_package(HDF5 REQUIRED COMPONENTS C CXX)
find_package(Minuit2)
if(Minuit2_FOUND)
set(Minuit2_MSG "yes")
find_package_message(
Minuit2
"Found Minuit2: ${Minuit2_DIR} (found version \"${Minuit2_VERSION}\")" " ")
else()
set(Minuit2_MSG "no")
message(STATUS "Minuit2 not found")
endif()
find_package(NLopt)
if(NLopt_FOUND)
set(NLopt_MSG "yes")
find_package_message(
NLopt "Found NLopt: ${NLopt_DIR} (found version \"${NLopt_VERSION}\")" " ")
else()
set(NLopt_MSG "no")
message(STATUS "NLopt not found")
endif()
add_subdirectory(lib)
message(STATUS "---------------------------")
message(STATUS "LatAnalyze v${PROJECT_VERSION} configured")
message(STATUS "---------------------------")
message(STATUS " install prefix: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Minuit2 minimisers: ${Minuit2_MSG}")
message(STATUS " NLopt minimisers: ${NLopt_MSG}")
message(STATUS "---------------------------")

View File

@ -3,8 +3,6 @@ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
include(FindBISON)
include(FindFLEX)
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
@ -23,114 +21,34 @@ flex_target(MathLexer LatAnalyze/Core/MathLexer.lpp
add_flex_bison_dependency(MathLexer MathParser)
add_library(LatAnalyze SHARED)
file(GLOB_RECURSE EIGEN_HEADERS Eigen/*)
file(GLOB_RECURSE EIGEN_HEADERS LatAnalyze/Eigen/*)
target_include_directories(LatAnalyze PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
include(source-list.cmake)
target_sources(
LatAnalyze
PRIVATE ${BISON_AsciiParser_OUTPUTS}
${FLEX_AsciiLexer_OUTPUTS}
${BISON_MathParser_OUTPUTS}
${FLEX_MathLexer_OUTPUTS}
${CMAKE_CURRENT_BINARY_DIR}/config.h
LatAnalyze/Core/Exceptions.cpp
LatAnalyze/Core/Mat.cpp
LatAnalyze/Core/Math.cpp
LatAnalyze/Core/MathInterpreter.cpp
LatAnalyze/Core/OptParser.cpp
LatAnalyze/Core/Plot.cpp
LatAnalyze/Core/ThreadPool.cpp
LatAnalyze/Core/Utilities.cpp
LatAnalyze/Functional/CompiledFunction.cpp
LatAnalyze/Functional/CompiledModel.cpp
LatAnalyze/Functional/Function.cpp
LatAnalyze/Functional/Model.cpp
LatAnalyze/Functional/TabFunction.cpp
LatAnalyze/Global.cpp
LatAnalyze/Io/AsciiFile.cpp
LatAnalyze/Io/BinReader.cpp
LatAnalyze/Io/File.cpp
LatAnalyze/Io/Hdf5File.cpp
LatAnalyze/Io/Io.cpp
LatAnalyze/Io/Xml/tinyxml2.cpp
LatAnalyze/Io/XmlReader.cpp
LatAnalyze/Numerical/DWT.cpp
LatAnalyze/Numerical/DWTFilters.cpp
LatAnalyze/Numerical/Derivative.cpp
LatAnalyze/Numerical/GslFFT.cpp
LatAnalyze/Numerical/GslHybridRootFinder.cpp
LatAnalyze/Numerical/GslMinimizer.cpp
LatAnalyze/Numerical/GslQagsIntegrator.cpp
LatAnalyze/Numerical/Minimizer.cpp
LatAnalyze/Numerical/MinuitMinimizer.cpp
LatAnalyze/Numerical/NloptMinimizer.cpp
LatAnalyze/Numerical/RootFinder.cpp
LatAnalyze/Numerical/Solver.cpp
LatAnalyze/Physics/CorrelatorFitter.cpp
LatAnalyze/Physics/DataFilter.cpp
LatAnalyze/Physics/EffectiveMass.cpp
LatAnalyze/Statistics/FitInterface.cpp
LatAnalyze/Statistics/Histogram.cpp
LatAnalyze/Statistics/Random.cpp
LatAnalyze/Statistics/StatArray.cpp
LatAnalyze/Statistics/XYSampleData.cpp
LatAnalyze/Statistics/XYStatData.cpp
PRIVATE ${BISON_AsciiParser_OUTPUTS} ${FLEX_AsciiLexer_OUTPUTS}
${BISON_MathParser_OUTPUTS} ${FLEX_MathLexer_OUTPUTS}
${CMAKE_CURRENT_BINARY_DIR}/config.h ${LATAN_SOURCES}
PUBLIC FILE_SET
public_headers
TYPE
HEADERS
FILES
${EIGEN_HEADERS}
LatAnalyze/Core/Eigen.hpp
LatAnalyze/Core/EigenPlugin.hpp
LatAnalyze/Core/Exceptions.hpp
LatAnalyze/Core/Mat.hpp
LatAnalyze/Core/Math.hpp
LatAnalyze/Core/MathInterpreter.hpp
LatAnalyze/Core/OptParser.hpp
LatAnalyze/Core/ParserState.hpp
LatAnalyze/Core/Plot.hpp
LatAnalyze/Core/ThreadPool.hpp
LatAnalyze/Core/Utilities.hpp
LatAnalyze/Core/stdincludes.hpp
LatAnalyze/Functional/CompiledFunction.hpp
LatAnalyze/Functional/CompiledModel.hpp
LatAnalyze/Functional/Function.hpp
LatAnalyze/Functional/Model.hpp
LatAnalyze/Functional/TabFunction.hpp
LatAnalyze/Global.hpp
LatAnalyze/Io/AsciiFile.hpp
LatAnalyze/Io/BinReader.hpp
LatAnalyze/Io/File.hpp
LatAnalyze/Io/Hdf5File.hpp
LatAnalyze/Io/Io.hpp
LatAnalyze/Io/IoObject.hpp
LatAnalyze/Io/Xml/tinyxml2.hpp
LatAnalyze/Io/XmlReader.hpp
LatAnalyze/Numerical/DWT.hpp
LatAnalyze/Numerical/DWTFilters.hpp
LatAnalyze/Numerical/Derivative.hpp
LatAnalyze/Numerical/FFT.hpp
LatAnalyze/Numerical/GslFFT.hpp
LatAnalyze/Numerical/GslHybridRootFinder.hpp
LatAnalyze/Numerical/GslMinimizer.hpp
LatAnalyze/Numerical/GslQagsIntegrator.hpp
LatAnalyze/Numerical/Integrator.hpp
LatAnalyze/Numerical/Minimizer.hpp
LatAnalyze/Numerical/MinuitMinimizer.hpp
LatAnalyze/Numerical/NloptMinimizer.hpp
LatAnalyze/Numerical/RootFinder.hpp
LatAnalyze/Numerical/Solver.hpp
LatAnalyze/Physics/CorrelatorFitter.hpp
LatAnalyze/Physics/DataFilter.hpp
LatAnalyze/Physics/EffectiveMass.hpp
LatAnalyze/Statistics/Dataset.hpp
LatAnalyze/Statistics/FitInterface.hpp
LatAnalyze/Statistics/Histogram.hpp
LatAnalyze/Statistics/MatSample.hpp
LatAnalyze/Statistics/Random.hpp
LatAnalyze/Statistics/StatArray.hpp
LatAnalyze/Statistics/XYSampleData.hpp
LatAnalyze/Statistics/XYStatData.hpp
LatAnalyze/includes.hpp)
target_link_libraries(LatAnalyze PUBLIC GSL::gsl hdf5::hdf5 hdf5::hdf5_cpp
Minuit2::Minuit2 NLopt::nlopt)
${LATAN_HEADERS})
target_link_libraries(LatAnalyze PUBLIC GSL::gsl hdf5::hdf5 hdf5::hdf5_cpp)
if(Minuit2_FOUND)
target_link_libraries(LatAnalyze PUBLIC Minuit2::Minuit2)
endif()
if(NLopt_FOUND)
target_link_libraries(LatAnalyze PUBLIC NLopt::nlopt)
endif()
set_target_properties(LatAnalyze PROPERTIES VERSION ${PROJECT_VERSION})
target_include_directories(
LatAnalyze PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
install(
TARGETS LatAnalyze
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
FILE_SET public_headers
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

107
lib/source-list.cmake Normal file
View File

@ -0,0 +1,107 @@
set(LATAN_HEADERS
LatAnalyze/Core/Eigen.hpp
LatAnalyze/Core/EigenPlugin.hpp
LatAnalyze/Core/Exceptions.hpp
LatAnalyze/Core/Mat.hpp
LatAnalyze/Core/Math.hpp
LatAnalyze/Core/MathInterpreter.hpp
LatAnalyze/Core/OptParser.hpp
LatAnalyze/Core/ParserState.hpp
LatAnalyze/Core/Plot.hpp
LatAnalyze/Core/ThreadPool.hpp
LatAnalyze/Core/Utilities.hpp
LatAnalyze/Core/stdincludes.hpp
LatAnalyze/Functional/CompiledFunction.hpp
LatAnalyze/Functional/CompiledModel.hpp
LatAnalyze/Functional/Function.hpp
LatAnalyze/Functional/Model.hpp
LatAnalyze/Functional/TabFunction.hpp
LatAnalyze/Global.hpp
LatAnalyze/Io/AsciiFile.hpp
LatAnalyze/Io/BinReader.hpp
LatAnalyze/Io/File.hpp
LatAnalyze/Io/Hdf5File.hpp
LatAnalyze/Io/Io.hpp
LatAnalyze/Io/IoObject.hpp
LatAnalyze/Io/Xml/tinyxml2.hpp
LatAnalyze/Io/XmlReader.hpp
LatAnalyze/Numerical/DWT.hpp
LatAnalyze/Numerical/DWTFilters.hpp
LatAnalyze/Numerical/Derivative.hpp
LatAnalyze/Numerical/FFT.hpp
LatAnalyze/Numerical/GslFFT.hpp
LatAnalyze/Numerical/GslHybridRootFinder.hpp
LatAnalyze/Numerical/GslMinimizer.hpp
LatAnalyze/Numerical/GslQagsIntegrator.hpp
LatAnalyze/Numerical/Integrator.hpp
LatAnalyze/Numerical/Minimizer.hpp
LatAnalyze/Numerical/NloptMinimizer.hpp
LatAnalyze/Numerical/RootFinder.hpp
LatAnalyze/Numerical/Solver.hpp
LatAnalyze/Physics/CorrelatorFitter.hpp
LatAnalyze/Physics/DataFilter.hpp
LatAnalyze/Physics/EffectiveMass.hpp
LatAnalyze/Statistics/Dataset.hpp
LatAnalyze/Statistics/FitInterface.hpp
LatAnalyze/Statistics/Histogram.hpp
LatAnalyze/Statistics/MatSample.hpp
LatAnalyze/Statistics/Random.hpp
LatAnalyze/Statistics/StatArray.hpp
LatAnalyze/Statistics/XYSampleData.hpp
LatAnalyze/Statistics/XYStatData.hpp)
if(Minuit2_FOUND)
list(APPEND LATAN_HEADERS LatAnalyze/Numerical/MinuitMinimizer.hpp)
endif()
if(NLopt_FOUND)
list(APPEND LATAN_HEADERS LatAnalyze/Numerical/NloptMinimizer.hpp)
endif()
set(LATAN_SOURCES
LatAnalyze/Core/Exceptions.cpp
LatAnalyze/Core/Mat.cpp
LatAnalyze/Core/Math.cpp
LatAnalyze/Core/MathInterpreter.cpp
LatAnalyze/Core/OptParser.cpp
LatAnalyze/Core/Plot.cpp
LatAnalyze/Core/ThreadPool.cpp
LatAnalyze/Core/Utilities.cpp
LatAnalyze/Functional/CompiledFunction.cpp
LatAnalyze/Functional/CompiledModel.cpp
LatAnalyze/Functional/Function.cpp
LatAnalyze/Functional/Model.cpp
LatAnalyze/Functional/TabFunction.cpp
LatAnalyze/Global.cpp
LatAnalyze/Io/AsciiFile.cpp
LatAnalyze/Io/BinReader.cpp
LatAnalyze/Io/File.cpp
LatAnalyze/Io/Hdf5File.cpp
LatAnalyze/Io/Io.cpp
LatAnalyze/Io/Xml/tinyxml2.cpp
LatAnalyze/Io/XmlReader.cpp
LatAnalyze/Numerical/DWT.cpp
LatAnalyze/Numerical/DWTFilters.cpp
LatAnalyze/Numerical/Derivative.cpp
LatAnalyze/Numerical/GslFFT.cpp
LatAnalyze/Numerical/GslHybridRootFinder.cpp
LatAnalyze/Numerical/GslMinimizer.cpp
LatAnalyze/Numerical/GslQagsIntegrator.cpp
LatAnalyze/Numerical/Minimizer.cpp
LatAnalyze/Numerical/RootFinder.cpp
LatAnalyze/Numerical/Solver.cpp
LatAnalyze/Physics/CorrelatorFitter.cpp
LatAnalyze/Physics/DataFilter.cpp
LatAnalyze/Physics/EffectiveMass.cpp
LatAnalyze/Statistics/FitInterface.cpp
LatAnalyze/Statistics/Histogram.cpp
LatAnalyze/Statistics/Random.cpp
LatAnalyze/Statistics/StatArray.cpp
LatAnalyze/Statistics/XYSampleData.cpp
LatAnalyze/Statistics/XYStatData.cpp)
if(Minuit2_FOUND)
list(APPEND LATAN_SOURCES LatAnalyze/Numerical/MinuitMinimizer.cpp)
endif()
if(NLopt_FOUND)
list(APPEND LATAN_SOURCES LatAnalyze/Numerical/NloptMinimizer.cpp)
endif()