forked from BristolTopGroup/AnalysisSoftware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
77 lines (69 loc) · 2.66 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Check if cmake has the required version
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
set(PROJECT_NAME_STR AnalysisSoftware)
PROJECT(${PROJECT_NAME_STR})
if((CMAKE_SYSTEM_PROCESSOR MATCHES "i386") AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (APPLE))
set(CMAKE_OSX_ARCHITECTURES "x86_64")
MESSAGE(STATUS "Building Bristol Analysis Software for ${CMAKE_OSX_ARCHITECTURES} architecture on ${CMAKE_SYSTEM_NAME}")
else()
MESSAGE(STATUS "Building Bristol Analysis Software on ${CMAKE_SYSTEM_NAME}")
endif()
# get ROOT
include(FindROOT.cmake)
MESSAGE(STATUS "** ROOT Include path: ${ROOT_INCLUDE_DIR}")
MESSAGE(STATUS "** ROOT Library path: ${ROOT_LIBRARY_DIR}")
MESSAGE(STATUS "** ROOT Libraries: ${ROOT_LIBRARIES}")
include_directories(${ROOT_INCLUDE_DIR})
link_directories(${ROOT_LIBRARY_DIR})
# get boost
# static linking doesn't work on DICE for some reason
if((CMAKE_SYSTEM_PROCESSOR MATCHES "i386") AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (APPLE))
set(Boost_USE_STATIC_LIBS ON)
else()
set(Boost_USE_STATIC_LIBS OFF)
endif()
set(Boost_USE_MULTITHREADED ON)
find_package(Boost COMPONENTS
filesystem
system
python
program_options
REQUIRED)
MESSAGE(STATUS "** Boost Include path: ${Boost_INCLUDE_DIR}")
MESSAGE(STATUS "** Boost Library path: ${Boost_LIBRARY_DIRS}")
MESSAGE(STATUS "** Boost Libraries: ${Boost_LIBRARIES}")
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
# get python
find_package(PythonLibs REQUIRED)
MESSAGE(STATUS "** Python Include path: ${PYTHON_INCLUDE_DIRS}")
MESSAGE(STATUS "** Python Libraries: ${PYTHON_LIBRARIES}")
include_directories(${PYTHON_INCLUDE_DIRS})
#Check the compiler and set the compile and link flags
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS "-O3 -std=c++11")
# first attempt to make cmake work again on OS X
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -stdlib=libstdc++")
#Adding files to compile
aux_source_directory(bin/ SRC_COMMON)
file(GLOB_RECURSE SRC "src/*.cpp")
#Excluding unnecessary files
file(GLOB_RECURSE SRC_EXCLUDE "src/*HitFitAnalyser.cpp")
list(REMOVE_ITEM SRC ${SRC_EXCLUDE})
ADD_DEFINITIONS(
-std=c++11
)
#Adding the executable
add_executable(AnalysisSoftware ${SRC} ${SRC_COMMON})
target_link_libraries(AnalysisSoftware
${Boost_LIBRARIES}
${PYTHON_LIBRARIES}
${ROOT_LIBRARIES}
)
# tests
enable_testing()
set(PROJECT_TEST_NAME ${PROJECT_NAME_STR}_test)
include_directories(${COMMON_INCLUDES})
file(GLOB TEST_SRC_FILES ${PROJECT_SOURCE_DIR}/test/*.cpp)
add_executable(${PROJECT_TEST_NAME} ${TEST_SRC_FILES})
add_test(test1 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_TEST_NAME})