-
-
Notifications
You must be signed in to change notification settings - Fork 235
/
CMakeLists.txt
65 lines (49 loc) · 2.24 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
cmake_minimum_required(VERSION 3.16)
if (DEFINED ESP_PLATFORM)
# idf component
idf_component_register(
# SRC_DIRS src
INCLUDE_DIRS src
REQUIRES bt esp_common freertos hal log nvs_flash driver
)
target_compile_options(${COMPONENT_LIB} INTERFACE -DESP32_CMAKE=1 -Wno-error -Wno-format -fpermissive)
else()
# set the project name
project(arduino-audio-tools)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
set(FETCHCONTENT_UPDATES_DISCONNECTED ON)
add_compile_options(-Wno-deprecated-declarations)
include(FetchContent)
add_library(arduino-audio-tools INTERFACE)
option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)
option(ADD_PORTAUDIO "Add Portaudio Library" ON)
option(ADD_ARDUINO_EMULATOR "Add Arduino Emulator Library" ON)
# make include directory available to calling projects
target_include_directories (arduino-audio-tools INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src)
# installation of all header files
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/" # source directory
DESTINATION "include/arduino-audio-tools" # target directory
FILES_MATCHING # install only matched files
PATTERN "*.h" # select header files
)
if (ADD_PORTAUDIO)
add_compile_options(-DIS_DESKTOP)
# Add Portaduio for desktop build
FetchContent_Declare(portaudio GIT_REPOSITORY "https://github.com/PortAudio/portaudio.git" GIT_TAG v19.7.0 )
FetchContent_GetProperties(portaudio)
if(NOT portaudio_POPULATED)
FetchContent_Populate(portaudio)
add_subdirectory(${portaudio_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/portaudio)
endif()
endif()
if (ADD_ARDUINO_EMULATOR)
# Build with Linux Arduino Emulator
FetchContent_Declare(arduino_emulator GIT_REPOSITORY "https://github.com/pschatzmann/Arduino-Emulator.git" GIT_TAG main )
FetchContent_GetProperties(arduino_emulator)
if(NOT arduino_emulator_POPULATED)
FetchContent_Populate(arduino_emulator)
add_subdirectory(${arduino_emulator_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/emulator)
endif()
endif()
endif()