diff --git a/CMakeLists.txt b/CMakeLists.txt index ebe39a9..f331c8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 "---------------------------") diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 9e4aa27..6aeb140 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -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})