lasp/cpp_src/CMakeLists.txt

63 lines
2.0 KiB
CMake

# src/lasp/CMakeLists.txt
# Armadillo, don't build the wrapper lib, but instead directly link to
# openblas.
add_definitions(-DARMA_DONT_USE_WRAPPER)
configure_file(lasp_config.h.in lasp_config.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(SYSTEM
${PROJECT_SOURCE_DIR}/third_party/armadillo-code/include)
include_directories(${PROJECT_SOURCE_DIR}/third_party/DebugTrace-cpp/include)
include_directories(${PROJECT_SOURCE_DIR}/third_party/gsl-lite/include)
include_directories(${PROJECT_SOURCE_DIR}/third_party/tomlplusplus/include)
include_directories(${PROJECT_SOURCE_DIR}/third_party/thread-pool)
if(LASP_HAS_RTAUDIO)
include_directories(${PROJECT_SOURCE_DIR}/third_party/rtaudio)
endif()
if(LASP_HAS_ULDAQ)
include_directories(${PROJECT_SOURCE_DIR}/third_party/uldaq/src)
endif()
add_subdirectory(device)
add_subdirectory(dsp)
pybind11_add_module(lasp_cpp MODULE lasp_cpp.cpp
pybind11/lasp_deviceinfo.cpp
pybind11/lasp_daqconfig.cpp
pybind11//lasp_dsp_pybind.cpp
pybind11/lasp_streammgr.cpp
pybind11/lasp_daq.cpp
pybind11/lasp_deviceinfo.cpp
pybind11/lasp_pyindatahandler.cpp
pybind11/lasp_siggen.cpp
)
target_link_libraries(lasp_cpp PRIVATE lasp_device_lib lasp_dsp_lib
${OpenMP_CXX_LIBRARIES} ${LASP_FFT_LIBS} ${TARGET_OS_LINKLIBS})
target_compile_definitions(lasp_cpp PRIVATE
MODULE_NAME=$<TARGET_FILE_BASE_NAME:lasp_cpp>
VERSION_INFO="${PY_FULL_VERSION}"
)
# Hide all symbols by default (including external libraries on Linux)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set_target_properties(lasp_cpp PROPERTIES
CXX_VISIBILITY_PRESET "hidden"
VISIBILITY_INLINES_HIDDEN true)
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
target_link_options(lasp_cpp PRIVATE "LINKER:--exclude-libs,ALL")
endif()
endif()
if(DEFINED PY_BUILD_CMAKE_MODULE_NAME)
# Install the Python module
install(TARGETS lasp_cpp
EXCLUDE_FROM_ALL
COMPONENT python_modules
DESTINATION ${PY_BUILD_CMAKE_MODULE_NAME})
endif()