Skip to content

Commit

Permalink
[clang] Revise cmake options
Browse files Browse the repository at this point in the history
Summary: This diff revises the cmake options of the clang for working better with the latest versions.

Reviewed By: jvillard

Differential Revision: D49949227

fbshipit-source-id: 0caaf3fdcf66eefcc6341740e54661179e3ce55e
  • Loading branch information
skcho authored and facebook-github-bot committed Oct 5, 2023
1 parent 334841b commit f8cd27a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
5 changes: 2 additions & 3 deletions facebook-clang-plugins/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ IOSFLAGS=-isysroot $(SDKPATH) -mios-simulator-version-min=8.2 -target x86_64-app
-Wno-objc-property-implementation
endif

# we assume that the targeted clang was configured with --enable-libcpp --enable-cxx17
CFLAGS_Darwin+=-stdlib=libc++ -std=c++17
LDFLAGS_Darwin+=-stdlib=libc++
CFLAGS_Darwin+=-std=c++17
LDFLAGS_Darwin+=

CFLAGS_Linux+=-std=c++17 -fPIC
LDFLAGS_Linux+=
Expand Down
18 changes: 10 additions & 8 deletions facebook-clang-plugins/clang/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,20 +166,19 @@ CMAKE_ARGS=(
-DCMAKE_C_FLAGS="$CFLAGS $CMAKE_C_FLAGS"
-DCMAKE_CXX_FLAGS="$CXXFLAGS $CPPFLAGS $CMAKE_CXX_FLAGS"
-DCMAKE_INSTALL_PREFIX="$CLANG_PREFIX"
-DLLVM_BUILD_EXTERNAL_COMPILER_RT=On
-DLLVM_BUILD_TOOLS=Off
-DLLVM_ENABLE_ASSERTIONS=Off
-DLLVM_ENABLE_EH=On
-DLLVM_ENABLE_RTTI=On
-DLLVM_INCLUDE_DOCS=Off
-DLLVM_BUILD_DOCS=Off
-DLLVM_INCLUDE_BENCHMARKS=Off
-DLLVM_INCLUDE_EXAMPLES=Off
-DLLVM_INCLUDE_TESTS=Off
-DLLVM_TARGETS_TO_BUILD="X86;AArch64;ARM;Mips"
)

if [ "$PLATFORM" = "Darwin" ]; then
CMAKE_ARGS+=(
-DLLVM_ENABLE_LIBCXX=On
-DCMAKE_SHARED_LINKER_FLAGS="$LDFLAGS $CMAKE_SHARED_LINKER_FLAGS"
-DLLVM_BUILD_LLVM_DYLIB=ON
)
Expand All @@ -191,19 +190,22 @@ fi

if [[ "$PLATFORM" = "Linux" ]] && [[ -n "${PLATFORM_ENV}" ]] ; then
# Please note that this case only applies to infer/master platform builds
# Prevent CMAKE from adding -isystem /usr/include for platform builds
CMAKE_ARGS+=(
-DLLVM_ENABLE_PROJECTS="clang;compiler-rt"
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"
-DLLVM_ENABLE_PROJECTS="clang"
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi"
-DZLIB_INCLUDE_DIR="$ZLIB/include"
# We disable some tools to avoid adding -isystem /usr/include in platform builds. It is good
# enough for now, but if we want to use them, we should give proper include directories as
# we did for zlib above.
-DLLVM_ENABLE_LIBXML2=Off
-DLLVM_ENABLE_TERMINFO=Off
-DLLVM_ENABLE_Z3_SOLVER=Off
-DLLVM_ENABLE_ZSTD=Off
)
else
CMAKE_ARGS+=(-DLLVM_ENABLE_PROJECTS="clang;compiler-rt;openmp"
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"
CMAKE_ARGS+=(
-DLLVM_ENABLE_PROJECTS="clang"
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;openmp"
)
fi

Expand Down

0 comments on commit f8cd27a

Please sign in to comment.