cmake_minimum_required(VERSION 3.0) project(cpp-mods.audioplayer) set(SOURCE_FILES audioplayer.cpp) add_custom_target(audioplayer.include_files SOURCES player_sdl.h player_win.h player_linux.h player_sl.h player_osx.h) if(ANDROID_ABI) find_library(SLES_LIB OpenSLES REQUIRED) set(EXTRA_LIBS ${EXTRA_LIBS} ${SLES_LIB}) set(SOURCE_FILES ${SOURCE_FILES} player_sl.cpp) elseif(EMSCRIPTEN) add_definitions(-DSDL_AUDIO) #set(SOURCE_FILES ${SOURCE_FILES} player_sdl.cpp) elseif(APPLE) find_library(AUDIOTOOLBOX AudioToolbox) set(EXTRA_LIBS ${EXTRA_LIBS} ${AUDIOTOOLBOX}) add_definitions(-DOSX_AUDIO) elseif(WIN32) set(SOURCE_FILES ${SOURCE_FILES} player_win.cpp) set(EXTRA_LIBS ${EXTRA_LIBS} winmm.lib) else() add_definitions(-DLINUX) find_library(ASOUND_LIBRARY asound REQUIRED) find_path(ASOUND_INCLUDE alsa/asoundlib.h REQUIRED) set(EXTRA_LIBS ${EXTRA_LIBS} ${ASOUND_LIBRARY}) include_directories(${ASOUND_INCLUDE}) endif() add_library(audioplayer ${SOURCE_FILES}) target_link_libraries(audioplayer coreutils ${EXTRA_LIBS}) target_include_directories(audioplayer PUBLIC ..)