summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Morman <jmorman@gnuradio.org>2022-01-04 16:59:32 -0500
committermormj <34754695+mormj@users.noreply.github.com>2022-01-06 06:22:47 -0500
commitb8d853a1a04b16cf9261e216b5330a4e7523b6ad (patch)
tree210384bf2191ba0b1ed5a2fff2d88bbe70b03340
parentad843023c65dc35aed73b7a4e4a78afbc7347f5d (diff)
cmake: build python deps conditionally
Signed-off-by: Josh Morman <jmorman@gnuradio.org>
-rw-r--r--.github/workflows/make-test.yml25
-rw-r--r--CMakeLists.txt13
-rw-r--r--gnuradio-runtime/CMakeLists.txt9
-rw-r--r--gnuradio-runtime/lib/CMakeLists.txt23
4 files changed, 60 insertions, 10 deletions
diff --git a/.github/workflows/make-test.yml b/.github/workflows/make-test.yml
index c1fa406f99..7034e39409 100644
--- a/.github/workflows/make-test.yml
+++ b/.github/workflows/make-test.yml
@@ -109,3 +109,28 @@ jobs:
su -c ldconfig
- name: Test Python3
run: python3 -c "import gnuradio.blocks; print(gnuradio.blocks.complex_to_float())"
+ no-python:
+ # All of these shall depend on the formatting check (needs: check-formatting)
+ needs: [check-formatting, check-python-formatting]
+ runs-on: ubuntu-latest
+ # The GH default is 360 minutes (it's also the max as of Feb-2021). However
+ # we should fail sooner. The only reason to exceed this time is if a test
+ # hangs.
+ timeout-minutes: 120
+ name: C++ Only Build (Ubuntu 20.04)
+ container:
+ image: 'gnuradio/ci:ubuntu-20.04-3.9'
+ volumes:
+ - build_data:/build
+ options: --cpus 2
+ steps:
+ - uses: actions/checkout@v2
+ name: Checkout Project
+ - name: CMake
+ env:
+ CXXFLAGS: -Werror -Wno-error=invalid-pch
+ run: 'cd /build && cmake ${GITHUB_WORKSPACE} -DENABLE_DOXYGEN=OFF -DENABLE_PYTHON=OFF'
+ - name: Make
+ run: 'cd /build && make -j2 -k'
+ - name: Make Test
+ run: 'cd /build && ctest --output-on-failure'
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bd53d0edf2..26a99c4ee5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -264,9 +264,12 @@ if(NOT PYGCCXML_FOUND)
message(STATUS "******************************************************************")
endif()
-find_package(pybind11 REQUIRED)
+find_package(pybind11)
+IF(pybind11_FOUND)
IF(${pybind11_VERSION} VERSION_LESS ${PYBIND11_MIN_VERSION})
- message(FATAL_ERROR "pybind11 version ${pybind11_VERSION} < ${PYBIND11_MIN_VERSION}")
+ message(WARNING "pybind11 version ${pybind11_VERSION} < ${PYBIND11_MIN_VERSION}")
+ set(pybind11_FOUND False)
+ENDIF()
ENDIF()
include(GrComponent)
@@ -372,7 +375,6 @@ GR_REGISTER_COMPONENT("post-install" ENABLE_POSTINSTALL)
########################################################################
add_subdirectory(docs)
add_subdirectory(gnuradio-runtime)
-add_subdirectory(grc)
add_subdirectory(gr-blocks)
add_subdirectory(gr-fec)
add_subdirectory(gr-fft)
@@ -387,13 +389,16 @@ add_subdirectory(gr-iio)
add_subdirectory(gr-qtgui)
add_subdirectory(gr-trellis)
add_subdirectory(gr-uhd)
-add_subdirectory(gr-utils)
add_subdirectory(gr-video-sdl)
add_subdirectory(gr-vocoder)
add_subdirectory(gr-wavelet)
add_subdirectory(gr-zeromq)
add_subdirectory(gr-network)
add_subdirectory(gr-soapy)
+if (ENABLE_PYTHON)
+add_subdirectory(grc)
+add_subdirectory(gr-utils)
+endif()
# Defining GR_CTRLPORT for gnuradio/config.h
if(ENABLE_GR_CTRLPORT)
diff --git a/gnuradio-runtime/CMakeLists.txt b/gnuradio-runtime/CMakeLists.txt
index a81a5c1427..5160e76d8c 100644
--- a/gnuradio-runtime/CMakeLists.txt
+++ b/gnuradio-runtime/CMakeLists.txt
@@ -28,6 +28,7 @@ find_package(spdlog CONFIG)
# Register component
########################################################################
include(GrComponent)
+if (ENABLE_PYTHON)
GR_REGISTER_COMPONENT("gnuradio-runtime" ENABLE_GNURADIO_RUNTIME
Boost_FOUND
PYTHONINTERP_FOUND
@@ -35,6 +36,14 @@ GR_REGISTER_COMPONENT("gnuradio-runtime" ENABLE_GNURADIO_RUNTIME
spdlog_FOUND
pybind11_FOUND
)
+else()
+GR_REGISTER_COMPONENT("gnuradio-runtime" ENABLE_GNURADIO_RUNTIME
+ Boost_FOUND
+ PYTHONINTERP_FOUND
+ MPLIB_FOUND
+ spdlog_FOUND
+)
+endif()
get_filename_component(GNURADIO_RUNTIME_PYTHONPATH
${CMAKE_SOURCE_DIR}/python ABSOLUTE
diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt
index 2d8a81ab10..6cd9c0c54f 100644
--- a/gnuradio-runtime/lib/CMakeLists.txt
+++ b/gnuradio-runtime/lib/CMakeLists.txt
@@ -52,7 +52,6 @@ add_library(gnuradio-runtime
block.cc
block_detail.cc
block_executor.cc
- block_gateway_impl.cc
block_registry.cc
buffer.cc
buffer_double_mapped.cc
@@ -99,6 +98,12 @@ add_library(gnuradio-runtime
vmcircbuf_sysv_shm.cc
)
+if (ENABLE_PYTHON)
+ target_sources(gnuradio-runtime PRIVATE
+ block_gateway_impl.cc
+ )
+endif()
+
# Messages
target_sources(gnuradio-runtime PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/messages/msg_accepter.cc
@@ -135,14 +140,20 @@ target_link_libraries(gnuradio-runtime PUBLIC
# INTERFACE/PRIVATE split so users of the library can choose how to link to Python
# (importantly, extension modules can avoid linking against Python and resolve
# their own Python symbols at runtime through the Python interpreter's linking)
- INTERFACE
- Python::Module
PRIVATE
- Python::Python
- libunwind::libunwind
- pybind11::pybind11
+ libunwind::libunwind
)
+if (ENABLE_PYTHON)
+target_link_libraries(gnuradio-runtime
+ INTERFACE
+ Python::Module
+ PRIVATE
+ Python::Python
+ pybind11::pybind11
+)
+endif()
+
# Address linker issues with std::filesystem on Centos 8 and Debian
target_link_libraries(gnuradio-runtime PUBLIC $<$<AND:$<CXX_COMPILER_ID:GNU>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,9.0>>:stdc++fs>)