Commit 0ee88bc8 authored by legoc's avatar legoc
Browse files

CMakeLists.txt begin

parent e0583d33
cmake_minimum_required(VERSION 3.0)
#------------------------------------------------------------
# Project
project(lstdpp128)
#------------------------------------------------------------
cmake_minimum_required(VERSION 3.7.2)
# Project name and version
project(lstdpp128 VERSION 1.4.0 LANGUAGES CXX)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
include(FetchContent)
if(NOT DEFINED BUILD_SHARED_LIBS)
option(BUILD_SHARED_LIBS "Building dynamic (ON) or static (OFF)" ON)
endif()
if(NOT DEFINED CMAKE_CXX_STANDARD)
# specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
endif()
# Current version
set(LSTDPP128_VERSION_MAJOR 1)
set(LSTDPP128_VERSION_MINOR 2)
set(LSTDPP128_VERSION_PATCH 0)
set(LSTDPP128_VERSION ${LSTDPP128_VERSION_MAJOR}.${LSTDPP128_VERSION_MINOR}.${LSTDPP128_VERSION_PATCH})
option(NOMAD "Compile Nomad library and programs" OFF)
set(CMAKE_BUILD_TYPE Release)
#------------------------------------------------------------
# Libraries
#------------------------------------------------------------
# Includes
include_directories(
"${PROJECT_SOURCE_DIR}"
)
# Sources
set(lstdpp128_sources
src/lstdpp128/CrateBoard.cpp
add_library(lstdpp128
src/lstdpp128/CrateBoard.cpp
src/lstdpp128/BaseAlgorithm.cpp
src/lstdpp128/Reader.cpp
src/lstdpp128/LiveReader.cpp
......@@ -32,26 +47,40 @@ set(lstdpp128_sources
src/lstdpp128/Check.cpp
)
# To compile the sources only once
add_library(objlib OBJECT ${lstdpp128_sources})
set_target_properties(lstdpp128 PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
VERSION ${PROJECT_VERSION}
)
# Shared libraries need PIC
set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1)
#write_basic_package_version_file(cameoConfigVersion.cmake
# COMPATIBILITY SameMajorVersion
# VERSION ${PROJECT_VERSION}
#)
# Define shared and static libraries
add_library(lstdpp128 SHARED $<TARGET_OBJECTS:objlib>)
add_library(lstdpp128_s STATIC $<TARGET_OBJECTS:objlib>)
# Set the version of the shared library
set_target_properties(lstdpp128 PROPERTIES VERSION ${LSTDPP128_VERSION}
SOVERSION ${LSTDPP128_VERSION_MAJOR})
# Install lib
install(TARGETS lstdpp128
DESTINATION lib
)
#------------------------------------------------------------
# Install
#------------------------------------------------------------
# Install include
install(DIRECTORY src/lstdpp128/
DESTINATION include
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
FILES_MATCHING PATTERN "*.h"
)
install(TARGETS lstdpp128
EXPORT lstdpp128export
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # windows
COMPONENT lstdpp128_Runtime
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # dynamic
COMPONENT lstdpp128_Runtime
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # static
COMPONENT lstdpp128_Development
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
#------------------------------------------------------------
# Subdirectories
#------------------------------------------------------------
add_subdirectory(src)
\ No newline at end of file
add_subdirectory(lstdpp128)
\ No newline at end of file
add_subdirectory(algorithms)
add_subdirectory(apps)
\ No newline at end of file
......@@ -82,7 +82,7 @@ struct Event {
*/
struct CompareEvents {
inline bool operator()(Event const & a, Event const & b) {
inline bool operator()(Event const & a, Event const & b) const {
return a.time() < b.time();
}
};
......
if(NOMAD)
add_subdirectory(nomad)
endif(NOMAD)
\ No newline at end of file
add_library(lstdppnomad128
Coincidence.cpp
Histogram.cpp
Rates.cpp
)
set_target_properties(lstdppnomad128 PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
VERSION ${PROJECT_VERSION}
)
install(TARGETS lstdppnomad128
EXPORT lstdppnomad128export
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # windows
COMPONENT lstdppnomad128_Runtime
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # dynamic
COMPONENT lstdppnomad128_Runtime
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # static
COMPONENT lstdppnomad128_Development
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
add_subdirectory(common)
if(NOMAD)
add_subdirectory(nomad)
endif(NOMAD)
\ No newline at end of file
#------------------------------------------------------------
# Programs
#------------------------------------------------------------
add_executable(lstcalibrateinsert128
CalibrateVectorInsert.cpp
)
target_link_libraries(lstcalibrateinsert128 PUBLIC
lstdpp128
)
add_executable(lstreader128
EventReader.cpp
)
target_link_libraries(lstreader128 PUBLIC
lstdpp128
)
add_executable(lstsort128
IterativeVectorSort.cpp
)
target_link_libraries(lstsort128 PUBLIC
lstdpp128
)
add_executable(lstcheck128
IterativeCheck.cpp
)
target_link_libraries(lstcheck128 PUBLIC
lstdpp128
)
add_executable(lstheader128
EventHeader.cpp
)
target_link_libraries(lstheader128 PUBLIC
lstdpp128
)
add_executable(lstboardinfo128
BoardInfo.cpp
)
target_link_libraries(lstboardinfo128 PUBLIC
lstdpp128
)
add_executable(lstexporter128
EventExporter.cpp
)
target_link_libraries(lstexporter128 PUBLIC
lstdpp128
)
#------------------------------------------------------------
# Install
#------------------------------------------------------------
install(
TARGETS lstcalibrateinsert128 lstreader128 lstsort128 lstcheck128 lstheader128 lstboardinfo128 lstexporter128
DESTINATION bin
)
\ No newline at end of file
#------------------------------------------------------------
# Programs
#------------------------------------------------------------
add_executable(lsthisto128
IterativeHistogram.cpp
)
target_link_libraries(lsthisto128 PUBLIC
lstdppnomad128 lstdpp128
)
add_executable(lstcoincidence128
IterativeVectorCoincidence.cpp
)
target_link_libraries(lstcoincidence128 PUBLIC
lstdppnomad128 lstdpp128
)
add_executable(lstrates128
IterativeRates.cpp
)
target_link_libraries(lstrates128 PUBLIC
lstdppnomad128 lstdpp128
)
#------------------------------------------------------------
# Install
#------------------------------------------------------------
install(
TARGETS lsthisto128 lstcoincidence128 lstrates128
DESTINATION bin
)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment