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

cmake comments

This commit is contained in:
Antonin Portelli 2024-02-08 15:00:09 +01:00
parent cce9faaba6
commit 1c8add56ef
2 changed files with 15 additions and 1 deletions

View File

@ -1,14 +1,19 @@
# package config
cmake_minimum_required(VERSION 3.11.0)
project(
LatAnalyze
VERSION 3.6
LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 14)
# includes
include(FetchContent)
include(FindPackageMessage)
include(GNUInstallDirs)
# C++ standard
set(CMAKE_CXX_STANDARD 14)
# fetch and create symbolic link to Eigen headers
set(FETCHCONTENT_BASE_DIR ${CMAKE_BINARY_DIR}/deps)
FetchContent_Declare(
Eigen3
@ -22,6 +27,7 @@ endif()
file(CREATE_LINK ${eigen3_SOURCE_DIR}/Eigen ${CMAKE_SOURCE_DIR}/lib/LatAnalyze/Eigen
SYMBOLIC)
# dependencies
find_package(GSL REQUIRED)
find_package(HDF5 REQUIRED COMPONENTS C CXX)
find_package(Minuit2)
@ -44,8 +50,10 @@ else()
message(STATUS "NLopt not found")
endif()
# subdirectories
add_subdirectory(lib)
# summary
message(STATUS "---------------------------")
message(STATUS "LatAnalyze v${PROJECT_VERSION} configured")
message(STATUS "---------------------------")

View File

@ -1,11 +1,15 @@
# rpath config
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
# config.h header for package version and name
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
# find bison & flex
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
# ASCII parser
bison_target(
AsciiParser LatAnalyze/Io/AsciiParser.ypp
${CMAKE_CURRENT_BINARY_DIR}/AsciiParser.cpp COMPILE_FLAGS "-Wno-deprecated")
@ -13,6 +17,7 @@ flex_target(AsciiLexer LatAnalyze/Io/AsciiLexer.lpp
${CMAKE_CURRENT_BINARY_DIR}/AsciiLexer.cpp)
add_flex_bison_dependency(AsciiLexer AsciiParser)
# math parser
bison_target(
MathParser LatAnalyze/Core/MathParser.ypp
${CMAKE_CURRENT_BINARY_DIR}/MathParser.cpp COMPILE_FLAGS "-Wno-deprecated")
@ -20,6 +25,7 @@ flex_target(MathLexer LatAnalyze/Core/MathLexer.lpp
${CMAKE_CURRENT_BINARY_DIR}/MathLexer.cpp)
add_flex_bison_dependency(MathLexer MathParser)
# library target
add_library(LatAnalyze SHARED)
file(GLOB_RECURSE EIGEN_HEADERS LatAnalyze/Eigen/*)
target_include_directories(LatAnalyze PRIVATE ${CMAKE_CURRENT_BINARY_DIR})