72 lines
2.2 KiB
CMake
72 lines
2.2 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_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/*)
|
|
# list(FILTER analyzer EXCLUDE REGEX "BluetDrawLinkDef")
|
|
|
|
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
|
|
${bluet_base}/utils/include/clipp.h
|
|
)
|
|
|
|
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})
|