Files
86Box/src/sound/CMakeLists.txt

135 lines
4.0 KiB
CMake
Raw Normal View History

2021-01-12 18:05:25 +01:00
#
# 86Box A hypervisor and IBM PC system emulator that specializes in
# running old operating systems and software designed for IBM
# PC systems and compatibles from 1981 through fairly recent
# system designs based on the PCI bus.
2021-01-12 18:05:25 +01:00
#
# This file is part of the 86Box distribution.
2021-01-12 18:05:25 +01:00
#
# CMake build script.
2021-01-12 18:05:25 +01:00
#
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
2021-01-12 18:05:25 +01:00
#
2023-01-06 15:36:29 -05:00
# Copyright 2020-2021 David Hrdlička.
2021-01-12 18:05:25 +01:00
#
add_library(snd OBJECT sound.c snd_opl.c snd_opl_nuked.c snd_opl_ymfm.cpp snd_resid.cc
2022-03-11 20:41:00 +01:00
midi.c snd_speaker.c snd_pssj.c snd_lpt_dac.c snd_ac97_codec.c snd_ac97_via.c
snd_lpt_dss.c snd_ps1.c snd_adlib.c snd_adlibgold.c snd_ad1848.c snd_audiopci.c
snd_azt2316a.c snd_cms.c snd_cmi8x38.c snd_cs423x.c snd_gus.c snd_sb.c snd_sb_dsp.c
snd_emu8k.c snd_mpu401.c snd_sn76489.c snd_ssi2001.c snd_wss.c snd_ym7128.c
snd_optimc.c)
2021-01-12 18:22:40 +01:00
if(OPENAL)
if(VCPKG_TOOLCHAIN)
find_package(OpenAL CONFIG REQUIRED)
elseif(MINGW)
find_package(OpenAL MODULE REQUIRED)
2022-02-19 15:35:10 +06:00
else()
find_package(OpenAL REQUIRED)
endif()
if(TARGET OpenAL::OpenAL)
target_link_libraries(86Box OpenAL::OpenAL)
else()
target_link_libraries(86Box ${OPENAL_LIBRARY})
endif()
2022-07-13 17:03:21 +02:00
include_directories(${OPENAL_INCLUDE_DIR})
target_sources(snd PRIVATE openal.c)
else()
if(WIN32)
option(FAUDIO "Use FAudio instead of XAudio2" OFF)
endif()
target_sources(snd PRIVATE xaudio2.c)
if(NOT WIN32 OR FAUDIO)
find_package(PkgConfig REQUIRED)
# Use FAudio, a reimplementation of XAudio2
pkg_check_modules(FAUDIO IMPORTED_TARGET FAudio)
if(FAUDIO_FOUND)
target_link_libraries(86Box PkgConfig::FAUDIO)
else()
find_path(FAUDIO_INCLUDE_DIR NAMES "FAudio.h")
find_library(FAUDIO_LIBRARY FAudio)
target_link_libraries(86Box ${FAUDIO_LIBRARY})
endif()
2022-07-13 17:03:21 +02:00
include_directories(${FAUDIO_INCLUDE_DIRS})
set_property(SOURCE xaudio2.c PROPERTY COMPILE_DEFINITIONS USE_FAUDIO)
2022-02-19 15:35:10 +06:00
endif()
2022-01-29 20:25:00 -05:00
endif()
2022-03-11 20:41:00 +01:00
if(RTMIDI)
if(VCPKG_TOOLCHAIN)
# vcpkg includes a config file for rtmidi
find_package(RtMidi REQUIRED)
target_link_libraries(86Box RtMidi::rtmidi)
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(RTMIDI REQUIRED IMPORTED_TARGET rtmidi)
target_link_libraries(86Box PkgConfig::RTMIDI)
if(WIN32)
target_link_libraries(PkgConfig::RTMIDI INTERFACE winmm)
endif()
endif()
target_compile_definitions(snd PRIVATE USE_RTMIDI)
target_sources(snd PRIVATE midi_rtmidi.cpp)
endif()
2021-01-12 18:22:40 +01:00
if(FLUIDSYNTH)
2023-07-08 13:49:02 -03:00
find_package(PkgConfig REQUIRED)
pkg_check_modules(FLUIDSYNTH REQUIRED IMPORTED_TARGET fluidsynth)
target_link_libraries(86Box PkgConfig::FLUIDSYNTH)
2023-07-10 23:14:17 -03:00
if(STATIC_BUILD)
target_link_libraries(86Box -static ${FLUIDSYNTH_STATIC_LIBRARIES} -fopenmp)
endif()
2023-07-08 13:49:02 -03:00
target_compile_definitions(snd PRIVATE USE_FLUIDSYNTH)
target_sources(snd PRIVATE midi_fluidsynth.c)
2021-01-12 18:22:40 +01:00
endif()
if(MUNT)
target_compile_definitions(snd PRIVATE USE_MUNT)
target_sources(snd PRIVATE midi_mt32.c)
2021-01-12 18:22:40 +01:00
option(MUNT_EXTERNAL "Link against the system-provided MUNT library" OFF)
mark_as_advanced(MUNT_EXTERNAL)
if(MUNT_EXTERNAL)
find_package(PkgConfig REQUIRED)
pkg_check_modules(MT32EMU REQUIRED IMPORTED_TARGET mt32emu)
target_link_libraries(86Box PkgConfig::MT32EMU)
else()
add_subdirectory(munt)
target_link_libraries(86Box mt32emu)
endif()
2021-01-12 18:22:40 +01:00
endif()
add_subdirectory(ymfm)
target_link_libraries(86Box ymfm)
2021-01-12 18:22:40 +01:00
if(PAS16)
target_compile_definitions(snd PRIVATE USE_PAS16)
target_sources(snd PRIVATE snd_pas16.c)
2021-01-12 18:22:40 +01:00
endif()
if(GUSMAX)
target_compile_definitions(snd PRIVATE USE_GUSMAX)
2021-01-12 18:22:40 +01:00
endif()
if(OPL4ML)
target_compile_definitions(snd PRIVATE USE_OPL4ML)
2024-02-14 03:02:14 +06:00
target_sources(snd PRIVATE midi_opl4.c midi_opl4_yrw801.c)
endif()
2021-01-12 18:22:40 +01:00
add_subdirectory(resid-fp)
2022-02-19 15:35:10 +06:00
target_link_libraries(86Box resid-fp)