fix: Windows build compatibility - disable OpenSSL and fix Winsock linking

- Remove hardcoded CPPHTTPLIB_OPENSSL_SUPPORT in HttpClient.hpp
- Make SSL certificate verification conditional on OpenSSL availability
- Add ws2_32 (Winsock) linking for all targets using httplib on Windows
- Disable TestRunnerModule on Windows (requires Unix dlfcn.h)
- Fix .gitignore to exclude GroveEngine symlink (local only)
- Disable httplib OpenSSL auto-detection when OpenSSL not found

This enables AISSIA to build successfully on Windows without OpenSSL,
using HTTP-only mode for LLM API calls.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
StillHammer 2025-11-30 16:26:35 +08:00
parent 099e0d837e
commit f5c03e1343
4 changed files with 65 additions and 24 deletions

7
.gitignore vendored
View File

@ -64,7 +64,12 @@ Thumbs.db
*.mov
*.wmv
*.mp3
*.wavbuild/
*.wav
# Symlink to GroveEngine (local only)
external/GroveEngine
build/
*.o
*.a
*.so

View File

@ -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,7 +336,8 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/config/
# Development targets
# ============================================================================
# TestRunnerModule - Orchestrator for integration tests
# TestRunnerModule - Orchestrator for integration tests (Unix only - uses dlfcn.h)
if(UNIX)
add_library(TestRunnerModule SHARED
src/modules/TestRunnerModule.cpp
)
@ -333,12 +351,20 @@ set_target_properties(TestRunnerModule PROPERTIES
PREFIX "lib"
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/modules
)
endif()
# Quick rebuild of modules only (for hot-reload workflow)
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)

View File

@ -1 +0,0 @@
/mnt/e/Users/Alexis Trouvé/Documents/Projets/GroveEngine

View File

@ -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 <httplib.h>
#include <nlohmann/json.hpp>
#include <string>
@ -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);