2
0
Эх сурвалжийг харах

unify Host and Embedded versions

philippe44 1 жил өмнө
parent
commit
bc4e56eabc

+ 1 - 0
components/spotify/CMakeLists.txt

@@ -18,6 +18,7 @@ set(BELL_DISABLE_FMT ON)
 set(BELL_DISABLE_REGEX ON)
 set(BELL_ONLY_CJSON ON)
 set(BELL_DISABLE_MQTT ON)
+set(BELL_DISABLE_WEBSERVER ON)
 set(CSPOT_TARGET_ESP32 ON)
 
 # because CMake is so broken, the cache set below overrides a normal "set" for the first build

+ 10 - 6
components/spotify/cspot/bell/CMakeLists.txt

@@ -8,6 +8,7 @@ option(BELL_DISABLE_CODECS "Disable the entire audio codec wrapper" OFF)
 option(BELL_CODEC_AAC "Support libhelix-aac codec" ON)
 option(BELL_CODEC_MP3 "Support libhelix-mp3 codec" ON)
 option(BELL_DISABLE_MQTT "Disable the built-in MQTT wrapper" OFF)
+option(BELL_DISABLE_WEBSERVER "Disable the built-in Web server" OFF)
 option(BELL_CODEC_VORBIS "Support tremor Vorbis codec" ON)
 option(BELL_CODEC_ALAC "Support Apple ALAC codec" ON)
 option(BELL_CODEC_OPUS "Support Opus codec" ON)
@@ -66,6 +67,7 @@ message(STATUS "    Use cJSON only: ${BELL_ONLY_CJSON}")
 message(STATUS "    Disable Fmt: ${BELL_DISABLE_FMT}")
 message(STATUS "    Disable Mqtt: ${BELL_DISABLE_MQTT}")
 message(STATUS "    Disable Regex: ${BELL_DISABLE_REGEX}")
+message(STATUS "    Disable Web server: ${BELL_DISABLE_WEBSERVER}")
 
 # Include nanoPB library
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/external/nanopb/extra")
@@ -95,8 +97,6 @@ file(GLOB SOURCES
     "main/io/*.cpp" "main/io/*.c"
 )
 
-list(REMOVE_ITEM SOURCES "${IO_DIR}/BellTar.cpp" "${IO_DIR}/BellHTTPServer.cpp")
-
 list(APPEND EXTRA_INCLUDES "main/audio-codec/include")
 list(APPEND EXTRA_INCLUDES "main/audio-dsp/include")
 list(APPEND EXTRA_INCLUDES "main/audio-sinks/include")
@@ -276,6 +276,7 @@ if(NOT BELL_DISABLE_SINKS)
 endif()
 
 if(NOT BELL_ONLY_CJSON)
+    set(JSON_SystemInclude ON CACHE INTERNAL "")
     add_subdirectory(external/nlohmann_json)
     list(APPEND EXTRA_LIBS nlohmann_json::nlohmann_json)
 endif()	
@@ -296,10 +297,13 @@ if(WIN32 OR UNIX)
     list(APPEND EXTERNAL_INCLUDES "external/mdnssvc")
 endif() 
 
-# file(GLOB CIVET_SRC "external/civetweb/*.c" "external/civetweb/*.inl" "external/civetweb/*.cpp")
-
-# list(APPEND SOURCES ${CIVET_SRC})
-# list(APPEND EXTRA_INCLUDES "external/civetweb/include") 
+if(NOT BELL_DISABLE_WEBSERVER)
+    file(GLOB CIVET_SRC "external/civetweb/*.c" "external/civetweb/*.inl" "external/civetweb/*.cpp")
+    list(APPEND SOURCES ${CIVET_SRC})
+    list(APPEND EXTRA_INCLUDES "external/civetweb/include") 
+else()
+    list(REMOVE_ITEM SOURCES "${IO_DIR}/BellHTTPServer.cpp")    
+endif()    
 
 add_library(bell STATIC ${SOURCES})
 

+ 4 - 0
components/spotify/cspot/bell/main/io/BellTar.cpp

@@ -288,7 +288,11 @@ void reader::extract_all_files(std::string dest_directory) {
     auto fileName = get_next_file_name();
 
     // 0 is the normal file type, skip apple's ._ files
+#if __cplusplus >= 202002L
     if (fileType == '0' && !fileName.starts_with("._")) {
+#else
+    if (fileType == '0' && fileName.find("._") != 0) {
+#endif       
       std::string path = dest_directory + "/" + fileName;
 
       size_t pos = 0;