From 3172576fc1be29dcf2e234d58e2bb02985270b1f Mon Sep 17 00:00:00 2001 From: philippe44 Date: Thu, 17 Nov 2022 16:36:25 -0800 Subject: [PATCH] update CMake file --- components/spotify/cspot/bell/CMakeLists.txt | 74 +++++++++----------- 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/components/spotify/cspot/bell/CMakeLists.txt b/components/spotify/cspot/bell/CMakeLists.txt index c2f6e1cf..8342f077 100644 --- a/components/spotify/cspot/bell/CMakeLists.txt +++ b/components/spotify/cspot/bell/CMakeLists.txt @@ -20,14 +20,10 @@ set(BELL_EXTERNAL_CJSON "" CACHE STRING "External cJSON library target name, opt if(BELL_EXTERNAL_MBEDTLS) set(MbedTLS_DIR ${BELL_EXTERNAL_MBEDTLS}) - message(STATUS "Setting local mbedtls ${MbedTLS_DIR}") + message(STATUS "Setting local mbedtls ${MbedTLS_DIR}") endif() # Backwards compatibility with deprecated options -if(BELL_EXTERNAL_TREMOR) - message(WARNING "Deprecated Bell options used, replace BELL_EXTERNAL_TREMOR with BELL_CODEC_VORBIS=OFF") - set(BELL_CODEC_VORBIS OFF) -endif() if(BELL_USE_ALSA) message(WARNING "Deprecated Bell options used, replace BELL_USE_ALSA with BELL_SINK_ALSA") set(BELL_SINK_ALSA ${BELL_USE_ALSA}) @@ -89,8 +85,8 @@ if(UNIX AND NOT APPLE) endif() if(WIN32) file(GLOB WIN32_PLATFORM_SOURCES "src/platform/win32/*.cpp" "src/platform/win32/*.c") - list(APPEND SOURCES ${WIN32_PLATFORM_SOURCES}) - list(APPEND EXTRA_INCLUDES "include/platform/win32") + list(APPEND SOURCES ${WIN32_PLATFORM_SOURCES}) + list(APPEND EXTRA_INCLUDES "include/platform/win32") endif() # A hack to make Opus keep quiet @@ -104,36 +100,36 @@ if(ESP_PLATFORM) list(APPEND EXTRA_LIBS idf::mbedtls idf::pthread idf::mdns) add_definitions(-Wunused-const-variable -Wchar-subscripts -Wunused-label -Wmaybe-uninitialized -Wmisleading-indentation) else() - find_package(Threads REQUIRED) - set(THREADS_PREFER_PTHREAD_FLAG ON) - list(APPEND EXTRA_LIBS Threads::Threads) - - find_package(MbedTLS REQUIRED) - get_target_property(MBEDTLS_INFO MbedTLS::mbedtls INTERFACE_INCLUDE_DIRECTORIES) - list(APPEND EXTRA_INCLUDES ${MBEDTLS_INFO}) + find_package(Threads REQUIRED) + set(THREADS_PREFER_PTHREAD_FLAG ON) + list(APPEND EXTRA_LIBS Threads::Threads) + + find_package(MbedTLS REQUIRED) + get_target_property(MBEDTLS_INFO MbedTLS::mbedtls INTERFACE_INCLUDE_DIRECTORIES) + list(APPEND EXTRA_INCLUDES ${MBEDTLS_INFO}) - # try to handle mbedtls when not system-wide installed - if(BELL_EXTERNAL_MBEDTLS) - if(MSVC) - set(MBEDTLS_RELEASE "RELEASE" CACHE STRING "local mbedtls version") - else() - set(MBEDTLS_RELEASE "NOCONFIG" CACHE STRING "local mbedtls version") + # try to handle mbedtls when not system-wide installed + if(BELL_EXTERNAL_MBEDTLS) + if(MSVC) + set(MBEDTLS_RELEASE "RELEASE" CACHE STRING "local mbedtls version") + else() + set(MBEDTLS_RELEASE "NOCONFIG" CACHE STRING "local mbedtls version") endif() - message(STATUS "using local mbedtls version ${MBEDTLS_RELEASE}") + message(STATUS "using local mbedtls version ${MBEDTLS_RELEASE}") get_target_property(MBEDTLS_INFO MbedTLS::mbedtls IMPORTED_LOCATION_${MBEDTLS_RELEASE}) list(APPEND EXTRA_LIBS ${MBEDTLS_INFO}) get_target_property(MBEDTLS_INFO MbedTLS::mbedx509 IMPORTED_LOCATION_${MBEDTLS_RELEASE}) list(APPEND EXTRA_LIBS ${MBEDTLS_INFO}) get_target_property(MBEDTLS_INFO MbedTLS::mbedcrypto IMPORTED_LOCATION_${MBEDTLS_RELEASE}) list(APPEND EXTRA_LIBS ${MBEDTLS_INFO}) - else() + else() list(APPEND EXTRA_LIBS mbedtls mbedcrypto mbedx509) - endif() - + endif() + if(MSVC) add_compile_definitions(NOMINMAX _CRT_SECURE_NO_WARNINGS) add_definitions(/wd4068 /wd4244 /wd4018 /wd4101 /wd4102 /wd4142) - endif() + endif() endif() if(NOT BELL_DISABLE_CODECS) @@ -223,18 +219,18 @@ if(NOT BELL_DISABLE_SINKS) endif() # Find PortAudio if required, else remove the sink if(BELL_SINK_PORTAUDIO) - if(WIN32) - list(APPEND EXTRA_INCLUDES "portaudio/include") - if(NOT "${CMAKE_GENERATOR}" MATCHES "(Win64|IA64)") - list(APPEND EXTRA_LIBS "${CMAKE_CURRENT_SOURCE_DIR}/portaudio/portaudio_win32.lib") - else() - list(APPEND EXTRA_LIBS "${CMAKE_CURRENT_SOURCE_DIR}/portaudio/portaudio_x64.lib") - endif() - else() - find_package(portaudio REQUIRED) - list(APPEND EXTRA_INCLUDES ${PORTAUDIO_INCLUDE_DIRS}) - list(APPEND EXTRA_LIBS ${PORTAUDIO_LIBRARIES}) - endif() + if(WIN32) + list(APPEND EXTRA_INCLUDES "portaudio/include") + if(NOT "${CMAKE_GENERATOR}" MATCHES "(Win64|IA64)") + list(APPEND EXTRA_LIBS "${CMAKE_CURRENT_SOURCE_DIR}/portaudio/portaudio_win32.lib") + else() + list(APPEND EXTRA_LIBS "${CMAKE_CURRENT_SOURCE_DIR}/portaudio/portaudio_x64.lib") + endif() + else() + find_package(portaudio REQUIRED) + list(APPEND EXTRA_INCLUDES ${PORTAUDIO_INCLUDE_DIRS}) + list(APPEND EXTRA_LIBS ${PORTAUDIO_LIBRARIES}) + endif() else() list(REMOVE_ITEM SINK_SOURCES "${AUDIO_DIR}/sinks/unix/PortAudioSink.cpp") endif() @@ -258,5 +254,5 @@ target_link_libraries(bell PUBLIC ${EXTRA_LIBS}) target_include_directories(bell PUBLIC "include" ${EXTRA_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}) target_compile_definitions(bell PUBLIC PB_ENABLE_MALLOC) if(WIN32) - target_compile_definitions(bell PUBLIC PB_NO_STATIC_ASSERT) -endif() + target_compile_definitions(bell PUBLIC PB_NO_STATIC_ASSERT) +endif()