mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-13 15:07:01 +03:00
idf overriding method to bring back SPDIF and fix SPI + new CSPOT (which crashes)
This commit is contained in:
@@ -1,66 +1,40 @@
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project(cspot)
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.9)
|
||||
set (CMAKE_CXX_STANDARD 17)
|
||||
# Configurable options
|
||||
set(CSPOT_EXTERNAL_BELL "" CACHE STRING "External bell library target name, optional")
|
||||
|
||||
# CMake options
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# Main library sources
|
||||
file(GLOB SOURCES "src/*.cpp" "src/*.c")
|
||||
|
||||
if (NOT DEFINED ${USE_EXTERNAL_BELL})
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/bell ${CMAKE_CURRENT_BINARY_DIR}/bell)
|
||||
# Use externally specified bell library or the submodule
|
||||
if(CSPOT_EXTERNAL_BELL)
|
||||
list(APPEND EXTRA_LIBS ${CSPOT_EXTERNAL_BELL})
|
||||
else()
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/bell)
|
||||
list(APPEND EXTRA_LIBS bell)
|
||||
endif()
|
||||
# Add platform specific sources
|
||||
# if(${ESP_PLATFORM})
|
||||
# file(GLOB ESP_PLATFORM_SOURCES "src/platform/esp/*.cpp" "src/platform/esp/*.c")
|
||||
# set(SOURCES ${SOURCES} ${ESP_PLATFORM_SOURCES} )
|
||||
# endif()
|
||||
|
||||
# if(UNIX)
|
||||
# file(GLOB UNIX_PLATFORM_SOURCES "src/platform/unix/*.cpp" "src/platform/unix/*.c")
|
||||
# set(SOURCES ${SOURCES} ${UNIX_PLATFORM_SOURCES} )
|
||||
# endif()
|
||||
|
||||
# if(APPLE)
|
||||
# file(GLOB APPLE_PLATFORM_SOURCES "src/platform/apple/*.cpp" "src/platform/apple/*.c")
|
||||
# set(SOURCES ${SOURCES} ${APPLE_PLATFORM_SOURCES} )
|
||||
# endif()
|
||||
|
||||
# if(UNIX AND NOT APPLE)
|
||||
# # file(GLOB LINUX_PLATFORM_SOURCES "src/platform/linux/*.cpp" "src/platform/linux/*.c")
|
||||
# # set(SOURCES ${SOURCES} ${LINUX_PLATFORM_SOURCES} )
|
||||
# # endif()
|
||||
|
||||
|
||||
# if(${ESP_PLATFORM})
|
||||
# list(REMOVE_ITEM SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/CryptoOpenSSL.cpp) # use MBedTLS
|
||||
# idf_build_set_property(COMPILE_DEFINITIONS "-DCSPOT_USE_MBEDTLS" APPEND)
|
||||
# set(EXTRA_REQ_LIBS idf::mbedtls idf::pthread idf::mdns)
|
||||
# add_definitions(-Wunused-const-variable -Wchar-subscripts -Wunused-label -Wmaybe-uninitialized -Wmisleading-indentation)
|
||||
# else()
|
||||
# list(REMOVE_ITEM SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/CryptoMbedTLS.cpp) # use OpenSSL
|
||||
# find_package(OpenSSL REQUIRED)
|
||||
# if(OPENSSL_FOUND)
|
||||
# set(OPENSSL_USE_STATIC_LIBS TRUE)
|
||||
# endif()
|
||||
# set(EXTRA_REQ_LIBS OpenSSL::Crypto Threads::Threads)
|
||||
# set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
# find_package(Threads REQUIRED)
|
||||
# endif()
|
||||
|
||||
# Add Apple Bonjour compatibility library for Linux
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(EXTRA_REQ_LIBS ${EXTRA_REQ_LIBS} dns_sd) # add apple bonjur compatibility library for linux
|
||||
list(APPEND EXTRA_LIBS dns_sd)
|
||||
# TODO: migrate from this to native linux mDNS
|
||||
endif()
|
||||
set(NANOPB_OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(PROTOS protobuf/authentication.proto protobuf/mercury.proto protobuf/keyexchange.proto protobuf/spirc.proto protobuf/metadata.proto)
|
||||
message(${PROTOS})
|
||||
message("building protobuf")
|
||||
message(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
nanopb_generate_cpp(PROTO_SRCS PROTO_HDRS RELPATH ${CMAKE_CURRENT_SOURCE_DIR} ${PROTOS})
|
||||
add_custom_target(generate_proto_sources DEPENDS ${PROTO_SRCS} ${PROTO_HDRS})
|
||||
set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS}
|
||||
PROPERTIES GENERATED TRUE)
|
||||
|
||||
include_directories("include")
|
||||
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
|
||||
include_directories("protos")
|
||||
|
||||
message(${CMAKE_CURRENT_SOURCE_DIR}/cmake/generate_protos.sh)
|
||||
execute_process(COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/cmake/generate_protos.sh" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
set(SOURCES ${SOURCES} "protos/AnyRefImpl.cpp" "protos/ReflectTypeInfo.cpp")
|
||||
|
||||
add_library(cspot STATIC ${SOURCES})
|
||||
target_link_libraries(cspot PRIVATE bell ${EXTRA_REQ_LIBS})
|
||||
|
||||
target_include_directories(cspot PUBLIC "include" "protos" bell ${EXTRA_REQ_LIBS} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_library(cspot STATIC ${SOURCES} ${PROTO_SRCS})
|
||||
# PUBLIC to propagate includes from bell to cspot dependents
|
||||
target_link_libraries(cspot PUBLIC ${EXTRA_LIBS})
|
||||
target_include_directories(cspot PUBLIC "include" ${CMAKE_CURRENT_BINARY_DIR} ${NANOPB_INCLUDE_DIRS})
|
||||
|
||||
Reference in New Issue
Block a user