79 lines
2.9 KiB
CMake
79 lines
2.9 KiB
CMake
|
cmake_minimum_required(VERSION 3.8...3.18)
|
||
|
project(BluetAnalyzer)
|
||
|
|
||
|
set(CMAKE_CXX_STANDARD 17)
|
||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||
|
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")
|
||
|
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O2 -Wall")
|
||
|
set(CMAKE_BUILD_TYPE "Debug")
|
||
|
|
||
|
# Find fmt
|
||
|
find_package(fmt)
|
||
|
|
||
|
# Find Eigen
|
||
|
find_package(Eigen3)
|
||
|
include_directories(/usr/include/eigen3)
|
||
|
|
||
|
# Find Geant4
|
||
|
find_package(Geant4 REQUIRED ui_all vis_all)
|
||
|
|
||
|
# Find ROOT
|
||
|
find_package(ROOT REQUIRED COMPONENTS RIO Net Spectrum Gui)
|
||
|
|
||
|
# Find Garfield
|
||
|
find_package(Garfield REQUIRED)
|
||
|
include_directories($ENV{GARFIELD_INSTALL}/include/Garfield)
|
||
|
|
||
|
# Setup include directory for this project
|
||
|
include(${Geant4_USE_FILE})
|
||
|
include_directories(${PROJECT_SOURCE_DIR}/include)
|
||
|
# Include bluet file
|
||
|
set(bluet_base "/home/liuyihui/bluet/")
|
||
|
# include(${bluet_base}/sources/config/include/BluetConfig.hh)
|
||
|
# include(${bluet_base}/sources/modules/include/BluetDataModel.hh)
|
||
|
include_directories(${bluet_base}/sources/config/include)
|
||
|
include_directories(${bluet_base}/sources/modules/include)
|
||
|
include_directories(${bluet_base}/sources/runner/include)
|
||
|
include_directories(${bluet_base}/utils/include)
|
||
|
include_directories($ENV{GARFIELD_INSTALL}/include/Garfield)
|
||
|
|
||
|
# Locate sources and headers for this project
|
||
|
file(GLOB analyzer ${PROJECT_SOURCE_DIR}/include/* ${PROJECT_SOURCE_DIR}/src/*)
|
||
|
# file(GLOB config ${bluet_base}/sources/config/include/* ${bluet_base}/sources/config/src/*)
|
||
|
# file(GLOB modules ${bluet_base}/sources/modules/include/* ${bluet_base}/sources/modules/src/*)
|
||
|
# file(GLOB runner ${bluet_base}/sources/runner/include/* ${bluet_base}/sources/runner/src/*)
|
||
|
# file(GLOB utils ${bluet_base}/utils/include/* ${bluet_base}/utils/src/*)
|
||
|
list(FILTER analyzer EXCLUDE REGEX "BluetDrawLinkDef")
|
||
|
|
||
|
# ROOT_GENERATE_DICTIONARY(D_${PROJECT_NAME} /home/fox/bluet/sources/modules/include/DrawEvent.hh LINKDEF /home/fox/bluet/sources/modules/include/BluetDrawLinkDef.hh)
|
||
|
add_library(SO_${PROJECT_NAME} SHARED
|
||
|
${analyzer}
|
||
|
# Bluet
|
||
|
${bluet_base}/sources/config/include/BluetDataModel.hh
|
||
|
${bluet_base}/utils/include/pugixml.hpp
|
||
|
${bluet_base}/utils/src/pugixml.cpp
|
||
|
${bluet_base}/utils/include/xmlparse.hh
|
||
|
${bluet_base}/utils/src/xmlparse.cc
|
||
|
${bluet_base}/utils/include/stringhandle.hh
|
||
|
${bluet_base}/utils/src/stringhandle.cc
|
||
|
# D_${PROJECT_NAME}.cxx
|
||
|
)
|
||
|
|
||
|
target_link_libraries(SO_${PROJECT_NAME} PUBLIC
|
||
|
${Geant4_LIBRARIES}
|
||
|
${ROOT_LIBRARIES} ROOT::RIO ROOT::Net ROOT::Spectrum ROOT::Gui
|
||
|
Garfield::Garfield
|
||
|
fmt::fmt
|
||
|
gsl gslcblas
|
||
|
)
|
||
|
|
||
|
# Add the executable, and link it to the libraries
|
||
|
add_executable(${PROJECT_NAME} main.cc)
|
||
|
target_link_libraries(${PROJECT_NAME} SO_${PROJECT_NAME})
|
||
|
|
||
|
#--- Set default installation prefix ------------------------------------------
|
||
|
set(CMAKE_INSTALL_PREFIX
|
||
|
${PROJECT_SOURCE_DIR}/install
|
||
|
CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
|
||
|
INSTALL(TARGETS ${PROJECT_NAME} SO_${PROJECT_NAME})
|