mirror of https://github.com/wb2osz/direwolf.git
add sndio support (CMake)
This commit is contained in:
parent
677117bff0
commit
c18b562409
|
@ -145,6 +145,10 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
configure_file("${CMAKE_SOURCE_DIR}/cmake/cpack/${CMAKE_PROJECT_NAME}.desktop.in"
|
configure_file("${CMAKE_SOURCE_DIR}/cmake/cpack/${CMAKE_PROJECT_NAME}.desktop.in"
|
||||||
"${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.desktop" @ONLY)
|
"${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.desktop" @ONLY)
|
||||||
|
|
||||||
|
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
|
||||||
|
set(OPENBSD TRUE)
|
||||||
|
set(HAVE_SNDIO TRUE)
|
||||||
|
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
if("${CMAKE_OSX_DEPLOYMENT_TARGET}" STREQUAL "")
|
if("${CMAKE_OSX_DEPLOYMENT_TARGET}" STREQUAL "")
|
||||||
message(STATUS "Build for macOS target: local version")
|
message(STATUS "Build for macOS target: local version")
|
||||||
|
@ -301,6 +305,12 @@ if(LINUX)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_AVAHI_CLIENT")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_AVAHI_CLIENT")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
elseif (HAVE_SNDIO)
|
||||||
|
find_package(sndio REQUIRED)
|
||||||
|
if(SNDIO_FOUND)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_SNDIO")
|
||||||
|
endif()
|
||||||
|
|
||||||
elseif (NOT WIN32 AND NOT CYGWIN)
|
elseif (NOT WIN32 AND NOT CYGWIN)
|
||||||
find_package(Portaudio REQUIRED)
|
find_package(Portaudio REQUIRED)
|
||||||
if(PORTAUDIO_FOUND)
|
if(PORTAUDIO_FOUND)
|
||||||
|
@ -314,6 +324,8 @@ else()
|
||||||
set(UDEV_LIBRARIES "")
|
set(UDEV_LIBRARIES "")
|
||||||
set(PORTAUDIO_INCLUDE_DIRS "")
|
set(PORTAUDIO_INCLUDE_DIRS "")
|
||||||
set(PORTAUDIO_LIBRARIES "")
|
set(PORTAUDIO_LIBRARIES "")
|
||||||
|
set(SNDIO_INCLUDE_DIRS "")
|
||||||
|
set(SNDIO_LIBRARIES "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# manage and fetch new data
|
# manage and fetch new data
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
# - Try to find sndio
|
||||||
|
#
|
||||||
|
# SNDIO_FOUND - system has sndio
|
||||||
|
# SNDIO_LIBRARIES - location of the library for sndio
|
||||||
|
# SNDIO_INCLUDE_DIRS - location of the include files for sndio
|
||||||
|
|
||||||
|
set(SNDIO_ROOT_DIR
|
||||||
|
"${SNDIO_ROOT_DIR}"
|
||||||
|
CACHE
|
||||||
|
PATH
|
||||||
|
"Directory to search for sndio")
|
||||||
|
|
||||||
|
# no need to check pkg-config
|
||||||
|
|
||||||
|
find_path(SNDIO_INCLUDE_DIRS
|
||||||
|
NAMES
|
||||||
|
sndio.h
|
||||||
|
PATHS
|
||||||
|
/usr/local/include
|
||||||
|
/usr/include
|
||||||
|
/opt/local/include
|
||||||
|
HINTS
|
||||||
|
${SNDIO_ROOT_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(SNDIO_LIBRARIES
|
||||||
|
NAMES
|
||||||
|
sndio
|
||||||
|
PATHS
|
||||||
|
/usr/local/lib
|
||||||
|
/usr/lib
|
||||||
|
/usr/lib64
|
||||||
|
/opt/local/lib
|
||||||
|
HINTS
|
||||||
|
${SNDIIO_ROOT_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(SNDIO DEFAULT_MSG SNDIO_INCLUDE_DIRS SNDIO_LIBRARIES)
|
||||||
|
|
||||||
|
mark_as_advanced(SNDIO_INCLUDE_DIRS SNDIO_LIBRARIES)
|
|
@ -8,6 +8,7 @@ include_directories(
|
||||||
${ALSA_INCLUDE_DIRS}
|
${ALSA_INCLUDE_DIRS}
|
||||||
${UDEV_INCLUDE_DIRS}
|
${UDEV_INCLUDE_DIRS}
|
||||||
${PORTAUDIO_INCLUDE_DIRS}
|
${PORTAUDIO_INCLUDE_DIRS}
|
||||||
|
${SNDIO_INCLUDE_DIRS}
|
||||||
${CUSTOM_GEOTRANZ_DIR}
|
${CUSTOM_GEOTRANZ_DIR}
|
||||||
${CUSTOM_HIDAPI_DIR}
|
${CUSTOM_HIDAPI_DIR}
|
||||||
)
|
)
|
||||||
|
@ -116,7 +117,11 @@ if(LINUX)
|
||||||
list(REMOVE_ITEM direwolf_SOURCES
|
list(REMOVE_ITEM direwolf_SOURCES
|
||||||
dwgpsd.c
|
dwgpsd.c
|
||||||
)
|
)
|
||||||
else() # macOS freebsd openbsd
|
elseif(HAVE_SNDIO)
|
||||||
|
list(APPEND direwolf_SOURCES
|
||||||
|
audio.c
|
||||||
|
)
|
||||||
|
else() # macOS freebsd
|
||||||
list(APPEND direwolf_SOURCES
|
list(APPEND direwolf_SOURCES
|
||||||
audio_portaudio.c
|
audio_portaudio.c
|
||||||
)
|
)
|
||||||
|
@ -143,6 +148,7 @@ target_link_libraries(direwolf
|
||||||
${ALSA_LIBRARIES}
|
${ALSA_LIBRARIES}
|
||||||
${UDEV_LIBRARIES}
|
${UDEV_LIBRARIES}
|
||||||
${PORTAUDIO_LIBRARIES}
|
${PORTAUDIO_LIBRARIES}
|
||||||
|
${SNDIO_LIBRARIES}
|
||||||
${AVAHI_LIBRARIES}
|
${AVAHI_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue