diff options
-rw-r--r-- | cmake/Modules/FindPortaudio.cmake | 25 | ||||
-rw-r--r-- | gr-utils/python/modtool/gr-newmod/python/__init__.py | 6 |
2 files changed, 26 insertions, 5 deletions
diff --git a/cmake/Modules/FindPortaudio.cmake b/cmake/Modules/FindPortaudio.cmake index 61e4ae23a1..20145ea8df 100644 --- a/cmake/Modules/FindPortaudio.cmake +++ b/cmake/Modules/FindPortaudio.cmake @@ -6,7 +6,7 @@ # PORTAUDIO_LIBRARIES - Link these to use Portaudio include(FindPkgConfig) -pkg_check_modules(PC_PORTAUDIO portaudio) +pkg_check_modules(PC_PORTAUDIO portaudio-2.0) find_path(PORTAUDIO_INCLUDE_DIRS NAMES @@ -15,7 +15,7 @@ find_path(PORTAUDIO_INCLUDE_DIRS /usr/local/include /usr/include HINTS - ${PC_PORTAUDIO_INCLUDE_DIR} + ${PC_PORTAUDIO_INCLUDEDIR} ) find_library(PORTAUDIO_LIBRARIES @@ -31,5 +31,22 @@ find_library(PORTAUDIO_LIBRARIES mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES) -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PORTAUDIO DEFAULT_MSG PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES) +# Found PORTAUDIO, but it may be version 18 which is not acceptable. +if(EXISTS ${PORTAUDIO_INCLUDE_DIRS}/portaudio.h) + include(CheckCXXSourceCompiles) + include(CMakePushCheckState) + cmake_push_check_state() + set(CMAKE_REQUIRED_INCLUDES ${PORTAUDIO_INCLUDE_DIRS}) + CHECK_CXX_SOURCE_COMPILES( + "#include <portaudio.h>\nPaDeviceIndex pa_find_device_by_name(const char *name); int main () {return 0;}" + PORTAUDIO2_FOUND) + cmake_pop_check_state() + if(PORTAUDIO2_FOUND) + INCLUDE(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(PORTAUDIO DEFAULT_MSG PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES) + else(PORTAUDIO2_FOUND) + message(STATUS + " portaudio.h not compatible (requires API 2.0)") + set(PORTAUDIO_FOUND FALSE) + endif(PORTAUDIO2_FOUND) +endif() diff --git a/gr-utils/python/modtool/gr-newmod/python/__init__.py b/gr-utils/python/modtool/gr-newmod/python/__init__.py index 575cbfc222..d852fda545 100644 --- a/gr-utils/python/modtool/gr-newmod/python/__init__.py +++ b/gr-utils/python/modtool/gr-newmod/python/__init__.py @@ -42,7 +42,11 @@ if _RTLD_GLOBAL != 0: # import swig generated symbols into the howto namespace -from howto_swig import * +try: + # this might fail if the module is python-only + from howto_swig import * +except ImportError: + pass # import any pure python here # |