File: CMakeLists.txt

package info (click to toggle)
gr-fosphor 3.9~git20240323.74d54fc-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,260 kB
  • sloc: python: 9,483; ansic: 3,422; cpp: 1,281; lisp: 609; makefile: 33
file content (67 lines) | stat: -rw-r--r-- 2,011 bytes parent folder | download
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
# Copyright 2011-2020 Free Software Foundation, Inc.
# Copyright 2013-2021 Sylvain Munaut <tnt@246tNt.com>
#
# This file is part of gr-fosphor
#
# SPDX-License-Identifier: GPL-3.0-or-later

########################################################################
# Check for pygccxml
########################################################################
GR_PYTHON_CHECK_MODULE_RAW(
    "pygccxml"
    "import pygccxml"
    PYGCCXML_FOUND
    )

# Official module is broken, makes too many assumptions that are not true
#include(GrPybind)

include(GrPython)

macro(GR_PYBIND_MAKE name updir filter files)

configure_file(${CMAKE_SOURCE_DIR}/docs/doxygen/pydoc_macros.h ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)

pybind11_add_module(${name}_python ${files})

SET(MODULE_NAME ${name})
if (${name} STREQUAL gr)
    SET(MODULE_NAME "runtime")
endif()

target_include_directories(${name}_python PUBLIC
    ${CMAKE_CURRENT_BINARY_DIR}
    ${PYTHON_NUMPY_INCLUDE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/${updir}/lib
    ${CMAKE_CURRENT_SOURCE_DIR}/${updir}/include
    ${PYBIND11_INCLUDE_DIR}
)
target_link_libraries(${name}_python PUBLIC ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} gnuradio-${MODULE_NAME})
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
   CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    target_compile_options(${name}_python PRIVATE -Wno-unused-variable) # disable warnings for docstring templates
endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
      CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

endmacro(GR_PYBIND_MAKE)



########################################################################
# Python Bindings
########################################################################

list(APPEND fosphor_python_files
    base_sink_c_python.cc
    glfw_sink_c_python.cc
    qt_sink_c_python.cc
    overlap_cc_python.cc
    python_bindings.cc)

GR_PYBIND_MAKE(fosphor
   ../..
   gr::fosphor
   "${fosphor_python_files}")

install(TARGETS fosphor_python DESTINATION ${GR_PYTHON_DIR}/gnuradio/fosphor COMPONENT pythonapi)