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

Add install libsoundio-config.cmake #220

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

UnaNancyOwen
Copy link

@UnaNancyOwen UnaNancyOwen commented Sep 21, 2019

This pull-request will change to install libsoundio-config.cmake.
It makes possible to users to find libraries using find_package(libsoundio) in CMakeLists.txt.

cmake_minimum_required(VERSION 3.6)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

project(sample)
add_executable(sample main.cpp)

find_package(libsoundio REQUIRED)

if(libsoundio_FOUND)
    target_link_libraries(sample libsoundio::libsoundio)
endif()

I have confirmed that this change works correctly on Windows.
unit_tests are all OK (success).

PS C:\libsoundio\build\Release> .\unit_tests.exe
testing os_get_time...OK
testing create output stream...OK
testing mirrored memory...OK
testing soundio_device_nearest_sample_rate...OK
testing ring buffer basic...OK
testing ring buffer threaded...OK

However, it has not been tested on Linux and Mac yet.
It is necessary to test on Linux and Mac, because CMakeLists.txt has changed significantly.
Please try test on Linux and Mac.

(This pull-request change CMake option to BUILD_SHARED_LIBS from BUILD_DYNAMIC_LIBS.
BUILD_STATIC_LIBS option has been discontinued along with that. If you build static link library, Please set BUILD_SHARED_LIBS option to OFF.)

This change will install libsoundio-confing.cmake. It makes possible to users to find libraries using find_package(libsoundio) in CMakeLists.txt.
This change will fix build example and test with Visual C++.
@UnaNancyOwen
Copy link
Author

UnaNancyOwen commented Sep 22, 2019

I was finished fixes this pull-request.
It is work correctly on Windows and Linux (Ubunts 18.04 LTS). Perhaps, It will also work on Mac.

t_sugiura0204@ubuntu:~/libsoundio/build$ ./unit_tests
testing os_get_time...OK
testing create output stream...OK
testing mirrored memory...OK
testing soundio_device_nearest_sample_rate...OK
testing ring buffer basic...OK
testing ring buffer threaded...OK

@UnaNancyOwen
Copy link
Author

@andrewrk Please review this pull-request! Thanks,

@janhenke
Copy link

janhenke commented Apr 3, 2022

@andrewrk I was searching for exactly this feature today. Would you mind taking a look at this PR and consider merging it? It would be tremendously useful for consumers of the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants