mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2024-12-22 23:25:34 +00:00
closer to building on windows
This commit is contained in:
parent
a659adebd0
commit
efe95ded36
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
build/
|
||||
build-win/
|
||||
|
|
|
@ -16,15 +16,56 @@ set(LIBSOUNDIO_VERSION_PATCH 0)
|
|||
set(LIBSOUNDIO_VERSION "${LIBSOUNDIO_VERSION_MAJOR}.${LIBSOUNDIO_VERSION_MINOR}.${LIBSOUNDIO_VERSION_PATCH}")
|
||||
message("Configuring libsoundio version ${LIBSOUNDIO_VERSION}")
|
||||
|
||||
find_package(Threads)
|
||||
if(Threads_FOUND)
|
||||
set(STATUS_THREADS "OK")
|
||||
else(Threads_FOUND)
|
||||
set(STATUS_THREADS "not found")
|
||||
endif(Threads_FOUND)
|
||||
|
||||
|
||||
if(WIN32)
|
||||
set(SOUNDIO_HAVE_PULSEAUDIO false)
|
||||
set(STATUS_PULSEAUDIO "disabled")
|
||||
else()
|
||||
find_package(PulseAudio)
|
||||
if(PULSEAUDIO_FOUND)
|
||||
set(STATUS_PULSEAUDIO "OK")
|
||||
set(SOUNDIO_HAVE_PULSEAUDIO true)
|
||||
else()
|
||||
set(STATUS_PULSEAUDIO "not found")
|
||||
set(SOUNDIO_HAVE_PULSEAUDIO false)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE OR WIN32)
|
||||
set(SOUNDIO_HAVE_ALSA false)
|
||||
set(STATUS_ALSA "disabled")
|
||||
else()
|
||||
find_package(ALSA)
|
||||
if(ALSA_FOUND)
|
||||
set(STATUS_ALSA "OK")
|
||||
set(SOUNDIO_HAVE_ALSA true)
|
||||
else()
|
||||
set(STATUS_ALSA "not found")
|
||||
set(SOUNDIO_HAVE_ALSA false)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(LIBSOUNDIO_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/src/soundio.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/util.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/os.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/dummy.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/pulseaudio.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/dummy_ring_buffer.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/channel_layout.cpp"
|
||||
)
|
||||
if(SOUNDIO_HAVE_PULSEAUDIO)
|
||||
set(LIBSOUNDIO_SOURCES ${LIBSOUNDIO_SOURCES}
|
||||
"${CMAKE_SOURCE_DIR}/src/pulseaudio.cpp"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CONFIGURE_OUT_FILE "${CMAKE_BINARY_DIR}/config.h")
|
||||
set(LIBSOUNDIO_HEADERS
|
||||
"${CMAKE_SOURCE_DIR}/src/soundio.h"
|
||||
|
@ -35,33 +76,6 @@ set(TEST_SOURCES
|
|||
"${CMAKE_SOURCE_DIR}/test/unit_tests.cpp"
|
||||
)
|
||||
|
||||
find_package(Threads)
|
||||
if(Threads_FOUND)
|
||||
set(STATUS_THREADS "OK")
|
||||
else(Threads_FOUND)
|
||||
set(STATUS_THREADS "not found")
|
||||
endif(Threads_FOUND)
|
||||
|
||||
|
||||
find_package(PulseAudio)
|
||||
if(PULSEAUDIO_FOUND)
|
||||
set(STATUS_PULSEAUDIO "OK")
|
||||
else()
|
||||
set(STATUS_PULSEAUDIO "not found")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(SOUNDIO_HAVE_ALSA false)
|
||||
set(STATUS_ALSA "OK")
|
||||
else()
|
||||
set(SOUNDIO_HAVE_ALSA true)
|
||||
find_package(ALSA)
|
||||
if(ALSA_FOUND)
|
||||
set(STATUS_ALSA "OK")
|
||||
else()
|
||||
set(STATUS_ALSA "not found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# GTFO, -lstdc++ !!
|
||||
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
|
||||
|
|
32
README.md
32
README.md
|
@ -36,6 +36,38 @@ libsoundio is programmed in a tiny subset of C++:
|
|||
* No references.
|
||||
* No linking against libstdc++.
|
||||
|
||||
### Building
|
||||
|
||||
```
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake ..
|
||||
$ make
|
||||
$ sudo make install
|
||||
```
|
||||
|
||||
### Building With MXE
|
||||
|
||||
You can build libsoundio with [mxe](http://mxe.cc/). Follow the
|
||||
[requirements](http://mxe.cc/#requirements) section to install the
|
||||
packages necessary on your system. Then somewhere on your file system:
|
||||
|
||||
```
|
||||
$ git clone https://github.com/mxe/mxe
|
||||
$ cd mxe
|
||||
$ make gcc
|
||||
```
|
||||
|
||||
Then in the libsoundio source directory (replace "/path/to/mxe" with the
|
||||
appropriate path):
|
||||
|
||||
```
|
||||
$ mkdir build-win
|
||||
$ cd build-win
|
||||
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=/path/to/mxe/usr/i686-w64-mingw32.static/share/cmake/mxe-conf.cmake
|
||||
$ make
|
||||
```
|
||||
|
||||
## Roadmap
|
||||
|
||||
0. ALSA (Linux)
|
||||
|
|
|
@ -7,5 +7,6 @@
|
|||
#define SOUNDIO_VERSION_STRING "@LIBSOUNDIO_VERSION@"
|
||||
|
||||
#cmakedefine SOUNDIO_HAVE_ALSA
|
||||
#cmakedefine SOUNDIO_HAVE_PULSEAUDIO
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,8 +8,12 @@
|
|||
#include "soundio.hpp"
|
||||
#include "util.hpp"
|
||||
#include "dummy.hpp"
|
||||
#include "pulseaudio.hpp"
|
||||
#include "os.hpp"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef SOUNDIO_HAVE_PULSEAUDIO
|
||||
#include "pulseaudio.hpp"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
@ -84,12 +88,14 @@ struct SoundIo * soundio_create(void) {
|
|||
int soundio_connect(struct SoundIo *soundio) {
|
||||
int err;
|
||||
|
||||
#ifdef SOUNDIO_HAVE_PULSEAUDIO
|
||||
soundio->current_backend = SoundIoBackendPulseAudio;
|
||||
err = soundio_pulseaudio_init(soundio);
|
||||
if (err != SoundIoErrorInitAudioBackend) {
|
||||
soundio_disconnect(soundio);
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
soundio->current_backend = SoundIoBackendDummy;
|
||||
err = soundio_dummy_init(soundio);
|
||||
|
|
Loading…
Reference in a new issue