From b52edf52ff4c13a73a33faadba6fae47acfcd9c8 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Mon, 15 Apr 2024 23:30:34 +0000 Subject: [PATCH] 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 --- CMakeLists.txt | 2 -- cmake/Options.cmake | 14 ++++++++------ cmake/Toolchain-gcc-clang.cmake | 3 ++- installdeps | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc56b5d1..af865091 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/cmake/Options.cmake b/cmake/Options.cmake index d70d7167..33b78fd5 100644 --- a/cmake/Options.cmake +++ b/cmake/Options.cmake @@ -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) diff --git a/cmake/Toolchain-gcc-clang.cmake b/cmake/Toolchain-gcc-clang.cmake index eb9f3e4e..f73f25c9 100644 --- a/cmake/Toolchain-gcc-clang.cmake +++ b/cmake/Toolchain-gcc-clang.cmake @@ -18,12 +18,13 @@ add_compile_options( $<$:-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. diff --git a/installdeps b/installdeps index 363f27b0..8ff25b82 100755 --- a/installdeps +++ b/installdeps @@ -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"