-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
105 lines (86 loc) · 3.54 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
cmake_minimum_required(VERSION 3.5.0)
project(lofarbeam)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake)
set(CASACORE_MAKE_REQUIRED_EXTERNALS_OPTIONAL TRUE)
find_package(Casacore REQUIRED COMPONENTS casa ms tables measures)
include_directories(${CASACORE_INCLUDE_DIR})
add_compile_options(-std=c++11 -Wall -DNDEBUG -Wl,--no-undefined)
option (BUILD_PYTHON "Build the python bindings" YES)
add_library(stationresponse SHARED
AntennaField.cc
AntennaFieldHBA.cc
AntennaFieldLBA.cc
AntennaModelHBA.cc
AntennaModelLBA.cc
DualDipoleAntenna.cc
ElementResponse.cc
ITRFConverter.cc
ITRFDirection.cc
LofarMetaDataUtil.cc
MathUtil.cc
Station.cc
TileAntenna.cc
Types.cc)
add_library(elementresponse SHARED
ElementResponse.cc)
set_target_properties(stationresponse PROPERTIES VERSION 3)
set_target_properties(elementresponse PROPERTIES VERSION 3)
# The elementresponse lib does not require casacore, so
# linking casacore only to stationresponse is enough.
target_link_libraries(stationresponse ${CASACORE_LIBRARIES})
install (TARGETS stationresponse DESTINATION lib)
install (TARGETS elementresponse DESTINATION lib)
install (FILES
AntennaField.h
Constants.h
LofarMetaDataUtil.h
Station.h
Types.h
ITRFConverter.h
ITRFDirection.h
DESTINATION include/StationResponse)
install (FILES
ElementResponse.h
DESTINATION include/ElementResponse)
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating developer API documentation with Doxygen" VERBATIM)
elseif(DOXYGEN_FOUND)
endif(DOXYGEN_FOUND)
if (BUILD_PYTHON)
# This is NOT the modern cmake-included FindPython!
find_package (Python COMPONENTS Development)
message("Compiling Python ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} support. If this is not the intended target use 'DPYTHON_EXECUTABLE' to control.")
# bind against boost-python for compilation of the python API
# depending on major release version of the python libraries
if(${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
set(casapy "")
set(oldboostpy "")
else()
set(casapy "3")
set(oldboostpy "3")
endif()
set(boostpy ${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
message(STATUS "Trying to find boost-python libraries with version suffix ${boostpy}")
find_package(Boost 1.67.0 COMPONENTS python${boostpy} numpy${boostpy})
if(NOT Boost_FOUND)
message(STATUS "Falling back to old Boost search.")
set(boostpy ${oldboostpy})
find_package(Boost REQUIRED COMPONENTS python${boostpy} numpy${boostpy})
endif()
find_package (Casacore REQUIRED COMPONENTS python${casapy})
set(casapylib ${CASA_PYTHON${casapy}_LIBRARY})
message(STATUS "Boost python library: ${Boost_PYTHON_LIBRARY}")
message(STATUS "Boost numpy library: ${Boost_NUMPY_LIBRARY}")
message(STATUS "Python library ${Python_LIBRARIES}")
add_library(_stationresponse MODULE pystationresponse.cc)
set_target_properties(_stationresponse PROPERTIES PREFIX "")
target_include_directories(_stationresponse PRIVATE ${PYTHON_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
target_link_libraries(_stationresponse stationresponse ${casapylib} Boost::python${boostpy} Boost::numpy${boostpy} ${PYTHON_LIBRARIES})
install(TARGETS _stationresponse DESTINATION ${PYTHON_INSTALL_DIR}/lofar/stationresponse)
install(FILES __init__.py DESTINATION ${PYTHON_INSTALL_DIR}/lofar/stationresponse)
endif(BUILD_PYTHON)