diff --git a/.gitignore b/.gitignore index 6a22d10..09cbba0 100644 --- a/.gitignore +++ b/.gitignore @@ -64,7 +64,12 @@ Thumbs.db *.mov *.wmv *.mp3 -*.wavbuild/ +*.wav + +# Symlink to GroveEngine (local only) +external/GroveEngine + +build/ *.o *.a *.so diff --git a/CMakeLists.txt b/CMakeLists.txt index e79c3a0..47db7cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,12 @@ endif() # cpp-httplib (header-only HTTP client) include(FetchContent) + +# Disable OpenSSL auto-detection in httplib if OpenSSL is not available +if(NOT OPENSSL_FOUND) + set(HTTPLIB_USE_OPENSSL_IF_AVAILABLE OFF CACHE BOOL "Disable OpenSSL in httplib" FORCE) +endif() + FetchContent_Declare( httplib GIT_REPOSITORY https://github.com/yhirose/cpp-httplib.git @@ -68,6 +74,10 @@ target_link_libraries(AissiaLLM PUBLIC GroveEngine::impl spdlog::spdlog ) +# Link Winsock for httplib on Windows +if(WIN32) + target_link_libraries(AissiaLLM PUBLIC ws2_32) +endif() if(OPENSSL_FOUND) target_link_libraries(AissiaLLM PUBLIC OpenSSL::SSL OpenSSL::Crypto) target_compile_definitions(AissiaLLM PRIVATE CPPHTTPLIB_OPENSSL_SUPPORT) @@ -119,13 +129,16 @@ target_include_directories(AissiaAudio PUBLIC target_link_libraries(AissiaAudio PUBLIC spdlog::spdlog ) +# Link Winsock for httplib on Windows +if(WIN32) + target_link_libraries(AissiaAudio PUBLIC ws2_32 sapi ole32) +endif() if(OPENSSL_FOUND) target_link_libraries(AissiaAudio PUBLIC OpenSSL::SSL OpenSSL::Crypto) target_compile_definitions(AissiaAudio PRIVATE CPPHTTPLIB_OPENSSL_SUPPORT) endif() -if(WIN32) - target_link_libraries(AissiaAudio PUBLIC sapi ole32) -endif() +# Note: Si OpenSSL n'est pas trouvé, on ne définit PAS CPPHTTPLIB_OPENSSL_SUPPORT +# httplib utilisera HTTP simple sans SSL # Optional: Link Vosk if available (Phase 7 STT) find_library(VOSK_LIBRARY vosk) @@ -300,6 +313,10 @@ target_link_libraries(WebModule PRIVATE GroveEngine::impl spdlog::spdlog ) +# Link Winsock for httplib on Windows +if(WIN32) + target_link_libraries(WebModule PRIVATE ws2_32) +endif() if(OPENSSL_FOUND) target_link_libraries(WebModule PRIVATE OpenSSL::SSL OpenSSL::Crypto) target_compile_definitions(WebModule PRIVATE CPPHTTPLIB_OPENSSL_SUPPORT) @@ -319,26 +336,35 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/config/ # Development targets # ============================================================================ -# TestRunnerModule - Orchestrator for integration tests -add_library(TestRunnerModule SHARED - src/modules/TestRunnerModule.cpp -) -target_include_directories(TestRunnerModule PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) -target_link_libraries(TestRunnerModule PRIVATE - GroveEngine::impl - spdlog::spdlog - ${CMAKE_DL_LIBS} -) -set_target_properties(TestRunnerModule PROPERTIES - PREFIX "lib" - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/modules -) +# TestRunnerModule - Orchestrator for integration tests (Unix only - uses dlfcn.h) +if(UNIX) + add_library(TestRunnerModule SHARED + src/modules/TestRunnerModule.cpp + ) + target_include_directories(TestRunnerModule PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) + target_link_libraries(TestRunnerModule PRIVATE + GroveEngine::impl + spdlog::spdlog + ${CMAKE_DL_LIBS} + ) + set_target_properties(TestRunnerModule PROPERTIES + PREFIX "lib" + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/modules + ) +endif() # Quick rebuild of modules only (for hot-reload workflow) -add_custom_target(modules - DEPENDS SchedulerModule NotificationModule StorageModule MonitoringModule AIModule VoiceModule WebModule TestRunnerModule - COMMENT "Building hot-reloadable modules only" -) +if(UNIX) + add_custom_target(modules + DEPENDS SchedulerModule NotificationModule StorageModule MonitoringModule AIModule VoiceModule WebModule TestRunnerModule + COMMENT "Building hot-reloadable modules only" + ) +else() + add_custom_target(modules + DEPENDS SchedulerModule NotificationModule StorageModule MonitoringModule AIModule VoiceModule WebModule + COMMENT "Building hot-reloadable modules only" + ) +endif() # Create data directory file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/data) @@ -367,3 +393,4 @@ target_link_libraries(test_stt_engines AissiaAudio spdlog::spdlog ) +# Link Winsock for httplib on Windows (already linked via AissiaLLM PUBLIC dependency) diff --git a/external/GroveEngine b/external/GroveEngine deleted file mode 120000 index 64e37d5..0000000 --- a/external/GroveEngine +++ /dev/null @@ -1 +0,0 @@ -/mnt/e/Users/Alexis Trouvé/Documents/Projets/GroveEngine \ No newline at end of file diff --git a/src/shared/http/HttpClient.hpp b/src/shared/http/HttpClient.hpp index aec630b..49e3651 100644 --- a/src/shared/http/HttpClient.hpp +++ b/src/shared/http/HttpClient.hpp @@ -7,7 +7,8 @@ * Requires cpp-httplib and OpenSSL for HTTPS support. */ -#define CPPHTTPLIB_OPENSSL_SUPPORT +// Only enable OpenSSL support if it was found during CMake configuration +// CPPHTTPLIB_OPENSSL_SUPPORT is defined via target_compile_definitions when OpenSSL is available #include #include #include @@ -72,9 +73,12 @@ public: std::string url = (m_useSSL ? "https://" : "http://") + m_host; httplib::Client client(url); + // Only enable certificate verification if OpenSSL support is compiled in +#ifdef CPPHTTPLIB_OPENSSL_SUPPORT if (m_useSSL) { client.enable_server_certificate_verification(true); } +#endif client.set_connection_timeout(m_timeoutSeconds); client.set_read_timeout(m_timeoutSeconds); @@ -122,9 +126,12 @@ public: std::string url = (m_useSSL ? "https://" : "http://") + m_host; httplib::Client client(url); + // Only enable certificate verification if OpenSSL support is compiled in +#ifdef CPPHTTPLIB_OPENSSL_SUPPORT if (m_useSSL) { client.enable_server_certificate_verification(true); } +#endif client.set_connection_timeout(m_timeoutSeconds); client.set_read_timeout(m_timeoutSeconds); @@ -158,9 +165,12 @@ public: std::string url = (m_useSSL ? "https://" : "http://") + m_host; httplib::Client client(url); + // Only enable certificate verification if OpenSSL support is compiled in +#ifdef CPPHTTPLIB_OPENSSL_SUPPORT if (m_useSSL) { client.enable_server_certificate_verification(true); } +#endif client.set_connection_timeout(m_timeoutSeconds); client.set_read_timeout(m_timeoutSeconds);