feat: Update gRPC configuration for Windows and remove unused submodule
- Added a new `grpc_windows.cmake` file for optimized gRPC builds on Windows using vcpkg, including checks for required targets and fallbacks. - Updated `grpc.cmake` to include the new Windows-specific configuration and streamline the build process. - Removed the `abseil-cpp` submodule from `.gitmodules` as it is no longer needed.
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -4,9 +4,6 @@
|
|||||||
[submodule "assets/asm/alttp-hacker-workspace"]
|
[submodule "assets/asm/alttp-hacker-workspace"]
|
||||||
path = assets/asm/alttp-hacker-workspace
|
path = assets/asm/alttp-hacker-workspace
|
||||||
url = https://github.com/scawful/alttp-hacker-workspace.git
|
url = https://github.com/scawful/alttp-hacker-workspace.git
|
||||||
[submodule "src/lib/abseil-cpp"]
|
|
||||||
path = src/lib/abseil-cpp
|
|
||||||
url = https://github.com/abseil/abseil-cpp.git
|
|
||||||
[submodule "src/lib/SDL"]
|
[submodule "src/lib/SDL"]
|
||||||
path = src/lib/SDL
|
path = src/lib/SDL
|
||||||
url = https://github.com/libsdl-org/SDL.git
|
url = https://github.com/libsdl-org/SDL.git
|
||||||
|
|||||||
@@ -5,15 +5,23 @@ set(CMAKE_POLICY_DEFAULT_CMP0074 NEW)
|
|||||||
# Include FetchContent module
|
# Include FetchContent module
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
|
# Try Windows-optimized path first
|
||||||
|
if(WIN32)
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/grpc_windows.cmake)
|
||||||
|
if(YAZE_GRPC_CONFIGURED)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Set minimum CMake version for subprojects (fixes c-ares compatibility)
|
# Set minimum CMake version for subprojects (fixes c-ares compatibility)
|
||||||
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
|
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
|
||||||
|
|
||||||
set(FETCHCONTENT_QUIET OFF)
|
set(FETCHCONTENT_QUIET OFF)
|
||||||
|
|
||||||
# CRITICAL: Prevent CMake from finding system-installed protobuf/abseil
|
# CRITICAL: Prevent CMake from finding system-installed protobuf
|
||||||
# This ensures gRPC uses its own bundled versions
|
# This ensures gRPC uses its own bundled versions
|
||||||
|
# NOTE: We allow gRPC to use our FetchContent abseil to keep versions in sync
|
||||||
set(CMAKE_DISABLE_FIND_PACKAGE_Protobuf TRUE)
|
set(CMAKE_DISABLE_FIND_PACKAGE_Protobuf TRUE)
|
||||||
set(CMAKE_DISABLE_FIND_PACKAGE_absl TRUE)
|
|
||||||
set(CMAKE_DISABLE_FIND_PACKAGE_gRPC TRUE)
|
set(CMAKE_DISABLE_FIND_PACKAGE_gRPC TRUE)
|
||||||
|
|
||||||
# Also prevent pkg-config from finding system packages
|
# Also prevent pkg-config from finding system packages
|
||||||
|
|||||||
63
cmake/grpc_windows.cmake
Normal file
63
cmake/grpc_windows.cmake
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
# Windows-optimized gRPC configuration using vcpkg
|
||||||
|
# This file provides fast gRPC builds on Windows using pre-compiled packages
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
# Option to use vcpkg for gRPC on Windows
|
||||||
|
option(YAZE_USE_VCPKG_GRPC "Use vcpkg pre-compiled gRPC packages (Windows only)" ON)
|
||||||
|
|
||||||
|
if(WIN32 AND YAZE_USE_VCPKG_GRPC)
|
||||||
|
message(STATUS "Attempting to use vcpkg gRPC packages for faster Windows builds...")
|
||||||
|
|
||||||
|
# Try to find gRPC via vcpkg
|
||||||
|
find_package(gRPC CONFIG QUIET)
|
||||||
|
find_package(Protobuf CONFIG QUIET)
|
||||||
|
|
||||||
|
if(gRPC_FOUND AND Protobuf_FOUND)
|
||||||
|
message(STATUS "✓ Using vcpkg gRPC packages (fast build path)")
|
||||||
|
|
||||||
|
# Verify required targets exist
|
||||||
|
if(NOT TARGET grpc++)
|
||||||
|
message(FATAL_ERROR "gRPC found but grpc++ target missing")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT TARGET protoc)
|
||||||
|
# Create protoc target if it doesn't exist
|
||||||
|
get_target_property(PROTOC_LOCATION protobuf::protoc LOCATION)
|
||||||
|
if(PROTOC_LOCATION)
|
||||||
|
add_executable(protoc IMPORTED)
|
||||||
|
set_target_properties(protoc PROPERTIES IMPORTED_LOCATION "${PROTOC_LOCATION}")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "protoc executable not found in vcpkg gRPC package")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT TARGET grpc_cpp_plugin)
|
||||||
|
# Find grpc_cpp_plugin
|
||||||
|
find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin)
|
||||||
|
if(GRPC_CPP_PLUGIN)
|
||||||
|
add_executable(grpc_cpp_plugin IMPORTED)
|
||||||
|
set_target_properties(grpc_cpp_plugin PROPERTIES IMPORTED_LOCATION "${GRPC_CPP_PLUGIN}")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "grpc_cpp_plugin not found in vcpkg gRPC package")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set variables for compatibility with rest of build system
|
||||||
|
set(_gRPC_PROTOBUF_PROTOC_EXECUTABLE $<TARGET_FILE:protoc>)
|
||||||
|
set(_gRPC_CPP_PLUGIN $<TARGET_FILE:grpc_cpp_plugin>)
|
||||||
|
set(_gRPC_PROTO_GENS_DIR ${CMAKE_BINARY_DIR}/gens)
|
||||||
|
file(MAKE_DIRECTORY ${_gRPC_PROTO_GENS_DIR})
|
||||||
|
|
||||||
|
# Skip the FetchContent path
|
||||||
|
set(YAZE_GRPC_CONFIGURED TRUE PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
else()
|
||||||
|
message(WARNING "vcpkg gRPC not found. Install with: vcpkg install grpc:x64-windows")
|
||||||
|
message(STATUS "Falling back to FetchContent build (this will be slow on first build)")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# If we reach here, vcpkg wasn't used - fall back to standard grpc.cmake
|
||||||
|
message(STATUS "Using FetchContent for gRPC (standard path)")
|
||||||
|
set(YAZE_GRPC_CONFIGURED FALSE PARENT_SCOPE)
|
||||||
Submodule src/lib/abseil-cpp deleted from 053d842fa6
Reference in New Issue
Block a user