From 1cec82613bc3c0c89bafad21c7764d0d89b6a6c1 Mon Sep 17 00:00:00 2001 From: tech-ticks <65084428+tech-ticks@users.noreply.github.com> Date: Thu, 31 Mar 2022 02:21:00 +0200 Subject: [PATCH] interface: Fix macOS build (#485) * Compile macOS interface with clang * Fix OpenGL dependency on macOS --- .github/workflows/build_interface.yml | 8 ++++---- desmume/src/frontend/interface/meson.build | 9 ++++++++- desmume/src/frontend/posix/shared/mic_openal.cpp | 9 +++++++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_interface.yml b/.github/workflows/build_interface.yml index d7c33ebf9..405317124 100644 --- a/.github/workflows/build_interface.yml +++ b/.github/workflows/build_interface.yml @@ -44,14 +44,14 @@ jobs: cd desmume/src/frontend/interface/ meson build env: - CC: gcc-10 - CXX: g++-10 + CC: clang + CXX: clang++ - name: Build - ninja run: ninja -C desmume/src/frontend/interface/build env: - CC: gcc-10 - CXX: g++-10 + CC: clang + CXX: clang++ - name: Upload artificat uses: actions/upload-artifact@v2 diff --git a/desmume/src/frontend/interface/meson.build b/desmume/src/frontend/interface/meson.build index 821e5d207..1a6328a1a 100644 --- a/desmume/src/frontend/interface/meson.build +++ b/desmume/src/frontend/interface/meson.build @@ -40,6 +40,11 @@ else have_jit = false endif +# Clang refuses to compile with this warning +if meson.get_compiler('cpp').get_id() == 'clang' + add_global_arguments('-Wno-c++11-narrowing', language: ['c', 'cpp']) +endif + includes = include_directories( '../../../src', '../../../src/libretro-common/include', @@ -168,7 +173,9 @@ if have_jit ] endif -if dep_gl.found() +if host_machine.system() == 'darwin' + dependencies += dependency('appleframeworks', modules: 'OpenGL') +elif dep_gl.found() dependencies += dep_gl libdesmume_src += [ '../../OGLRender.cpp', diff --git a/desmume/src/frontend/posix/shared/mic_openal.cpp b/desmume/src/frontend/posix/shared/mic_openal.cpp index e181ef2a8..5adff51d1 100644 --- a/desmume/src/frontend/posix/shared/mic_openal.cpp +++ b/desmume/src/frontend/posix/shared/mic_openal.cpp @@ -18,8 +18,13 @@ #ifndef WIN32 -#include -#include +#ifdef __APPLE__ + #include + #include +#else + #include + #include +#endif #include "types.h" #include "mic.h"