forked from pschatzmann/arduino-snapclient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
77 lines (59 loc) · 2.77 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
cmake_minimum_required(VERSION 3.16)
# set the project name
project(snapclient)
# we use FetchContent to install
include(FetchContent)
set(CMAKE_CXX_STANDARD 17)
# Disable Portaudio
option(ADD_PORTAUDIO "Do not use Portaudio" OFF)
option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)
set(CODEC "opus" CACHE STRING "codec selected by the user")
set_property(CACHE CODEC PROPERTY STRINGS flac ogg opus pcm)
# lots of warnings and all warnings as errors ?
## add_compile_options(-Wall -Wextra )
# audio tools
FetchContent_Declare(arduino-audio-tools GIT_REPOSITORY https://github.com/pschatzmann/arduino-audio-tools.git GIT_TAG main )
FetchContent_GetProperties(arduino-audio-tools)
if(NOT arduino-audio-tools_POPULATED)
FetchContent_Populate(arduino-audio-tools)
add_subdirectory(${arduino-audio-tools_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/arduino-audio-tools)
endif()
# opus
FetchContent_Declare(arduino_libopus GIT_REPOSITORY https://github.com/pschatzmann/arduino-libopus.git GIT_TAG main )
FetchContent_GetProperties(arduino_libopus)
if(NOT arduino_libopus_POPULATED)
FetchContent_Populate(arduino_libopus)
add_subdirectory(${arduino_libopus_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/arduino_libopus)
endif()
# flac
if(CODEC==flac)
FetchContent_Declare(arduino_libflac GIT_REPOSITORY https://github.com/pschatzmann/arduino-libflac.git GIT_TAG main )
FetchContent_GetProperties(arduino_libflac)
if(NOT arduino_libflac_POPULATED)
FetchContent_Populate(arduino_libflac)
add_subdirectory(${arduino_libflac_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/arduino_libflac)
endif()
endif()
# ogg
if(CODEC==ogg)
FetchContent_Declare(arduino_libvorbis GIT_REPOSITORY https://github.com/pschatzmann/arduino-libvorbis-idec GIT_TAG main )
FetchContent_GetProperties(arduino_libvorbis)
if(NOT arduino_libvorbis_POPULATED)
FetchContent_Populate(arduino_libvorbis)
add_subdirectory(${arduino_libvorbis_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/arduino_libvorbis)
endif()
endif()
add_library(snapclient INTERFACE)
# define location for header files
target_include_directories(snapclient INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src )
# specify libraries
if(CODEC==opus)
target_link_libraries(snapclient INTERFACE arduino-audio-tools arduino_emulator arduino_libopus)
endif()
if(CODEC==flac)
target_link_libraries(snapclient INTERFACE arduino-audio-tools arduino_emulator arduino_libopus arduino_libflac)
endif()
if(CODEC==ogg)
target_link_libraries(snapclient INTERFACE arduino-audio-tools arduino_emulator arduino_libopus arduino_libvorbis)
endif()
target_compile_definitions(snapclient INTERFACE -DARDUINO -DEXIT_ON_STOP -DIS_DESKTOP -DCONFIG_USE_RTOS=0 -DCONFIG_USE_PSRAM=0 -DCONFIG_SNAPCLIENT_SNTP_ENABLE=0 -DCONFIG_SNAPCLIENT_USE_MDNS=0)