Browse Source

Fixed fontconfig cmake search and libclang isysroot issue on MacOS

merge-requests/181/head^2
eidheim 11 months ago
parent
commit
d473c95af0
  1. 2
      CMakeLists.txt
  2. 8
      src/compile_commands.cpp

2
CMakeLists.txt

@ -59,7 +59,7 @@ if(APPLE)
include_directories(/usr/local/opt/gettext/include) include_directories(/usr/local/opt/gettext/include)
set(CMAKE_MACOSX_RPATH 1) set(CMAKE_MACOSX_RPATH 1)
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/libsigc++@2/lib/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig") set(ENV{PKG_CONFIG_PATH} "/opt/homebrew/opt/fontconfig/lib/pkgconfig:/usr/local/opt/fontconfig/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/libsigc++@2/lib/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig")
endif() endif()
if(${CMAKE_SYSTEM_NAME} MATCHES FreeBSD) if(${CMAKE_SYSTEM_NAME} MATCHES FreeBSD)
link_directories(/usr/local/lib) link_directories(/usr/local/lib)

8
src/compile_commands.cpp

@ -123,6 +123,14 @@ std::vector<std::string> CompileCommands::get_arguments(const boost::filesystem:
arguments.emplace_back(resource_path); arguments.emplace_back(resource_path);
} }
#ifdef __APPLE__
// Add -isysroot argument if it is missing on MacOS, which is needed by newer libclang
if(std::none_of(arguments.begin(), arguments.end(), [](const std::string &argument) { return argument == "-isysroot"; })) {
arguments.emplace_back("-isysroot");
arguments.emplace_back("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk");
}
#endif
// Do not add -fretain-comments-from-system-headers if pch is used, since the pch was most likely made without this flag // Do not add -fretain-comments-from-system-headers if pch is used, since the pch was most likely made without this flag
if(std::none_of(arguments.begin(), arguments.end(), [](const std::string &argument) { return argument == "-include-pch"; })) if(std::none_of(arguments.begin(), arguments.end(), [](const std::string &argument) { return argument == "-include-pch"; }))
arguments.emplace_back("-fretain-comments-from-system-headers"); arguments.emplace_back("-fretain-comments-from-system-headers");

Loading…
Cancel
Save