feat(cmake): enhance OpenSSL linking and whole-archive options for Windows
- Updated CMake configurations to conditionally link OpenSSL only when gRPC is not enabled, preventing duplicate symbol errors. - Added support for whole-archive linking of protobuf on Windows across core, net, agent, and z3ed components to ensure all symbols are included. - Improved status messages to reflect the use of gRPC's OpenSSL when applicable. Benefits: - Enhanced compatibility and stability of the build process across different platforms and configurations.
This commit is contained in:
@@ -151,6 +151,11 @@ if(YAZE_WITH_GRPC)
|
|||||||
libprotobuf
|
libprotobuf
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# On Windows, force whole-archive linking for protobuf to ensure all symbols are included
|
||||||
|
if(MSVC)
|
||||||
|
target_link_options(yaze_core_lib PUBLIC /WHOLEARCHIVE:libprotobuf)
|
||||||
|
endif()
|
||||||
|
|
||||||
message(STATUS " - gRPC test harness + ROM service enabled")
|
message(STATUS " - gRPC test harness + ROM service enabled")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -52,14 +52,21 @@ if(YAZE_WITH_JSON)
|
|||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
target_link_libraries(yaze_net PUBLIC Threads::Threads)
|
target_link_libraries(yaze_net PUBLIC Threads::Threads)
|
||||||
|
|
||||||
# Add OpenSSL for HTTPS/WSS support (optional but recommended)
|
# Only link OpenSSL if gRPC is NOT enabled (to avoid duplicate symbol errors)
|
||||||
find_package(OpenSSL QUIET)
|
# When gRPC is enabled, it brings its own OpenSSL which we'll use instead
|
||||||
if(OpenSSL_FOUND)
|
if(NOT YAZE_WITH_GRPC)
|
||||||
target_link_libraries(yaze_net PUBLIC OpenSSL::SSL OpenSSL::Crypto)
|
find_package(OpenSSL QUIET)
|
||||||
target_compile_definitions(yaze_net PUBLIC CPPHTTPLIB_OPENSSL_SUPPORT)
|
if(OpenSSL_FOUND)
|
||||||
message(STATUS " - WebSocket with SSL/TLS support enabled")
|
target_link_libraries(yaze_net PUBLIC OpenSSL::SSL OpenSSL::Crypto)
|
||||||
|
target_compile_definitions(yaze_net PUBLIC CPPHTTPLIB_OPENSSL_SUPPORT)
|
||||||
|
message(STATUS " - WebSocket with SSL/TLS support enabled")
|
||||||
|
else()
|
||||||
|
message(STATUS " - WebSocket without SSL/TLS (OpenSSL not found)")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
message(STATUS " - WebSocket without SSL/TLS (OpenSSL not found)")
|
# When gRPC is enabled, still enable OpenSSL features but use gRPC's OpenSSL
|
||||||
|
target_compile_definitions(yaze_net PUBLIC CPPHTTPLIB_OPENSSL_SUPPORT)
|
||||||
|
message(STATUS " - WebSocket with SSL/TLS support enabled via gRPC's OpenSSL")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Windows-specific socket library
|
# Windows-specific socket library
|
||||||
@@ -79,6 +86,11 @@ if(YAZE_WITH_GRPC)
|
|||||||
libprotobuf
|
libprotobuf
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# On Windows, force whole-archive linking for protobuf to ensure all symbols are included
|
||||||
|
if(MSVC)
|
||||||
|
target_link_options(yaze_net PUBLIC /WHOLEARCHIVE:libprotobuf)
|
||||||
|
endif()
|
||||||
|
|
||||||
message(STATUS " - gRPC ROM service enabled")
|
message(STATUS " - gRPC ROM service enabled")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -110,20 +110,32 @@ if(YAZE_WITH_JSON)
|
|||||||
target_link_libraries(yaze_agent PUBLIC nlohmann_json::nlohmann_json)
|
target_link_libraries(yaze_agent PUBLIC nlohmann_json::nlohmann_json)
|
||||||
target_compile_definitions(yaze_agent PUBLIC YAZE_WITH_JSON)
|
target_compile_definitions(yaze_agent PUBLIC YAZE_WITH_JSON)
|
||||||
|
|
||||||
find_package(OpenSSL)
|
# Only link OpenSSL if gRPC is NOT enabled (to avoid duplicate symbol errors)
|
||||||
if(OpenSSL_FOUND)
|
# When gRPC is enabled, it brings its own OpenSSL which we'll use instead
|
||||||
target_compile_definitions(yaze_agent PUBLIC CPPHTTPLIB_OPENSSL_SUPPORT)
|
if(NOT YAZE_WITH_GRPC)
|
||||||
target_link_libraries(yaze_agent PUBLIC OpenSSL::SSL OpenSSL::Crypto)
|
find_package(OpenSSL)
|
||||||
|
if(OpenSSL_FOUND)
|
||||||
|
target_compile_definitions(yaze_agent PUBLIC CPPHTTPLIB_OPENSSL_SUPPORT)
|
||||||
|
target_link_libraries(yaze_agent PUBLIC OpenSSL::SSL OpenSSL::Crypto)
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
target_compile_definitions(yaze_agent PUBLIC CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN)
|
||||||
|
target_link_libraries(yaze_agent PUBLIC "-framework CoreFoundation" "-framework Security")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "✓ SSL/HTTPS support enabled for yaze_agent (Gemini + HTTPS)")
|
||||||
|
else()
|
||||||
|
message(WARNING "OpenSSL not found - Gemini HTTPS features disabled (Ollama still works)")
|
||||||
|
message(STATUS " Install OpenSSL to enable Gemini: brew install openssl (macOS) or apt-get install libssl-dev (Linux)")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# When gRPC is enabled, still enable OpenSSL features but use gRPC's OpenSSL
|
||||||
|
target_compile_definitions(yaze_agent PUBLIC CPPHTTPLIB_OPENSSL_SUPPORT)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
target_compile_definitions(yaze_agent PUBLIC CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN)
|
target_compile_definitions(yaze_agent PUBLIC CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN)
|
||||||
target_link_libraries(yaze_agent PUBLIC "-framework CoreFoundation" "-framework Security")
|
target_link_libraries(yaze_agent PUBLIC "-framework CoreFoundation" "-framework Security")
|
||||||
endif()
|
endif()
|
||||||
|
message(STATUS "✓ SSL/HTTPS support enabled via gRPC's OpenSSL (Gemini + HTTPS)")
|
||||||
message(STATUS "✓ SSL/HTTPS support enabled for yaze_agent (Gemini + HTTPS)")
|
|
||||||
else()
|
|
||||||
message(WARNING "OpenSSL not found - Gemini HTTPS features disabled (Ollama still works)")
|
|
||||||
message(STATUS " Install OpenSSL to enable Gemini: brew install openssl (macOS) or apt-get install libssl-dev (Linux)")
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -141,6 +153,11 @@ if(YAZE_WITH_GRPC)
|
|||||||
libprotobuf
|
libprotobuf
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# On Windows, force whole-archive linking for protobuf to ensure all symbols are included
|
||||||
|
if(MSVC)
|
||||||
|
target_link_options(yaze_agent PUBLIC /WHOLEARCHIVE:libprotobuf)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Note: YAZE_WITH_GRPC is defined globally via add_compile_definitions in root CMakeLists.txt
|
# Note: YAZE_WITH_GRPC is defined globally via add_compile_definitions in root CMakeLists.txt
|
||||||
# This ensures #ifdef YAZE_WITH_GRPC works in all translation units
|
# This ensures #ifdef YAZE_WITH_GRPC works in all translation units
|
||||||
message(STATUS "✓ gRPC GUI automation enabled for yaze_agent")
|
message(STATUS "✓ gRPC GUI automation enabled for yaze_agent")
|
||||||
|
|||||||
@@ -40,4 +40,9 @@ endif()
|
|||||||
if(YAZE_WITH_GRPC)
|
if(YAZE_WITH_GRPC)
|
||||||
message(STATUS "Adding gRPC support to z3ed CLI")
|
message(STATUS "Adding gRPC support to z3ed CLI")
|
||||||
target_link_libraries(z3ed PRIVATE grpc++ grpc++_reflection libprotobuf)
|
target_link_libraries(z3ed PRIVATE grpc++ grpc++_reflection libprotobuf)
|
||||||
|
|
||||||
|
# On Windows, force whole-archive linking for protobuf to ensure all symbols are included
|
||||||
|
if(MSVC)
|
||||||
|
target_link_options(z3ed PRIVATE /WHOLEARCHIVE:libprotobuf)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
Reference in New Issue
Block a user