-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
90 lines (70 loc) · 2.68 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
78
79
80
81
82
83
84
85
86
87
88
89
90
cmake_minimum_required (VERSION 3.0.2)
# Use rpaths for now, previously there were issues with osx
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
project(libgroomrl)
set(VERSION "\"1.0.0\"")
option(ENABLE_WRAPPERONLY "Creates a libgroomrl-fastjet for fastjet-contrib." OFF)
find_package(PythonInterp 3 REQUIRED)
find_package(PythonLibs 3 REQUIRED)
# running the cffi builder
if (NOT EXISTS ${PROJECT_SOURCE_DIR/src/cgroomrl.cc})
execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/build.py WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src)
endif()
if(ENABLE_WRAPPERONLY)
include_directories(${PYTHON_INCLUDE_DIRS})
include_directories(src)
add_library(groomrl-fastjet SHARED src/cgroomrl.cc)
# pkg-config
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "${prefix}")
set(includedir "${prefix}/include")
set(extraincludirs "")
set(libdir "${prefix}/lib")
set(fastjetlibs "")
set(pythonlibs "")
configure_file(
"${PROJECT_SOURCE_DIR}/src/groomrl.pc.in"
"${PROJECT_SOURCE_DIR}/src/groomrl-fastjet.pc"
)
install(TARGETS groomrl-fastjet LIBRARY DESTINATION lib)
install(FILES ${PROJECT_SOURCE_DIR}/src/groomrl-fastjet.pc DESTINATION lib/pkgconfig)
install(DIRECTORY src/groomrl DESTINATION include)
else(ENABLE_WRAPPERONLY)
# fastjet
find_program(FASTJET_CONFIG fastjet-config REQUIRED)
if (FASTJET_CONFIG)
exec_program(${FASTJET_CONFIG}
ARGS --cxxflags
OUTPUT_VARIABLE FASTJET_CXX_FLAGS
)
set(FASTJET_CXX_FLAGS ${FASTJET_CXX_FLAGS} CACHE STRING INTERNAL)
exec_program(${FASTJET_CONFIG}
ARGS --libs
OUTPUT_VARIABLE FASTJET_LDFLAGS
)
set(FASTJET_LDFLAGS ${FASTJET_LDFLAGS} CACHE STRING INTERNAL)
endif(FASTJET_CONFIG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FASTJET_CXX_FLAGS}")
include_directories(${PYTHON_INCLUDE_DIRS})
include_directories(src)
add_library(groomrl SHARED src/groomrl.cc src/cgroomrl.cc)
# pkg-config
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "${prefix}")
set(includedir "${prefix}/include")
set(extraincludirs "-I${PYTHON_INCLUDE_DIR} ${FASTJET_CXX_FLAGS}")
set(libdir "${prefix}/lib")
set(fastjetlibs "${FASTJET_LDFLAGS}")
set(pythonlibs "${PYTHON_LIBRARIES}")
configure_file(
"${PROJECT_SOURCE_DIR}/src/groomrl.pc.in"
"${PROJECT_SOURCE_DIR}/src/groomrl.pc"
)
install(FILES ${PROJECT_SOURCE_DIR}/src/groomrl.pc DESTINATION lib/pkgconfig)
install(DIRECTORY src/groomrl DESTINATION include)
install(TARGETS groomrl LIBRARY DESTINATION lib)
endif(ENABLE_WRAPPERONLY)