This commit updates the Brewfile to include additional optional dependencies such as Vulkan headers, RapidJSON, and various libraries for enhanced functionality. It also modifies CMake files to make the handling of optional components more user-friendly, allowing missing dependencies to disable features without causing build failures on macOS. Additionally, it refines the search paths for the Sparkle framework and adjusts the linking of the discord-rpc library based on the availability of RapidJSON.
113 lines
3.7 KiB
CMake
113 lines
3.7 KiB
CMake
set(summary_willbuild "")
|
|
set(summary_willnotbuild "")
|
|
|
|
# On some platforms (notably macOS via Homebrew), many "optional" dependencies are
|
|
# not installed by default. Historically, Strawberry treated missing optional deps
|
|
# as a hard error when the option defaulted to ON, which makes first-time builds
|
|
# frustrating.
|
|
#
|
|
# This toggle controls that behavior:
|
|
# - ON => missing optional deps abort the configure (packager/CI-friendly)
|
|
# - OFF => missing optional deps auto-disable the component (dev-friendly)
|
|
set(_optional_components_fatal_default ON)
|
|
if(APPLE)
|
|
set(_optional_components_fatal_default OFF)
|
|
endif()
|
|
option(OPTIONAL_COMPONENTS_MISSING_DEPS_ARE_FATAL
|
|
"If ON, missing optional component dependencies are fatal (otherwise components auto-disable)"
|
|
${_optional_components_fatal_default}
|
|
)
|
|
|
|
macro(optional_component_summary_add name test)
|
|
if (${test})
|
|
list(APPEND summary_willbuild ${name})
|
|
else (${test})
|
|
list(APPEND summary_willnotbuild "${name}")
|
|
endif (${test})
|
|
endmacro(optional_component_summary_add)
|
|
|
|
macro(optional_component_summary_show_part variable title)
|
|
list(LENGTH ${variable} _len)
|
|
if (_len)
|
|
message("")
|
|
message(${title})
|
|
foreach (_item ${${variable}})
|
|
message(" ${_item}")
|
|
endforeach (_item)
|
|
endif (_len)
|
|
endmacro(optional_component_summary_show_part)
|
|
|
|
macro(optional_component_summary_show)
|
|
list(SORT summary_willbuild)
|
|
list(SORT summary_willnotbuild)
|
|
message("")
|
|
message("Building strawberry version: ${STRAWBERRY_VERSION_DISPLAY}, Qt version ${Qt${QT_VERSION_MAJOR}Core_VERSION}")
|
|
optional_component_summary_show_part(summary_willbuild "The following components will be built:")
|
|
optional_component_summary_show_part(summary_willnotbuild "The following components WILL NOT be built:")
|
|
message("")
|
|
endmacro(optional_component_summary_show)
|
|
|
|
function(optional_component name default description)
|
|
|
|
set(option_variable "ENABLE_${name}")
|
|
set(have_variable "HAVE_${name}")
|
|
set(${have_variable} OFF)
|
|
|
|
# Create the option
|
|
option(${option_variable} "${description}" ${default})
|
|
|
|
# Was the option set?
|
|
if(NOT ${option_variable})
|
|
set(summary_willnotbuild "${summary_willnotbuild};${description} (disabled in CMake config)" PARENT_SCOPE)
|
|
return()
|
|
endif()
|
|
|
|
# Check each of the dependencies
|
|
set(next_arg_is_dep_name FALSE)
|
|
set(testing_deps TRUE)
|
|
set(current_dep_name)
|
|
set(missing_deps)
|
|
|
|
foreach(arg ${ARGN})
|
|
if(${next_arg_is_dep_name})
|
|
set(current_dep_name "${arg}")
|
|
set(next_arg_is_dep_name FALSE)
|
|
elseif(arg STREQUAL "DEPENDS")
|
|
set(next_arg_is_dep_name TRUE)
|
|
set(testing_deps TRUE)
|
|
elseif(${testing_deps})
|
|
string(REPLACE " " ";" arglist "${arg}")
|
|
if(${arglist})
|
|
# We have to do this instead of if(NOT ${arg}) so that tests may contain "NOT" themselves.
|
|
else()
|
|
list(APPEND missing_deps "${current_dep_name}")
|
|
set(testing_deps FALSE)
|
|
endif()
|
|
endif()
|
|
endforeach()
|
|
|
|
if(missing_deps)
|
|
foreach(dep ${missing_deps})
|
|
if(deplist_text)
|
|
set(deplist_text "${deplist_text}, ${dep}")
|
|
else()
|
|
set(deplist_text "${dep}")
|
|
endif()
|
|
endforeach()
|
|
set(text "${description} (missing ${deplist_text})")
|
|
|
|
set(summary_willnotbuild "${summary_willnotbuild};${text}" PARENT_SCOPE)
|
|
if(OPTIONAL_COMPONENTS_MISSING_DEPS_ARE_FATAL)
|
|
message(FATAL_ERROR "${text}, to disable this optional feature, pass -D${option_variable}=OFF to CMake")
|
|
else()
|
|
message(STATUS "${text} - disabling ${option_variable}")
|
|
set(${option_variable} OFF CACHE BOOL "${description}" FORCE)
|
|
return()
|
|
endif()
|
|
|
|
else()
|
|
set(${have_variable} ON PARENT_SCOPE)
|
|
set(summary_willbuild "${summary_willbuild};${description}" PARENT_SCOPE)
|
|
endif()
|
|
endfunction()
|