feat: Enhance modular build support and update Abseil integration for macOS

This commit is contained in:
scawful
2025-10-03 19:10:59 -04:00
parent c3eaace72c
commit c9f439207e
6 changed files with 59 additions and 23 deletions

View File

@@ -1,4 +1,10 @@
if (MINGW OR WIN32)
# Normalize Abseil's hardware AES flags when targeting macOS ARM64 only.
if(APPLE AND DEFINED CMAKE_OSX_ARCHITECTURES AND CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
set(ABSL_RANDOM_HWAES_X64_FLAGS "" CACHE STRING "" FORCE)
set(ABSL_RANDOM_HWAES_ARM64_FLAGS "-march=armv8-a+crypto" CACHE STRING "" FORCE)
endif()
if (MINGW OR WIN32 OR YAZE_FORCE_BUNDLED_ABSL)
add_subdirectory(src/lib/abseil-cpp)
elseif(YAZE_MINIMAL_BUILD)
# For CI builds, always use submodule to avoid dependency issues
@@ -62,3 +68,31 @@ if(NOT WIN32)
else()
message(STATUS "Excluding absl::int128 on Windows to avoid C++23 deprecation issues")
endif()
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(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_target_properties(${_absl_target} PROPERTIES COMPILE_OPTIONS "${_absl_filtered_opts}")
endif()
target_compile_options(${_absl_target} PRIVATE "-Xarch_arm64" "-march=armv8-a+crypto")
endif()
endforeach()
endif()