1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-14 01:45:35 +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(FetchContent)
include(FindPackageMessage) include(FindPackageMessage)
include(GNUInstallDirs)
set(FETCHCONTENT_BASE_DIR ${CMAKE_BINARY_DIR}/deps) set(FETCHCONTENT_BASE_DIR ${CMAKE_BINARY_DIR}/deps)
FetchContent_Declare( FetchContent_Declare(
@ -25,18 +26,30 @@ find_package(GSL REQUIRED)
find_package(HDF5 REQUIRED COMPONENTS C CXX) find_package(HDF5 REQUIRED COMPONENTS C CXX)
find_package(Minuit2) find_package(Minuit2)
if(Minuit2_FOUND) if(Minuit2_FOUND)
set(Minuit2_MSG "yes")
find_package_message( find_package_message(
Minuit2 Minuit2
"Found Minuit2: ${Minuit2_DIR} (found version \"${Minuit2_VERSION}\")" " ") "Found Minuit2: ${Minuit2_DIR} (found version \"${Minuit2_VERSION}\")" " ")
else() else()
set(Minuit2_MSG "no")
message(STATUS "Minuit2 not found") message(STATUS "Minuit2 not found")
endif() endif()
find_package(NLopt) find_package(NLopt)
if(NLopt_FOUND) if(NLopt_FOUND)
set(NLopt_MSG "yes")
find_package_message( find_package_message(
NLopt "Found NLopt: ${NLopt_DIR} (found version \"${NLopt_VERSION}\")" " ") NLopt "Found NLopt: ${NLopt_DIR} (found version \"${NLopt_VERSION}\")" " ")
else() else()
set(NLopt_MSG "no")
message(STATUS "NLopt not found") message(STATUS "NLopt not found")
endif() endif()
add_subdirectory(lib) 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) configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
include(FindBISON)
include(FindFLEX)
find_package(BISON REQUIRED) find_package(BISON REQUIRED)
find_package(FLEX REQUIRED) find_package(FLEX REQUIRED)
@ -23,114 +21,34 @@ flex_target(MathLexer LatAnalyze/Core/MathLexer.lpp
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 LatAnalyze/Eigen/*)
target_include_directories(LatAnalyze PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_include_directories(LatAnalyze PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
include(source-list.cmake)
target_sources( target_sources(
LatAnalyze LatAnalyze
PRIVATE ${BISON_AsciiParser_OUTPUTS} PRIVATE ${BISON_AsciiParser_OUTPUTS} ${FLEX_AsciiLexer_OUTPUTS}
${FLEX_AsciiLexer_OUTPUTS} ${BISON_MathParser_OUTPUTS} ${FLEX_MathLexer_OUTPUTS}
${BISON_MathParser_OUTPUTS} ${CMAKE_CURRENT_BINARY_DIR}/config.h ${LATAN_SOURCES}
${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
PUBLIC FILE_SET PUBLIC FILE_SET
public_headers public_headers
TYPE TYPE
HEADERS HEADERS
FILES FILES
${EIGEN_HEADERS} ${EIGEN_HEADERS}
LatAnalyze/Core/Eigen.hpp ${LATAN_HEADERS})
LatAnalyze/Core/EigenPlugin.hpp target_link_libraries(LatAnalyze PUBLIC GSL::gsl hdf5::hdf5 hdf5::hdf5_cpp)
LatAnalyze/Core/Exceptions.hpp if(Minuit2_FOUND)
LatAnalyze/Core/Mat.hpp target_link_libraries(LatAnalyze PUBLIC Minuit2::Minuit2)
LatAnalyze/Core/Math.hpp endif()
LatAnalyze/Core/MathInterpreter.hpp if(NLopt_FOUND)
LatAnalyze/Core/OptParser.hpp target_link_libraries(LatAnalyze PUBLIC NLopt::nlopt)
LatAnalyze/Core/ParserState.hpp endif()
LatAnalyze/Core/Plot.hpp set_target_properties(LatAnalyze PROPERTIES VERSION ${PROJECT_VERSION})
LatAnalyze/Core/ThreadPool.hpp target_include_directories(
LatAnalyze/Core/Utilities.hpp LatAnalyze PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
LatAnalyze/Core/stdincludes.hpp $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
LatAnalyze/Functional/CompiledFunction.hpp install(
LatAnalyze/Functional/CompiledModel.hpp TARGETS LatAnalyze
LatAnalyze/Functional/Function.hpp LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
LatAnalyze/Functional/Model.hpp FILE_SET public_headers
LatAnalyze/Functional/TabFunction.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
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)

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()