arduino-audio-tools/CMakeLists.txt

66 lines
2.2 KiB
CMake
Raw Permalink Normal View History

cmake_minimum_required(VERSION 3.16)
2021-07-05 06:12:24 +00:00
2024-06-20 12:03:55 +00:00
if (DEFINED ESP_PLATFORM)
2021-07-05 06:12:24 +00:00
2024-06-20 12:03:55 +00:00
# idf component
idf_component_register(
2024-08-01 02:23:14 +00:00
# SRC_DIRS src
2024-06-20 12:03:55 +00:00
INCLUDE_DIRS src
REQUIRES bt esp_common freertos hal log nvs_flash driver
)
2023-02-01 14:30:46 +00:00
2024-08-01 02:23:14 +00:00
target_compile_options(${COMPONENT_LIB} INTERFACE -DESP32_CMAKE=1 -Wno-error -Wno-format -fpermissive)
2022-08-31 05:46:32 +00:00
2024-06-20 12:03:55 +00:00
else()
2021-07-05 06:36:48 +00:00
2024-06-20 12:03:55 +00:00
# set the project name
project(arduino-audio-tools)
2022-02-25 08:13:07 +00:00
2024-06-20 12:03:55 +00:00
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)
2022-02-25 08:13:07 +00:00
2024-06-20 12:03:55 +00:00
include(FetchContent)
2021-07-06 22:03:59 +00:00
2024-06-20 12:03:55 +00:00
add_library(arduino-audio-tools INTERFACE)
2024-06-20 12:03:55 +00:00
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()
2022-08-31 05:46:32 +00:00
endif()
2023-04-24 17:15:51 +00:00
2024-06-20 12:03:55 +00:00
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()
2022-08-31 05:46:32 +00:00
endif()
2024-06-20 12:03:55 +00:00
2022-02-25 08:13:07 +00:00
endif()