build: fix building on macOS with Homebrew

Move setting up the environment for macOS Homebrew earlier in
Options.cmake, as well as finding pkgconfig.

Update gcc/clang toolchain to not pass a gcc-specific option to clang.

Add faudio to list of brew packages to get in installdeps.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2024-04-15 23:30:34 +00:00
parent 6766b9ca54
commit b52edf52ff
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
4 changed files with 11 additions and 10 deletions

View File

@ -77,8 +77,6 @@ set(CMAKE_C_STANDARD_REQUIRED True)
project(VBA-M C CXX)
find_package(PkgConfig)
if(NOT CMAKE_PREFIX_PATH AND (NOT ("$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")))
set(CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
endif()

View File

@ -54,6 +54,14 @@ cmake_dependent_option(ENABLE_MMX "Enable MMX" ${MMX_DEFAULT} "ENABLE_ASM_SCALER
option(ENABLE_LIRC "Enable LIRC support" OFF)
# Add support for Homebrew, MacPorts and Fink on macOS
option(DISABLE_MACOS_PACKAGE_MANAGERS "Set to TRUE to disable support for macOS Homebrew, MacPorts and Fink." FALSE)
if(APPLE AND NOT DISABLE_MACOS_PACKAGE_MANAGERS)
include(MacPackageManagers)
endif()
find_package(PkgConfig)
# Link / SFML
if(TRANSLATIONS_ONLY)
set(ENABLE_LINK_DEFAULT OFF)
@ -119,12 +127,6 @@ option(ENABLE_LTO "Compile with Link Time Optimization" ${LTO_DEFAULT})
option(ENABLE_GBA_LOGGING "Enable extended GBA logging" ON)
# Add support for Homebrew, MacPorts and Fink on macOS
option(DISABLE_MACOS_PACKAGE_MANAGERS "Set to TRUE to disable support for macOS Homebrew, MacPorts and Fink." FALSE)
if(APPLE AND NOT DISABLE_MACOS_PACKAGE_MANAGERS)
include(MacPackageManagers)
endif()
option(UPSTREAM_RELEASE "do some optimizations and release automation tasks" OFF)
if(WIN32)

View File

@ -18,12 +18,13 @@ add_compile_options(
$<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-copy>
-Wformat
-Wformat-security
-feliminate-unused-debug-types
-fdiagnostics-color=always
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-unused-command-line-argument)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-feliminate-unused-debug-types)
endif()
# check if ssp flags are supported.

View File

@ -1192,7 +1192,7 @@ brew_installdeps() {
check brew -v update
brews="nasm cmake ccache gettext pkg-config sdl2 wxwidgets ccache ninja"
brews="nasm cmake ccache gettext pkg-config sdl2 wxwidgets faudio ccache ninja zlib"
[ -n "$ENABLE_FFMPEG" ] && brews="$brews ffmpeg"