backend-infra-engineer: Release v0.3.2 snapshot
This commit is contained in:
138
cmake/absl.cmake
138
cmake/absl.cmake
@@ -1,32 +1,75 @@
|
||||
if (MINGW OR WIN32)
|
||||
add_subdirectory(src/lib/abseil-cpp)
|
||||
elseif(YAZE_MINIMAL_BUILD)
|
||||
# For CI builds, always use submodule to avoid dependency issues
|
||||
add_subdirectory(src/lib/abseil-cpp)
|
||||
else()
|
||||
# Try system package first, fallback to submodule
|
||||
find_package(absl QUIET)
|
||||
if(NOT absl_FOUND)
|
||||
message(STATUS "System Abseil not found, using submodule")
|
||||
add_subdirectory(src/lib/abseil-cpp)
|
||||
# Abseil release to use when fetching from source
|
||||
set(YAZE_ABSL_GIT_TAG "20240116.2" CACHE STRING "Abseil release tag used when fetching from source")
|
||||
|
||||
# Attempt to use the system package unless the build explicitly requests the
|
||||
# bundled (fetched) copy or we're on platforms where prebuilt packages are often
|
||||
# missing the required components (e.g. macOS).
|
||||
set(_yaze_use_fetched_absl ${YAZE_FORCE_BUNDLED_ABSL})
|
||||
if(NOT _yaze_use_fetched_absl)
|
||||
# Try to find via vcpkg first on Windows
|
||||
if(WIN32 AND DEFINED CMAKE_TOOLCHAIN_FILE)
|
||||
find_package(absl CONFIG QUIET)
|
||||
else()
|
||||
find_package(absl QUIET CONFIG)
|
||||
endif()
|
||||
|
||||
if(absl_FOUND)
|
||||
message(STATUS "✓ Using system/vcpkg Abseil package")
|
||||
else()
|
||||
set(_yaze_use_fetched_absl TRUE)
|
||||
message(STATUS "○ System Abseil not found. Will fetch release ${YAZE_ABSL_GIT_TAG}")
|
||||
endif()
|
||||
endif()
|
||||
set(ABSL_PROPAGATE_CXX_STD ON)
|
||||
set(ABSL_CXX_STANDARD 23)
|
||||
set(ABSL_USE_GOOGLETEST_HEAD ON)
|
||||
set(ABSL_ENABLE_INSTALL ON)
|
||||
|
||||
# Silence C++23 deprecation warnings for Abseil int128
|
||||
if(MSVC)
|
||||
add_definitions(-DSILENCE_CXX23_DEPRECATIONS)
|
||||
else()
|
||||
add_definitions(-D_SILENCE_CXX23_DEPRECATION_WARNING)
|
||||
if(_yaze_use_fetched_absl)
|
||||
include(FetchContent)
|
||||
FetchContent_GetProperties(absl)
|
||||
if(NOT absl_POPULATED)
|
||||
FetchContent_Declare(
|
||||
absl
|
||||
GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git
|
||||
GIT_TAG ${YAZE_ABSL_GIT_TAG}
|
||||
GIT_SHALLOW TRUE
|
||||
GIT_PROGRESS TRUE
|
||||
USES_TERMINAL_DOWNLOAD TRUE
|
||||
)
|
||||
set(ABSL_PROPAGATE_CXX_STD ON CACHE BOOL "" FORCE)
|
||||
set(ABSL_BUILD_TESTING OFF CACHE BOOL "" FORCE)
|
||||
set(ABSL_ENABLE_INSTALL OFF CACHE BOOL "" FORCE)
|
||||
FetchContent_MakeAvailable(absl)
|
||||
message(STATUS "Fetched Abseil ${YAZE_ABSL_GIT_TAG}")
|
||||
endif()
|
||||
endif()
|
||||
# Define base Abseil targets
|
||||
|
||||
if(NOT TARGET absl::strings)
|
||||
message(FATAL_ERROR "Abseil was not found or failed to configure correctly.")
|
||||
else()
|
||||
message(STATUS "✓ Abseil configured successfully (standalone)")
|
||||
# Verify critical targets exist
|
||||
foreach(_check_target IN ITEMS absl::status absl::statusor absl::str_format absl::flags)
|
||||
if(NOT TARGET ${_check_target})
|
||||
message(WARNING "Expected Abseil target ${_check_target} not found")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Canonical list of Abseil targets that the rest of the project links against.
|
||||
# Note: Order matters for some linkers - put base libraries first
|
||||
set(
|
||||
ABSL_TARGETS
|
||||
absl::base
|
||||
absl::config
|
||||
absl::core_headers
|
||||
absl::utility
|
||||
absl::memory
|
||||
absl::container_memory
|
||||
absl::strings
|
||||
absl::str_format
|
||||
absl::cord
|
||||
absl::hash
|
||||
absl::time
|
||||
absl::status
|
||||
absl::statusor
|
||||
absl::flags
|
||||
absl::flags_parse
|
||||
absl::flags_usage
|
||||
@@ -36,29 +79,54 @@ set(
|
||||
absl::flags_program_name
|
||||
absl::flags_config
|
||||
absl::flags_reflection
|
||||
absl::status
|
||||
absl::statusor
|
||||
absl::examine_stack
|
||||
absl::stacktrace
|
||||
absl::base
|
||||
absl::config
|
||||
absl::core_headers
|
||||
absl::failure_signal_handler
|
||||
absl::flat_hash_map
|
||||
absl::cord
|
||||
absl::hash
|
||||
absl::synchronization
|
||||
absl::time
|
||||
absl::symbolize
|
||||
absl::container_memory
|
||||
absl::memory
|
||||
absl::utility
|
||||
)
|
||||
|
||||
# Add int128 only on non-Windows platforms to avoid C++23 deprecation issues
|
||||
# Only expose absl::int128 when it's supported without warnings.
|
||||
if(NOT WIN32)
|
||||
list(APPEND ABSL_TARGETS absl::int128)
|
||||
message(STATUS "Including absl::int128 (non-Windows platform)")
|
||||
message(STATUS "Including absl::int128 target")
|
||||
else()
|
||||
message(STATUS "Excluding absl::int128 on Windows to avoid C++23 deprecation issues")
|
||||
message(STATUS "Skipping absl::int128 target on Windows")
|
||||
endif()
|
||||
|
||||
# ABSL_TARGETS is now available to the rest of the project via include()
|
||||
|
||||
if(APPLE AND DEFINED CMAKE_OSX_ARCHITECTURES AND CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
|
||||
foreach(_absl_target IN ITEMS absl_random_internal_randen_hwaes absl_random_internal_randen_hwaes_impl)
|
||||
if(TARGET ${_absl_target})
|
||||
get_target_property(_absl_opts ${_absl_target} COMPILE_OPTIONS)
|
||||
if(_absl_opts AND NOT _absl_opts STREQUAL "NOTFOUND")
|
||||
set(_absl_filtered_opts)
|
||||
set(_absl_skip_next FALSE)
|
||||
foreach(_absl_opt IN LISTS _absl_opts)
|
||||
if(_absl_skip_next)
|
||||
set(_absl_skip_next FALSE)
|
||||
continue()
|
||||
endif()
|
||||
if(_absl_opt STREQUAL "-Xarch_x86_64")
|
||||
set(_absl_skip_next TRUE)
|
||||
continue()
|
||||
endif()
|
||||
if(_absl_opt STREQUAL "-maes" OR _absl_opt STREQUAL "-msse4.1")
|
||||
continue()
|
||||
endif()
|
||||
list(APPEND _absl_filtered_opts ${_absl_opt})
|
||||
endforeach()
|
||||
set_property(TARGET ${_absl_target} PROPERTY COMPILE_OPTIONS ${_absl_filtered_opts})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Silence C++23 deprecation warnings for Abseil int128
|
||||
if(MSVC)
|
||||
add_definitions(-DSILENCE_CXX23_DEPRECATIONS)
|
||||
else()
|
||||
add_definitions(-D_SILENCE_CXX23_DEPRECATION_WARNING)
|
||||
endif()
|
||||
|
||||
@@ -8,6 +8,11 @@ set(ASAR_GEN_LIB ON CACHE BOOL "Build Asar static library")
|
||||
set(ASAR_GEN_EXE_TEST OFF CACHE BOOL "Build Asar executable tests")
|
||||
set(ASAR_GEN_DLL_TEST OFF CACHE BOOL "Build Asar DLL tests")
|
||||
|
||||
# Force Asar to use static MSVC runtime to match vcpkg static triplets
|
||||
if(MSVC)
|
||||
set(MSVC_LIB_TYPE T CACHE STRING "Asar MSVC runtime type" FORCE)
|
||||
endif()
|
||||
|
||||
# Set Asar source directory
|
||||
set(ASAR_SRC_DIR "${CMAKE_SOURCE_DIR}/src/lib/asar/src")
|
||||
|
||||
@@ -91,4 +96,4 @@ function(yaze_create_asar_patch_tool tool_name patch_file rom_file)
|
||||
COMMENT "Applying Asar patch ${patch_file} to ${rom_file}"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
endfunction()
|
||||
|
||||
155
cmake/dependencies.cmake
Normal file
155
cmake/dependencies.cmake
Normal file
@@ -0,0 +1,155 @@
|
||||
# This file centralizes the management of all third-party dependencies.
|
||||
# It provides functions to find or fetch dependencies and creates alias targets
|
||||
# for consistent usage throughout the project.
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
# ============================================================================
|
||||
# Helper function to add a dependency
|
||||
# ============================================================================
|
||||
function(yaze_add_dependency name)
|
||||
set(options)
|
||||
set(oneValueArgs GIT_REPOSITORY GIT_TAG URL)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(DEP "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(TARGET yaze::${name})
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Try to find the package via find_package first
|
||||
find_package(${name} QUIET)
|
||||
|
||||
if(${name}_FOUND)
|
||||
message(STATUS "Found ${name} via find_package")
|
||||
if(TARGET ${name}::${name})
|
||||
add_library(yaze::${name} ALIAS ${name}::${name})
|
||||
else()
|
||||
# Handle cases where find_package doesn't create an imported target
|
||||
# This is a simplified approach; more logic may be needed for specific packages
|
||||
add_library(yaze::${name} INTERFACE IMPORTED)
|
||||
target_include_directories(yaze::${name} INTERFACE ${${name}_INCLUDE_DIRS})
|
||||
target_link_libraries(yaze::${name} INTERFACE ${${name}_LIBRARIES})
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
|
||||
# If not found, use FetchContent
|
||||
message(STATUS "Could not find ${name}, fetching from source.")
|
||||
FetchContent_Declare(
|
||||
${name}
|
||||
GIT_REPOSITORY ${DEP_GIT_REPOSITORY}
|
||||
GIT_TAG ${DEP_GIT_TAG}
|
||||
)
|
||||
|
||||
FetchContent_GetProperties(${name})
|
||||
if(NOT ${name}_POPULATED)
|
||||
FetchContent_Populate(${name})
|
||||
add_subdirectory(${${name}_SOURCE_DIR} ${${name}_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
if(TARGET ${name})
|
||||
add_library(yaze::${name} ALIAS ${name})
|
||||
elseif(TARGET ${name}::${name})
|
||||
add_library(yaze::${name} ALIAS ${name}::${name})
|
||||
else()
|
||||
message(FATAL_ERROR "Failed to create target for ${name}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# ============================================================================
|
||||
# Dependency Declarations
|
||||
# ============================================================================
|
||||
|
||||
# gRPC (must come before Abseil - provides its own compatible Abseil)
|
||||
if(YAZE_WITH_GRPC)
|
||||
include(cmake/grpc.cmake)
|
||||
# Verify ABSL_TARGETS was populated by gRPC
|
||||
list(LENGTH ABSL_TARGETS _absl_count)
|
||||
if(_absl_count EQUAL 0)
|
||||
message(FATAL_ERROR "ABSL_TARGETS is empty after including grpc.cmake!")
|
||||
else()
|
||||
message(STATUS "gRPC provides ${_absl_count} Abseil targets for linking")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Abseil (only if gRPC didn't provide it)
|
||||
if(NOT YAZE_WITH_GRPC)
|
||||
include(cmake/absl.cmake)
|
||||
# Verify ABSL_TARGETS was populated
|
||||
list(LENGTH ABSL_TARGETS _absl_count)
|
||||
if(_absl_count EQUAL 0)
|
||||
message(FATAL_ERROR "ABSL_TARGETS is empty after including absl.cmake!")
|
||||
else()
|
||||
message(STATUS "Abseil provides ${_absl_count} targets for linking")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(YAZE_PROTOBUF_TARGETS)
|
||||
|
||||
if(TARGET protobuf::libprotobuf)
|
||||
list(APPEND YAZE_PROTOBUF_TARGETS protobuf::libprotobuf)
|
||||
else()
|
||||
if(TARGET libprotobuf)
|
||||
list(APPEND YAZE_PROTOBUF_TARGETS libprotobuf)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS ${YAZE_PROTOBUF_TARGETS})
|
||||
|
||||
if(YAZE_PROTOBUF_TARGETS)
|
||||
list(GET YAZE_PROTOBUF_TARGETS 0 YAZE_PROTOBUF_TARGET)
|
||||
else()
|
||||
set(YAZE_PROTOBUF_TARGET "")
|
||||
endif()
|
||||
|
||||
# SDL2
|
||||
include(cmake/sdl2.cmake)
|
||||
|
||||
# Asar
|
||||
include(cmake/asar.cmake)
|
||||
|
||||
# Google Test
|
||||
if(YAZE_BUILD_TESTS)
|
||||
include(cmake/gtest.cmake)
|
||||
endif()
|
||||
|
||||
# ImGui
|
||||
include(cmake/imgui.cmake)
|
||||
|
||||
# FTXUI (for z3ed)
|
||||
if(YAZE_BUILD_Z3ED)
|
||||
FetchContent_Declare(ftxui
|
||||
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
|
||||
GIT_TAG v5.0.0
|
||||
)
|
||||
FetchContent_MakeAvailable(ftxui)
|
||||
endif()
|
||||
|
||||
# yaml-cpp (always available for configuration files)
|
||||
set(YAML_CPP_BUILD_TESTS OFF CACHE BOOL "Disable yaml-cpp tests" FORCE)
|
||||
set(YAML_CPP_BUILD_CONTRIB OFF CACHE BOOL "Disable yaml-cpp contrib" FORCE)
|
||||
set(YAML_CPP_BUILD_TOOLS OFF CACHE BOOL "Disable yaml-cpp tools" FORCE)
|
||||
set(YAML_CPP_INSTALL OFF CACHE BOOL "Disable yaml-cpp install" FORCE)
|
||||
set(YAML_CPP_FORMAT_SOURCE OFF CACHE BOOL "Disable yaml-cpp format target" FORCE)
|
||||
|
||||
# yaml-cpp (uses CMAKE_POLICY_VERSION_MINIMUM set in root CMakeLists.txt)
|
||||
FetchContent_Declare(yaml-cpp
|
||||
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
|
||||
GIT_TAG 0.8.0
|
||||
)
|
||||
FetchContent_MakeAvailable(yaml-cpp)
|
||||
|
||||
# Fix MSVC exception handling warning for yaml-cpp
|
||||
if(MSVC AND TARGET yaml-cpp)
|
||||
target_compile_options(yaml-cpp PRIVATE /EHsc)
|
||||
endif()
|
||||
|
||||
# nlohmann_json (header only)
|
||||
if(YAZE_WITH_JSON)
|
||||
set(JSON_BuildTests OFF CACHE INTERNAL "Disable nlohmann_json tests")
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/third_party/json ${CMAKE_BINARY_DIR}/third_party/json EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
# httplib (header only)
|
||||
# No action needed here as it's included directly.
|
||||
296
cmake/grpc.cmake
Normal file
296
cmake/grpc.cmake
Normal file
@@ -0,0 +1,296 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
||||
set(CMAKE_POLICY_DEFAULT_CMP0074 NEW)
|
||||
|
||||
# Include FetchContent module
|
||||
include(FetchContent)
|
||||
|
||||
# Try Windows-optimized path first
|
||||
if(WIN32)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/grpc_windows.cmake)
|
||||
if(YAZE_GRPC_CONFIGURED)
|
||||
# Validate that grpc_windows.cmake properly exported required targets/variables
|
||||
if(NOT COMMAND target_add_protobuf)
|
||||
message(FATAL_ERROR "grpc_windows.cmake did not define target_add_protobuf function")
|
||||
endif()
|
||||
if(NOT DEFINED ABSL_TARGETS OR NOT ABSL_TARGETS)
|
||||
message(FATAL_ERROR "grpc_windows.cmake did not export ABSL_TARGETS")
|
||||
endif()
|
||||
if(NOT DEFINED YAZE_PROTOBUF_TARGETS OR NOT YAZE_PROTOBUF_TARGETS)
|
||||
message(FATAL_ERROR "grpc_windows.cmake did not export YAZE_PROTOBUF_TARGETS")
|
||||
endif()
|
||||
message(STATUS "✓ Windows vcpkg gRPC configuration validated")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Set minimum CMake version for subprojects (fixes c-ares compatibility)
|
||||
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
|
||||
|
||||
set(FETCHCONTENT_QUIET OFF)
|
||||
|
||||
# CRITICAL: Prevent CMake from finding system-installed protobuf/abseil
|
||||
# This ensures gRPC uses its own bundled versions
|
||||
set(CMAKE_DISABLE_FIND_PACKAGE_Protobuf TRUE)
|
||||
set(CMAKE_DISABLE_FIND_PACKAGE_gRPC TRUE)
|
||||
set(CMAKE_DISABLE_FIND_PACKAGE_absl TRUE)
|
||||
|
||||
# Also prevent pkg-config from finding system packages
|
||||
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH FALSE)
|
||||
|
||||
# Add compiler flags for modern compiler compatibility
|
||||
# These flags are scoped to gRPC and its dependencies only
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
# Clang 15+ compatibility for gRPC
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=missing-template-arg-list-after-template-kw")
|
||||
add_compile_definitions(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
|
||||
elseif(MSVC)
|
||||
# MSVC/Visual Studio compatibility for gRPC templates
|
||||
# v1.67.1 fixes most issues, but these flags help with large template instantiations
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") # Large object files
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /permissive-") # Standards conformance
|
||||
|
||||
# Suppress common gRPC warnings on MSVC (don't use add_compile_options to avoid affecting user code)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4244")
|
||||
|
||||
# Increase template instantiation depth for complex promise chains (MSVC 2019+)
|
||||
if(MSVC_VERSION GREATER_EQUAL 1920)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /constexpr:depth2048")
|
||||
endif()
|
||||
|
||||
# Prevent Windows macro pollution in protobuf-generated headers
|
||||
add_compile_definitions(
|
||||
WIN32_LEAN_AND_MEAN # Exclude rarely-used Windows headers
|
||||
NOMINMAX # Don't define min/max macros
|
||||
NOGDI # Exclude GDI (prevents DWORD and other macro conflicts)
|
||||
)
|
||||
endif()
|
||||
|
||||
# Save YAZE's C++ standard and temporarily set to C++17 for gRPC
|
||||
set(_SAVED_CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD})
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# Configure gRPC build options before fetching
|
||||
set(gRPC_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(gRPC_BUILD_CODEGEN ON CACHE BOOL "" FORCE)
|
||||
set(gRPC_BUILD_GRPC_CPP_PLUGIN ON CACHE BOOL "" FORCE)
|
||||
set(gRPC_BUILD_CSHARP_EXT OFF CACHE BOOL "" FORCE)
|
||||
set(gRPC_BUILD_GRPC_CSHARP_PLUGIN OFF CACHE BOOL "" FORCE)
|
||||
set(gRPC_BUILD_GRPC_NODE_PLUGIN OFF CACHE BOOL "" FORCE)
|
||||
set(gRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN OFF CACHE BOOL "" FORCE)
|
||||
set(gRPC_BUILD_GRPC_PHP_PLUGIN OFF CACHE BOOL "" FORCE)
|
||||
set(gRPC_BUILD_GRPC_PYTHON_PLUGIN OFF CACHE BOOL "" FORCE)
|
||||
set(gRPC_BUILD_GRPC_RUBY_PLUGIN OFF CACHE BOOL "" FORCE)
|
||||
|
||||
set(gRPC_BENCHMARK_PROVIDER "none" CACHE STRING "" FORCE)
|
||||
set(gRPC_ZLIB_PROVIDER "module" CACHE STRING "" FORCE)
|
||||
|
||||
# Skip install rule generation inside gRPC's dependency graph. This avoids
|
||||
# configure-time checks that require every transitive dependency (like Abseil
|
||||
# compatibility shims) to participate in install export sets, which we do not
|
||||
# need for the editor builds.
|
||||
set(CMAKE_SKIP_INSTALL_RULES ON CACHE BOOL "" FORCE)
|
||||
|
||||
# Let gRPC fetch and build its own protobuf and abseil
|
||||
set(gRPC_PROTOBUF_PROVIDER "module" CACHE STRING "" FORCE)
|
||||
set(gRPC_ABSL_PROVIDER "module" CACHE STRING "" FORCE)
|
||||
|
||||
# Protobuf configuration
|
||||
set(protobuf_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(protobuf_BUILD_CONFORMANCE OFF CACHE BOOL "" FORCE)
|
||||
set(protobuf_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
set(protobuf_BUILD_PROTOC_BINARIES ON CACHE BOOL "" FORCE)
|
||||
set(protobuf_WITH_ZLIB ON CACHE BOOL "" FORCE)
|
||||
set(protobuf_MSVC_STATIC_RUNTIME ON CACHE BOOL "" FORCE)
|
||||
|
||||
# Abseil configuration
|
||||
set(ABSL_PROPAGATE_CXX_STD ON CACHE BOOL "" FORCE)
|
||||
set(ABSL_ENABLE_INSTALL ON CACHE BOOL "" FORCE)
|
||||
set(ABSL_BUILD_TESTING OFF CACHE BOOL "" FORCE)
|
||||
set(ABSL_MSVC_STATIC_RUNTIME ON CACHE BOOL "" FORCE)
|
||||
set(gRPC_MSVC_STATIC_RUNTIME ON CACHE BOOL "" FORCE)
|
||||
|
||||
# Disable x86-specific optimizations for ARM64 macOS builds
|
||||
if(APPLE AND CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
|
||||
set(ABSL_USE_EXTERNAL_GOOGLETEST OFF CACHE BOOL "" FORCE)
|
||||
set(ABSL_BUILD_TEST_HELPERS OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
# Declare gRPC with platform-specific versions
|
||||
# - macOS/Linux: v1.75.1 (has ARM64 + modern Clang fixes)
|
||||
# - Windows: v1.75.1 (better NASM/clang-cl support than v1.67.1)
|
||||
set(_GRPC_VERSION "v1.75.1")
|
||||
if(WIN32)
|
||||
set(_GRPC_VERSION_REASON "Windows clang-cl + MSVC compatibility")
|
||||
# Disable BoringSSL ASM to avoid NASM build issues on Windows
|
||||
# ASM optimizations cause NASM flag conflicts with clang-cl
|
||||
set(OPENSSL_NO_ASM ON CACHE BOOL "" FORCE)
|
||||
message(STATUS "Disabling BoringSSL ASM optimizations for Windows build compatibility")
|
||||
else()
|
||||
set(_GRPC_VERSION_REASON "ARM64 macOS + modern Clang compatibility")
|
||||
endif()
|
||||
|
||||
message(STATUS "FetchContent gRPC version: ${_GRPC_VERSION} (${_GRPC_VERSION_REASON})")
|
||||
|
||||
FetchContent_Declare(
|
||||
grpc
|
||||
GIT_REPOSITORY https://github.com/grpc/grpc.git
|
||||
GIT_TAG ${_GRPC_VERSION}
|
||||
GIT_PROGRESS TRUE
|
||||
GIT_SHALLOW TRUE
|
||||
USES_TERMINAL_DOWNLOAD TRUE
|
||||
)
|
||||
|
||||
# Save the current CMAKE_PREFIX_PATH and clear it temporarily
|
||||
# This prevents system packages from interfering
|
||||
set(_SAVED_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})
|
||||
set(CMAKE_PREFIX_PATH "")
|
||||
|
||||
# Download and build in isolation
|
||||
FetchContent_MakeAvailable(grpc)
|
||||
|
||||
# Restore CMAKE_PREFIX_PATH
|
||||
set(CMAKE_PREFIX_PATH ${_SAVED_CMAKE_PREFIX_PATH})
|
||||
|
||||
# Restore YAZE's C++ standard
|
||||
set(CMAKE_CXX_STANDARD ${_SAVED_CMAKE_CXX_STANDARD})
|
||||
|
||||
# Verify targets
|
||||
if(NOT TARGET protoc)
|
||||
message(FATAL_ERROR "Can not find target protoc")
|
||||
endif()
|
||||
if(NOT TARGET grpc_cpp_plugin)
|
||||
message(FATAL_ERROR "Can not find target grpc_cpp_plugin")
|
||||
endif()
|
||||
|
||||
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})
|
||||
|
||||
get_target_property(_PROTOBUF_INCLUDE_DIRS libprotobuf INTERFACE_INCLUDE_DIRECTORIES)
|
||||
list(GET _PROTOBUF_INCLUDE_DIRS 0 _gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR)
|
||||
|
||||
# Export Abseil targets from gRPC's bundled abseil for use by the rest of the project
|
||||
# This ensures version compatibility between gRPC and our project
|
||||
# Note: Order matters for some linkers - put base libraries first
|
||||
set(
|
||||
ABSL_TARGETS
|
||||
absl::base
|
||||
absl::config
|
||||
absl::core_headers
|
||||
absl::utility
|
||||
absl::memory
|
||||
absl::container_memory
|
||||
absl::strings
|
||||
absl::str_format
|
||||
absl::cord
|
||||
absl::hash
|
||||
absl::time
|
||||
absl::status
|
||||
absl::statusor
|
||||
absl::flags
|
||||
absl::flags_parse
|
||||
absl::flags_usage
|
||||
absl::flags_commandlineflag
|
||||
absl::flags_marshalling
|
||||
absl::flags_private_handle_accessor
|
||||
absl::flags_program_name
|
||||
absl::flags_config
|
||||
absl::flags_reflection
|
||||
absl::examine_stack
|
||||
absl::stacktrace
|
||||
absl::failure_signal_handler
|
||||
absl::flat_hash_map
|
||||
absl::synchronization
|
||||
absl::symbolize
|
||||
)
|
||||
|
||||
# Only expose absl::int128 when it's supported without warnings
|
||||
if(NOT WIN32)
|
||||
list(APPEND ABSL_TARGETS absl::int128)
|
||||
endif()
|
||||
|
||||
# ABSL_TARGETS is now available to the rest of the project via include()
|
||||
|
||||
# Fix Abseil ARM64 macOS compile flags (remove x86-specific flags)
|
||||
if(APPLE AND DEFINED CMAKE_OSX_ARCHITECTURES AND CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
|
||||
foreach(_absl_target IN ITEMS absl_random_internal_randen_hwaes absl_random_internal_randen_hwaes_impl)
|
||||
if(TARGET ${_absl_target})
|
||||
get_target_property(_absl_opts ${_absl_target} COMPILE_OPTIONS)
|
||||
if(_absl_opts AND NOT _absl_opts STREQUAL "NOTFOUND")
|
||||
set(_absl_filtered_opts)
|
||||
set(_absl_skip_next FALSE)
|
||||
foreach(_absl_opt IN LISTS _absl_opts)
|
||||
if(_absl_skip_next)
|
||||
set(_absl_skip_next FALSE)
|
||||
continue()
|
||||
endif()
|
||||
if(_absl_opt STREQUAL "-Xarch_x86_64")
|
||||
set(_absl_skip_next TRUE)
|
||||
continue()
|
||||
endif()
|
||||
if(_absl_opt STREQUAL "-maes" OR _absl_opt STREQUAL "-msse4.1")
|
||||
continue()
|
||||
endif()
|
||||
list(APPEND _absl_filtered_opts ${_absl_opt})
|
||||
endforeach()
|
||||
set_property(TARGET ${_absl_target} PROPERTY COMPILE_OPTIONS ${_absl_filtered_opts})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
message(STATUS "gRPC setup complete (includes bundled Abseil)")
|
||||
|
||||
function(target_add_protobuf target)
|
||||
if(NOT TARGET ${target})
|
||||
message(FATAL_ERROR "Target ${target} doesn't exist")
|
||||
endif()
|
||||
if(NOT ARGN)
|
||||
message(SEND_ERROR "Error: target_add_protobuf() called without any proto files")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(_protobuf_include_path -I . -I ${_gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR})
|
||||
foreach(FIL ${ARGN})
|
||||
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
|
||||
get_filename_component(FIL_WE ${FIL} NAME_WE)
|
||||
file(RELATIVE_PATH REL_FIL ${CMAKE_CURRENT_SOURCE_DIR} ${ABS_FIL})
|
||||
get_filename_component(REL_DIR ${REL_FIL} DIRECTORY)
|
||||
if(NOT REL_DIR)
|
||||
set(RELFIL_WE "${FIL_WE}")
|
||||
else()
|
||||
set(RELFIL_WE "${REL_DIR}/${FIL_WE}")
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}_mock.grpc.pb.h"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h"
|
||||
COMMAND ${_gRPC_PROTOBUF_PROTOC_EXECUTABLE}
|
||||
ARGS --grpc_out=generate_mock_code=true:${_gRPC_PROTO_GENS_DIR}
|
||||
--cpp_out=${_gRPC_PROTO_GENS_DIR}
|
||||
--plugin=protoc-gen-grpc=${_gRPC_CPP_PLUGIN}
|
||||
${_protobuf_include_path}
|
||||
${REL_FIL}
|
||||
DEPENDS ${ABS_FIL} protoc grpc_cpp_plugin
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Running gRPC C++ protocol buffer compiler on ${FIL}"
|
||||
VERBATIM)
|
||||
|
||||
target_sources(${target} PRIVATE
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}_mock.grpc.pb.h"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h"
|
||||
)
|
||||
target_include_directories(${target} PUBLIC
|
||||
$<BUILD_INTERFACE:${_gRPC_PROTO_GENS_DIR}>
|
||||
$<BUILD_INTERFACE:${_gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR}>
|
||||
)
|
||||
endforeach()
|
||||
endfunction()
|
||||
253
cmake/grpc_windows.cmake
Normal file
253
cmake/grpc_windows.cmake
Normal file
@@ -0,0 +1,253 @@
|
||||
# Windows-optimized gRPC configuration using vcpkg
|
||||
# This file provides fast gRPC builds on Windows using pre-compiled packages
|
||||
#
|
||||
# Benefits:
|
||||
# - vcpkg build: ~5 minutes (pre-compiled)
|
||||
# - FetchContent build: ~45 minutes (compile from source)
|
||||
#
|
||||
# To use vcpkg (recommended):
|
||||
# vcpkg install grpc:x64-windows
|
||||
# cmake -DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmake ..
|
||||
|
||||
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...")
|
||||
message(STATUS " Note: If gRPC not in vcpkg.json, will fallback to FetchContent (recommended)")
|
||||
|
||||
# Debug: Check if vcpkg toolchain is being used
|
||||
if(DEFINED VCPKG_TOOLCHAIN)
|
||||
message(STATUS " vcpkg toolchain detected: ${VCPKG_TOOLCHAIN}")
|
||||
endif()
|
||||
if(DEFINED CMAKE_TOOLCHAIN_FILE)
|
||||
message(STATUS " CMAKE_TOOLCHAIN_FILE: ${CMAKE_TOOLCHAIN_FILE}")
|
||||
endif()
|
||||
|
||||
# Try to find gRPC via vcpkg (try both gRPC and grpc package names)
|
||||
find_package(gRPC CONFIG QUIET)
|
||||
if(NOT gRPC_FOUND)
|
||||
find_package(grpc CONFIG QUIET)
|
||||
if(grpc_FOUND)
|
||||
set(gRPC_FOUND TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(Protobuf CONFIG QUIET)
|
||||
|
||||
if(gRPC_FOUND AND Protobuf_FOUND)
|
||||
message(STATUS "✓ Using vcpkg gRPC packages (fast build path)")
|
||||
|
||||
# Prevent Windows macro pollution in protobuf-generated headers
|
||||
add_compile_definitions(
|
||||
WIN32_LEAN_AND_MEAN # Exclude rarely-used Windows headers
|
||||
NOMINMAX # Don't define min/max macros
|
||||
NOGDI # Exclude GDI (prevents DWORD and other macro conflicts)
|
||||
)
|
||||
|
||||
|
||||
# Verify required targets exist (check both with and without gRPC:: namespace)
|
||||
set(_grpc_target_found FALSE)
|
||||
if(TARGET gRPC::grpc++)
|
||||
message(STATUS " Found gRPC::grpc++ target")
|
||||
set(_grpc_target_found TRUE)
|
||||
# Create aliases without namespace for compatibility with existing code
|
||||
if(NOT TARGET grpc++)
|
||||
add_library(grpc++ ALIAS gRPC::grpc++)
|
||||
endif()
|
||||
if(TARGET gRPC::grpc++_reflection AND NOT TARGET grpc++_reflection)
|
||||
add_library(grpc++_reflection ALIAS gRPC::grpc++_reflection)
|
||||
endif()
|
||||
elseif(TARGET grpc++)
|
||||
message(STATUS " Found grpc++ target")
|
||||
set(_grpc_target_found TRUE)
|
||||
endif()
|
||||
|
||||
if(NOT _grpc_target_found)
|
||||
message(WARNING "gRPC found but grpc++ target missing - falling back to FetchContent")
|
||||
message(STATUS " Available targets containing 'grpc':")
|
||||
get_property(_all_targets DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY BUILDSYSTEM_TARGETS)
|
||||
foreach(_target ${_all_targets})
|
||||
if(_target MATCHES "grpc" OR _target MATCHES "gRPC")
|
||||
message(STATUS " - ${_target}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(YAZE_GRPC_CONFIGURED FALSE PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Handle protoc (check for both protoc and protobuf::protoc)
|
||||
if(NOT TARGET protoc)
|
||||
if(TARGET protobuf::protoc)
|
||||
get_target_property(PROTOC_LOCATION protobuf::protoc IMPORTED_LOCATION_RELEASE)
|
||||
if(NOT PROTOC_LOCATION)
|
||||
get_target_property(PROTOC_LOCATION protobuf::protoc IMPORTED_LOCATION)
|
||||
endif()
|
||||
if(PROTOC_LOCATION)
|
||||
add_executable(protoc IMPORTED)
|
||||
set_target_properties(protoc PROPERTIES IMPORTED_LOCATION "${PROTOC_LOCATION}")
|
||||
message(STATUS " Found protoc at: ${PROTOC_LOCATION}")
|
||||
else()
|
||||
message(FATAL_ERROR "protoc executable not found in vcpkg package")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "protoc target not found in vcpkg gRPC package")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Handle grpc_cpp_plugin (check for both grpc_cpp_plugin and gRPC::grpc_cpp_plugin)
|
||||
if(NOT TARGET grpc_cpp_plugin)
|
||||
if(TARGET gRPC::grpc_cpp_plugin)
|
||||
get_target_property(PLUGIN_LOCATION gRPC::grpc_cpp_plugin IMPORTED_LOCATION_RELEASE)
|
||||
if(NOT PLUGIN_LOCATION)
|
||||
get_target_property(PLUGIN_LOCATION gRPC::grpc_cpp_plugin IMPORTED_LOCATION)
|
||||
endif()
|
||||
if(PLUGIN_LOCATION)
|
||||
add_executable(grpc_cpp_plugin IMPORTED)
|
||||
set_target_properties(grpc_cpp_plugin PROPERTIES IMPORTED_LOCATION "${PLUGIN_LOCATION}")
|
||||
message(STATUS " Found grpc_cpp_plugin at: ${PLUGIN_LOCATION}")
|
||||
endif()
|
||||
else()
|
||||
# Try find_program as fallback
|
||||
find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin HINTS ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/grpc)
|
||||
if(GRPC_CPP_PLUGIN)
|
||||
add_executable(grpc_cpp_plugin IMPORTED)
|
||||
set_target_properties(grpc_cpp_plugin PROPERTIES IMPORTED_LOCATION "${GRPC_CPP_PLUGIN}")
|
||||
message(STATUS " Found grpc_cpp_plugin at: ${GRPC_CPP_PLUGIN}")
|
||||
else()
|
||||
message(FATAL_ERROR "grpc_cpp_plugin not found in vcpkg gRPC package")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Set variables for compatibility with rest of build system
|
||||
set(_gRPC_PROTOBUF_PROTOC_EXECUTABLE $<TARGET_FILE:protoc> PARENT_SCOPE)
|
||||
set(_gRPC_CPP_PLUGIN $<TARGET_FILE:grpc_cpp_plugin> PARENT_SCOPE)
|
||||
set(_gRPC_PROTO_GENS_DIR ${CMAKE_BINARY_DIR}/gens)
|
||||
file(MAKE_DIRECTORY ${_gRPC_PROTO_GENS_DIR})
|
||||
set(_gRPC_PROTO_GENS_DIR ${_gRPC_PROTO_GENS_DIR} PARENT_SCOPE)
|
||||
|
||||
# Export gRPC library targets (vcpkg uses gRPC:: namespace)
|
||||
# Use the namespaced targets directly
|
||||
set(_GRPC_GRPCPP_LIBRARY gRPC::grpc++)
|
||||
set(_GRPC_REFLECTION_LIBRARY gRPC::grpc++_reflection)
|
||||
|
||||
# Export Abseil targets from vcpkg (critical for linking!)
|
||||
# Note: Abseil targets use absl:: namespace consistently
|
||||
set(ABSL_TARGETS
|
||||
absl::base
|
||||
absl::config
|
||||
absl::core_headers
|
||||
absl::utility
|
||||
absl::memory
|
||||
absl::container_memory
|
||||
absl::strings
|
||||
absl::str_format
|
||||
absl::cord
|
||||
absl::hash
|
||||
absl::time
|
||||
absl::status
|
||||
absl::statusor
|
||||
absl::flags
|
||||
absl::flags_parse
|
||||
absl::flags_usage
|
||||
absl::flags_commandlineflag
|
||||
absl::flags_marshalling
|
||||
absl::flags_private_handle_accessor
|
||||
absl::flags_program_name
|
||||
absl::flags_config
|
||||
absl::flags_reflection
|
||||
absl::examine_stack
|
||||
absl::stacktrace
|
||||
absl::failure_signal_handler
|
||||
absl::flat_hash_map
|
||||
absl::synchronization
|
||||
absl::symbolize
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
# Export protobuf targets (vcpkg uses protobuf:: namespace)
|
||||
set(YAZE_PROTOBUF_TARGETS protobuf::libprotobuf PARENT_SCOPE)
|
||||
set(YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS protobuf::libprotobuf PARENT_SCOPE)
|
||||
|
||||
# Get protobuf include directories for proto generation
|
||||
get_target_property(_PROTOBUF_INCLUDE_DIRS protobuf::libprotobuf
|
||||
INTERFACE_INCLUDE_DIRECTORIES)
|
||||
if(_PROTOBUF_INCLUDE_DIRS)
|
||||
list(GET _PROTOBUF_INCLUDE_DIRS 0 _gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR)
|
||||
set(_gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR ${_gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
# Define target_add_protobuf() function for proto compilation (needed by vcpkg path)
|
||||
function(target_add_protobuf target)
|
||||
if(NOT TARGET ${target})
|
||||
message(FATAL_ERROR "Target ${target} doesn't exist")
|
||||
endif()
|
||||
if(NOT ARGN)
|
||||
message(SEND_ERROR "Error: target_add_protobuf() called without any proto files")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(_protobuf_include_path -I . -I ${_gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR})
|
||||
foreach(FIL ${ARGN})
|
||||
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
|
||||
get_filename_component(FIL_WE ${FIL} NAME_WE)
|
||||
file(RELATIVE_PATH REL_FIL ${CMAKE_CURRENT_SOURCE_DIR} ${ABS_FIL})
|
||||
get_filename_component(REL_DIR ${REL_FIL} DIRECTORY)
|
||||
if(NOT REL_DIR)
|
||||
set(RELFIL_WE "${FIL_WE}")
|
||||
else()
|
||||
set(RELFIL_WE "${REL_DIR}/${FIL_WE}")
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}_mock.grpc.pb.h"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h"
|
||||
COMMAND ${_gRPC_PROTOBUF_PROTOC_EXECUTABLE}
|
||||
ARGS --grpc_out=generate_mock_code=true:${_gRPC_PROTO_GENS_DIR}
|
||||
--cpp_out=${_gRPC_PROTO_GENS_DIR}
|
||||
--plugin=protoc-gen-grpc=${_gRPC_CPP_PLUGIN}
|
||||
${_protobuf_include_path}
|
||||
${REL_FIL}
|
||||
DEPENDS ${ABS_FIL} protoc grpc_cpp_plugin
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Running gRPC C++ protocol buffer compiler on ${FIL}"
|
||||
VERBATIM)
|
||||
|
||||
target_sources(${target} PRIVATE
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}_mock.grpc.pb.h"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc"
|
||||
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h"
|
||||
)
|
||||
target_include_directories(${target} PUBLIC
|
||||
$<BUILD_INTERFACE:${_gRPC_PROTO_GENS_DIR}>
|
||||
$<BUILD_INTERFACE:${_gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR}>
|
||||
)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# Skip the FetchContent path
|
||||
set(YAZE_GRPC_CONFIGURED TRUE PARENT_SCOPE)
|
||||
message(STATUS "gRPC setup complete via vcpkg (includes bundled Abseil)")
|
||||
return()
|
||||
else()
|
||||
message(STATUS "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
||||
message(STATUS " vcpkg gRPC not found (expected if removed from vcpkg.json)")
|
||||
message(STATUS " Using FetchContent build (faster with caching)")
|
||||
message(STATUS " First build: ~10-15 min, subsequent: <1 min (cached)")
|
||||
message(STATUS " Using gRPC v1.75.1 with Windows compatibility fixes")
|
||||
message(STATUS " Note: BoringSSL ASM disabled for clang-cl compatibility")
|
||||
message(STATUS "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If we reach here, vcpkg wasn't used - fall back to standard grpc.cmake
|
||||
message(STATUS "Using FetchContent for gRPC (recommended path for Windows)")
|
||||
set(YAZE_GRPC_CONFIGURED FALSE PARENT_SCOPE)
|
||||
@@ -12,31 +12,21 @@ target_include_directories(ImGui PUBLIC ${SDL2_INCLUDE_DIR})
|
||||
target_compile_definitions(ImGui PUBLIC
|
||||
IMGUI_IMPL_OPENGL_LOADER_CUSTOM=<SDL2/SDL_opengl.h> GL_GLEXT_PROTOTYPES=1)
|
||||
|
||||
# Set up ImGui Test Engine sources and target conditionally
|
||||
if(YAZE_ENABLE_UI_TESTS)
|
||||
# ImGui Test Engine - Always built when tests are enabled for simplified integration
|
||||
# The test infrastructure is tightly coupled with the editor, so we always include it
|
||||
if(YAZE_BUILD_TESTS)
|
||||
set(IMGUI_TEST_ENGINE_PATH ${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine/imgui_test_engine)
|
||||
file(GLOB IMGUI_TEST_ENGINE_SOURCES ${IMGUI_TEST_ENGINE_PATH}/*.cpp)
|
||||
add_library("ImGuiTestEngine" STATIC ${IMGUI_TEST_ENGINE_SOURCES})
|
||||
target_include_directories(ImGuiTestEngine PUBLIC ${IMGUI_PATH} ${CMAKE_SOURCE_DIR}/src/lib)
|
||||
target_link_libraries(ImGuiTestEngine PUBLIC ImGui)
|
||||
|
||||
# Enable test engine definitions only when UI tests are enabled
|
||||
target_compile_definitions(ImGuiTestEngine PUBLIC
|
||||
IMGUI_ENABLE_TEST_ENGINE=1
|
||||
IMGUI_TEST_ENGINE_ENABLE_COROUTINE_STDTHREAD_IMPL=1)
|
||||
|
||||
# Also define for targets that link to ImGuiTestEngine
|
||||
set(IMGUI_TEST_ENGINE_DEFINITIONS
|
||||
IMGUI_ENABLE_TEST_ENGINE=1
|
||||
IMGUI_TEST_ENGINE_ENABLE_COROUTINE_STDTHREAD_IMPL=1)
|
||||
|
||||
# Make ImGuiTestEngine target available
|
||||
set(IMGUI_TEST_ENGINE_TARGET ImGuiTestEngine)
|
||||
message(STATUS "✓ ImGui Test Engine enabled (tests are ON)")
|
||||
else()
|
||||
# Create empty variables when UI tests are disabled
|
||||
set(IMGUI_TEST_ENGINE_SOURCES "")
|
||||
set(IMGUI_TEST_ENGINE_TARGET "")
|
||||
set(IMGUI_TEST_ENGINE_DEFINITIONS "")
|
||||
message(STATUS "✗ ImGui Test Engine disabled (tests are OFF)")
|
||||
endif()
|
||||
|
||||
set(
|
||||
|
||||
45
cmake/llvm-brew.toolchain.cmake
Normal file
45
cmake/llvm-brew.toolchain.cmake
Normal file
@@ -0,0 +1,45 @@
|
||||
# cmake/toolchains/homebrew-llvm.toolchain.cmake
|
||||
#
|
||||
# CMake Toolchain File for using the Homebrew LLVM/Clang installation on macOS.
|
||||
# This ensures that the main project and all dependencies (like gRPC) use the
|
||||
# correct compiler and header search paths.
|
||||
|
||||
# 1. Set the target system (macOS)
|
||||
set(CMAKE_SYSTEM_NAME Darwin)
|
||||
|
||||
# 2. Find the Homebrew LLVM installation path
|
||||
# We use execute_process to make this portable across machine architectures.
|
||||
execute_process(
|
||||
COMMAND brew --prefix llvm@18
|
||||
OUTPUT_VARIABLE HOMEBREW_LLVM_PREFIX
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
if(NOT EXISTS "${HOMEBREW_LLVM_PREFIX}")
|
||||
message(FATAL_ERROR "Homebrew LLVM not found. Please run 'brew install llvm'. Path: ${HOMEBREW_LLVM_PREFIX}")
|
||||
endif()
|
||||
|
||||
message(STATUS "Using Homebrew LLVM from: ${HOMEBREW_LLVM_PREFIX}")
|
||||
|
||||
# 3. Set the C and C++ compilers
|
||||
set(CMAKE_C_COMPILER "${HOMEBREW_LLVM_PREFIX}/bin/clang")
|
||||
set(CMAKE_CXX_COMPILER "${HOMEBREW_LLVM_PREFIX}/bin/clang++")
|
||||
|
||||
# 4. Set the system root (sysroot) to the macOS SDK
|
||||
# This correctly points to the system-level headers and libraries.
|
||||
execute_process(
|
||||
COMMAND xcrun --show-sdk-path
|
||||
OUTPUT_VARIABLE CMAKE_OSX_SYSROOT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
set(CMAKE_SYSROOT "${CMAKE_OSX_SYSROOT}")
|
||||
message(STATUS "Using macOS SDK at: ${CMAKE_SYSROOT}")
|
||||
|
||||
# 5. **[THE CRITICAL FIX]** Explicitly define the C++ standard library include directory.
|
||||
# This forces CMake to add Homebrew's libc++ headers to the search path *before*
|
||||
# any other system paths, resolving the header conflict for the main project
|
||||
# and all dependencies.
|
||||
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES "${HOMEBREW_LLVM_PREFIX}/include/c++/v1")
|
||||
|
||||
# 6. Set the default installation path for macOS frameworks
|
||||
set(CMAKE_FIND_FRAMEWORK FIRST)
|
||||
@@ -1,54 +1,66 @@
|
||||
# SDL2
|
||||
if (UNIX OR MINGW OR WIN32)
|
||||
# On Windows with vcpkg, prefer vcpkg packages for faster builds
|
||||
if(WIN32)
|
||||
# Disable pkgconfig for SDL on Windows (prevents MSYS2 download failures in vcpkg)
|
||||
set(SDL_PKGCONFIG OFF CACHE BOOL "Disable pkgconfig on Windows" FORCE)
|
||||
|
||||
# Try to find SDL2 via vcpkg first if toolchain is available
|
||||
if(DEFINED CMAKE_TOOLCHAIN_FILE AND EXISTS "${CMAKE_TOOLCHAIN_FILE}")
|
||||
find_package(SDL2 CONFIG QUIET)
|
||||
if(SDL2_FOUND OR TARGET SDL2::SDL2)
|
||||
# Use vcpkg SDL2
|
||||
if(TARGET SDL2::SDL2)
|
||||
set(SDL_TARGETS SDL2::SDL2)
|
||||
if(TARGET SDL2::SDL2main)
|
||||
list(PREPEND SDL_TARGETS SDL2::SDL2main)
|
||||
endif()
|
||||
list(APPEND SDL_TARGETS ws2_32)
|
||||
add_definitions("-DSDL_MAIN_HANDLED")
|
||||
message(STATUS "✓ Using vcpkg SDL2")
|
||||
|
||||
# Get SDL2 include directories for reference
|
||||
get_target_property(SDL2_INCLUDE_DIR SDL2::SDL2 INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Fall back to bundled SDL if vcpkg not available or SDL2 not found
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/src/lib/SDL/CMakeLists.txt")
|
||||
message(STATUS "○ vcpkg SDL2 not found, using bundled SDL2")
|
||||
add_subdirectory(src/lib/SDL)
|
||||
set(SDL_TARGETS SDL2-static)
|
||||
set(SDL2_INCLUDE_DIR
|
||||
${CMAKE_SOURCE_DIR}/src/lib/SDL/include
|
||||
${CMAKE_BINARY_DIR}/src/lib/SDL/include
|
||||
${CMAKE_BINARY_DIR}/src/lib/SDL/include-config-${CMAKE_BUILD_TYPE}
|
||||
)
|
||||
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
|
||||
if(TARGET SDL2main)
|
||||
list(PREPEND SDL_TARGETS SDL2main)
|
||||
endif()
|
||||
list(APPEND SDL_TARGETS ws2_32)
|
||||
add_definitions("-DSDL_MAIN_HANDLED")
|
||||
else()
|
||||
message(FATAL_ERROR "SDL2 not found via vcpkg and bundled SDL2 not available. Please install via vcpkg or ensure submodules are initialized.")
|
||||
endif()
|
||||
elseif(UNIX OR MINGW)
|
||||
# Non-Windows: use bundled SDL
|
||||
add_subdirectory(src/lib/SDL)
|
||||
# When using bundled SDL, use the static target and set include directories
|
||||
set(SDL_TARGETS SDL2-static)
|
||||
set(SDL2_INCLUDE_DIR
|
||||
${CMAKE_SOURCE_DIR}/src/lib/SDL/include
|
||||
${CMAKE_BINARY_DIR}/src/lib/SDL/include
|
||||
${CMAKE_BINARY_DIR}/src/lib/SDL/include-config-${CMAKE_BUILD_TYPE}
|
||||
)
|
||||
# Also set for consistency with bundled SDL
|
||||
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
|
||||
message(STATUS "Using bundled SDL2")
|
||||
else()
|
||||
find_package(SDL2)
|
||||
# When using system SDL, use the imported targets
|
||||
# Fallback: try to find system SDL
|
||||
find_package(SDL2 REQUIRED)
|
||||
set(SDL_TARGETS SDL2::SDL2)
|
||||
if(WIN32)
|
||||
list(PREPEND SDL_TARGETS SDL2::SDL2main ws2_32)
|
||||
add_definitions("-DSDL_MAIN_HANDLED")
|
||||
endif()
|
||||
message(STATUS "Using system SDL2")
|
||||
endif()
|
||||
|
||||
# libpng and ZLIB dependencies
|
||||
if(WIN32)
|
||||
# Windows builds with vcpkg (OpenGL/GLEW removed to avoid MSYS2 issues)
|
||||
if(NOT YAZE_MINIMAL_BUILD)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
else()
|
||||
# For CI/minimal builds, try to find but don't require
|
||||
find_package(ZLIB QUIET)
|
||||
find_package(PNG QUIET)
|
||||
if(NOT ZLIB_FOUND OR NOT PNG_FOUND)
|
||||
message(STATUS "PNG/ZLIB not found in minimal build, some features may be disabled")
|
||||
set(PNG_FOUND FALSE)
|
||||
set(PNG_LIBRARIES "")
|
||||
set(PNG_INCLUDE_DIRS "")
|
||||
endif()
|
||||
endif()
|
||||
elseif(YAZE_MINIMAL_BUILD)
|
||||
# For CI builds on other platforms, try to find but don't require
|
||||
find_package(ZLIB QUIET)
|
||||
find_package(PNG QUIET)
|
||||
if(NOT ZLIB_FOUND OR NOT PNG_FOUND)
|
||||
message(STATUS "PNG/ZLIB not found in minimal build, some features may be disabled")
|
||||
set(PNG_FOUND FALSE)
|
||||
set(PNG_LIBRARIES "")
|
||||
set(PNG_INCLUDE_DIRS "")
|
||||
endif()
|
||||
else()
|
||||
# Regular builds require these dependencies
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
endif()
|
||||
# PNG and ZLIB dependencies removed
|
||||
71
cmake/utils.cmake
Normal file
71
cmake/utils.cmake
Normal file
@@ -0,0 +1,71 @@
|
||||
# This file contains utility functions for the yaze build system.
|
||||
|
||||
# ============================================================================
|
||||
# yaze_add_compiler_flags
|
||||
#
|
||||
# Sets standard compiler flags for C++ and C.
|
||||
# Also handles platform-specific and compiler-specific flags.
|
||||
# ============================================================================
|
||||
function(yaze_add_compiler_flags)
|
||||
# Set C++ and C standards in parent scope
|
||||
set(CMAKE_CXX_STANDARD 23 PARENT_SCOPE)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON PARENT_SCOPE)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF PARENT_SCOPE)
|
||||
set(CMAKE_C_STANDARD 99 PARENT_SCOPE)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON PARENT_SCOPE)
|
||||
|
||||
if(YAZE_SUPPRESS_WARNINGS)
|
||||
if(MSVC)
|
||||
add_compile_options(/w)
|
||||
else()
|
||||
add_compile_options(-w)
|
||||
endif()
|
||||
message(STATUS "✓ Warnings suppressed (use -v preset suffix for verbose builds)")
|
||||
else()
|
||||
message(STATUS "○ Verbose warnings enabled")
|
||||
endif()
|
||||
|
||||
# Common interface target for shared settings
|
||||
add_library(yaze_common INTERFACE)
|
||||
target_compile_features(yaze_common INTERFACE cxx_std_23)
|
||||
|
||||
# Platform-specific definitions
|
||||
if(YAZE_PLATFORM_LINUX)
|
||||
target_compile_definitions(yaze_common INTERFACE linux stricmp=strcasecmp)
|
||||
elseif(YAZE_PLATFORM_MACOS)
|
||||
target_compile_definitions(yaze_common INTERFACE MACOS)
|
||||
elseif(YAZE_PLATFORM_WINDOWS)
|
||||
target_compile_definitions(yaze_common INTERFACE WINDOWS)
|
||||
endif()
|
||||
|
||||
# Compiler-specific settings
|
||||
if(MSVC)
|
||||
target_compile_options(yaze_common INTERFACE
|
||||
/EHsc
|
||||
/W4 /permissive-
|
||||
/bigobj
|
||||
/utf-8
|
||||
)
|
||||
target_compile_definitions(yaze_common INTERFACE
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
_CRT_NONSTDC_NO_WARNINGS
|
||||
SILENCE_CXX23_DEPRECATIONS
|
||||
_SILENCE_CXX23_DEPRECATION_WARNING
|
||||
_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS
|
||||
NOMINMAX
|
||||
WIN32_LEAN_AND_MEAN
|
||||
strncasecmp=_strnicmp
|
||||
strcasecmp=_stricmp
|
||||
)
|
||||
else()
|
||||
target_compile_options(yaze_common INTERFACE
|
||||
-Wall -Wextra -Wpedantic
|
||||
-Wno-deprecated-declarations
|
||||
-Wno-c++23-compat
|
||||
)
|
||||
target_compile_definitions(yaze_common INTERFACE
|
||||
_SILENCE_CXX23_DEPRECATION_WARNING
|
||||
_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -1,40 +1,54 @@
|
||||
# vcpkg configuration reporting for Windows builds
|
||||
# This file is included AFTER vcpkg toolchain has run, so we can only report and validate
|
||||
#
|
||||
# IMPORTANT: vcpkg configuration variables (VCPKG_TARGET_TRIPLET, etc.) must be set:
|
||||
# 1. On the CMake command line: -DVCPKG_TARGET_TRIPLET=x64-windows-static
|
||||
# 2. Via environment variables: set VCPKG_DEFAULT_TRIPLET=x64-windows-static
|
||||
# 3. In vcpkg-configuration.json in the project root
|
||||
|
||||
# vcpkg configuration for Windows builds
|
||||
# Windows-specific macro definitions to avoid conflicts
|
||||
add_definitions("-DMICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS=0")
|
||||
|
||||
# vcpkg settings
|
||||
set(VCPKG_CRT_LINKAGE dynamic)
|
||||
set(VCPKG_LIBRARY_LINKAGE dynamic)
|
||||
# Determine what triplet is being used (for reporting)
|
||||
set(_vcpkg_triplet "unknown")
|
||||
if(DEFINED VCPKG_TARGET_TRIPLET)
|
||||
set(_vcpkg_triplet "${VCPKG_TARGET_TRIPLET}")
|
||||
elseif(DEFINED ENV{VCPKG_DEFAULT_TRIPLET})
|
||||
set(_vcpkg_triplet "$ENV{VCPKG_DEFAULT_TRIPLET}")
|
||||
endif()
|
||||
|
||||
# Enable vcpkg manifest mode for automatic dependency management
|
||||
set(VCPKG_MANIFEST_MODE ON)
|
||||
# Detect installed directory
|
||||
set(_vcpkg_installed "${CMAKE_BINARY_DIR}/vcpkg_installed")
|
||||
if(DEFINED VCPKG_INSTALLED_DIR)
|
||||
set(_vcpkg_installed "${VCPKG_INSTALLED_DIR}")
|
||||
endif()
|
||||
|
||||
# Auto-detect target architecture and set vcpkg triplet
|
||||
if(NOT DEFINED VCPKG_TARGET_TRIPLET)
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64|aarch64")
|
||||
set(VCPKG_TARGET_TRIPLET "arm64-windows" CACHE STRING "vcpkg target triplet")
|
||||
set(VCPKG_TARGET_ARCHITECTURE arm64)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64|x86_64")
|
||||
set(VCPKG_TARGET_TRIPLET "x64-windows" CACHE STRING "vcpkg target triplet")
|
||||
set(VCPKG_TARGET_ARCHITECTURE x64)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|x86")
|
||||
set(VCPKG_TARGET_TRIPLET "x86-windows" CACHE STRING "vcpkg target triplet")
|
||||
set(VCPKG_TARGET_ARCHITECTURE x86)
|
||||
# Detect manifest mode
|
||||
set(_vcpkg_manifest "ON (auto)")
|
||||
if(DEFINED VCPKG_MANIFEST_MODE)
|
||||
if(VCPKG_MANIFEST_MODE)
|
||||
set(_vcpkg_manifest "ON")
|
||||
else()
|
||||
# Fallback to x64 if architecture detection fails
|
||||
set(VCPKG_TARGET_TRIPLET "x64-windows" CACHE STRING "vcpkg target triplet")
|
||||
set(VCPKG_TARGET_ARCHITECTURE x64)
|
||||
message(WARNING "Could not detect target architecture, defaulting to x64")
|
||||
set(_vcpkg_manifest "OFF")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Set vcpkg installation directory if not already set
|
||||
if(NOT DEFINED VCPKG_INSTALLED_DIR)
|
||||
set(VCPKG_INSTALLED_DIR "${CMAKE_BINARY_DIR}/vcpkg_installed" CACHE PATH "vcpkg installed directory")
|
||||
# Report vcpkg configuration
|
||||
message(STATUS "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
||||
message(STATUS "vcpkg Post-Toolchain Report:")
|
||||
message(STATUS " ├─ Active triplet: ${_vcpkg_triplet}")
|
||||
message(STATUS " ├─ Manifest mode: ${_vcpkg_manifest}")
|
||||
message(STATUS " └─ Installed directory: ${_vcpkg_installed}")
|
||||
message(STATUS "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
||||
|
||||
# Validation warnings
|
||||
if(_vcpkg_triplet STREQUAL "unknown")
|
||||
message(WARNING "vcpkg triplet not detected! Build may fail.")
|
||||
message(WARNING "Set VCPKG_TARGET_TRIPLET on command line or VCPKG_DEFAULT_TRIPLET env var")
|
||||
endif()
|
||||
|
||||
message(STATUS "vcpkg configuration:")
|
||||
message(STATUS " Target architecture: ${VCPKG_TARGET_ARCHITECTURE}")
|
||||
message(STATUS " Target triplet: ${VCPKG_TARGET_TRIPLET}")
|
||||
message(STATUS " Installed directory: ${VCPKG_INSTALLED_DIR}")
|
||||
message(STATUS " Manifest mode: ${VCPKG_MANIFEST_MODE}")
|
||||
# Ensure manifest file exists
|
||||
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/vcpkg.json")
|
||||
message(WARNING "vcpkg.json manifest not found in ${CMAKE_SOURCE_DIR}")
|
||||
message(WARNING "vcpkg dependency installation may fail!")
|
||||
endif()
|
||||
|
||||
37
cmake/windows-vcpkg.toolchain.cmake
Normal file
37
cmake/windows-vcpkg.toolchain.cmake
Normal file
@@ -0,0 +1,37 @@
|
||||
# Windows vcpkg toolchain wrapper
|
||||
# This file provides a convenient way to configure vcpkg for Windows builds
|
||||
#
|
||||
# Usage:
|
||||
# cmake -DCMAKE_TOOLCHAIN_FILE=cmake/windows-vcpkg.toolchain.cmake ..
|
||||
#
|
||||
# Or set VCPKG_ROOT environment variable and this will find it automatically
|
||||
|
||||
# Set vcpkg triplet for static Windows builds
|
||||
set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "vcpkg triplet")
|
||||
set(VCPKG_HOST_TRIPLET "x64-windows" CACHE STRING "vcpkg host triplet")
|
||||
|
||||
# Enable manifest mode
|
||||
set(VCPKG_MANIFEST_MODE ON CACHE BOOL "Use vcpkg manifest mode")
|
||||
|
||||
# Find vcpkg root
|
||||
if(DEFINED ENV{VCPKG_ROOT} AND EXISTS "$ENV{VCPKG_ROOT}")
|
||||
set(VCPKG_ROOT "$ENV{VCPKG_ROOT}" CACHE PATH "vcpkg root directory")
|
||||
elseif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../vcpkg/scripts/buildsystems/vcpkg.cmake")
|
||||
set(VCPKG_ROOT "${CMAKE_CURRENT_LIST_DIR}/../vcpkg" CACHE PATH "vcpkg root directory")
|
||||
else()
|
||||
message(WARNING "vcpkg not found. Set VCPKG_ROOT environment variable or clone vcpkg to project root.")
|
||||
message(WARNING " git clone https://github.com/Microsoft/vcpkg.git")
|
||||
message(WARNING " cd vcpkg && bootstrap-vcpkg.bat")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Include the vcpkg toolchain
|
||||
set(VCPKG_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
|
||||
if(EXISTS "${VCPKG_TOOLCHAIN_FILE}")
|
||||
message(STATUS "Using vcpkg toolchain: ${VCPKG_TOOLCHAIN_FILE}")
|
||||
message(STATUS " Triplet: ${VCPKG_TARGET_TRIPLET}")
|
||||
include("${VCPKG_TOOLCHAIN_FILE}")
|
||||
else()
|
||||
message(FATAL_ERROR "vcpkg toolchain not found at ${VCPKG_TOOLCHAIN_FILE}")
|
||||
endif()
|
||||
|
||||
34
cmake/yaze.plist.in
Normal file
34
cmake/yaze.plist.in
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Reference in New Issue
Block a user