Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable optional SDK mode (install files required to build apps with apulse) #93

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
project(apulse)
cmake_minimum_required (VERSION 2.8)
include(GNUInstallDirs)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -fPIC -fvisibility=hidden")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=implicit-function-declaration")
Expand Down Expand Up @@ -28,6 +29,8 @@ else()
include_directories(${PA_INCLUDE_DIRECTORIES})
endif()

set(INSTALL_SDK 0 CACHE BOOLEAN "Install SDK files to build applications with apulse (Pulse Audio headers and pkg-config files) instead of system ones")

link_directories(${REQ_LIBRARY_DIRS})

add_library(trace-helper STATIC
Expand Down Expand Up @@ -72,12 +75,30 @@ target_link_libraries(pulse-simple ${SYMBOLMAP} trace-helper ${REQ_LIBRARIES})

add_subdirectory(tests)

set(APULSEPATH "${CMAKE_INSTALL_PREFIX}/lib/apulse" CACHE PATH "library installation directory")
set(APULSE_SEARCH_PATHS "${APULSEPATH}" CACHE PATH "directory list for LD_LIBRARY_PATH")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/apulse.template"
"${CMAKE_CURRENT_BINARY_DIR}/apulse" @ONLY)
if (${INSTALL_SDK})
set(APULSEPATH "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "library installation directory")

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/libpulse.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/libpulse.pc" @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/libpulse-simple.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/libpulse-simple.pc" @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/libpulse-mainloop-glib.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/libpulse-mainloop-glib.pc" @ONLY)
else()
set(APULSEPATH "${CMAKE_INSTALL_LIBDIR}/apulse" CACHE PATH "library installation directory")
set(APULSE_SEARCH_PATHS "${CMAKE_INSTALL_PREFIX}/${APULSEPATH}" CACHE PATH "directory list for LD_LIBRARY_PATH")

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/apulse.template"
"${CMAKE_CURRENT_BINARY_DIR}/apulse" @ONLY)
endif()

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/apulse" DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(TARGETS pulse-simple pulse pulse-mainloop-glib DESTINATION "${APULSEPATH}")
install(FILES "${CMAKE_SOURCE_DIR}/man/apulse.1" DESTINATION share/man/man1)

if (${INSTALL_SDK})
install(DIRECTORY "${CMAKE_SOURCE_DIR}/3rdparty/pulseaudio-headers/pulse" DESTINATION include)
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig" DESTINATION "${CMAKE_INSTALL_LIBDIR}")
else()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/apulse" DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(FILES "${CMAKE_SOURCE_DIR}/man/apulse.1" DESTINATION share/man/man1)
endif()
9 changes: 9 additions & 0 deletions pkgconfig/libpulse-mainloop-glib.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@

Name: libpulse-mainloop-glib
Description: PulseAudio GLib 2.0 Main Loop Wrapper (apulse)
Version: 5.0
Libs: -L${libdir} -lpulse-mainloop-glib -pthread
Cflags: -I${includedir}
Requires: glib-2.0
9 changes: 9 additions & 0 deletions pkgconfig/libpulse-simple.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@

Name: libpulse-simple
Description: PulseAudio Simplified Synchronous Client Interface (apulse)
Version: 5.0
Libs: -L${libdir} -lpulse-simple -pthread
Cflags: -I${includedir}
Requires: glib-2.0
9 changes: 9 additions & 0 deletions pkgconfig/libpulse.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@

Name: libpulse
Description: PulseAudio Client Interface (apulse)
Version: 5.0
Libs: -L${libdir} -lpulse -pthread
Cflags: -I${includedir}
Requires: glib-2.0 alsa