Skip to content

Commit

Permalink
Support for custom build toolchains (apache#330)
Browse files Browse the repository at this point in the history
* Support for custom build toolchains

ISSUE apache#297

Locate the header file path of DORIS_GCC_HOME, add them to the CPLUS_INCLUDE_PATH environment variable.
So clang can find it.

* Compatible with custom toolchain for clang

ISSUE apache#297

1. Find default header file paths of DORIS_GCC_HOME and set as enviroment variable CLANG_COMPATIBLE_FLAGS.
2. Explicitly add these paths to CLANG_INCLUDE_FLAGS.
  • Loading branch information
chalsliu authored and imay committed Nov 21, 2018
1 parent b57dfd4 commit fbde6a8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions be/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,12 @@ message(STATUS "${LINUX_VERSION_LOWER}")
# message(FATAL_ERROR "Currently not support system ${LINUX_VERSION}")
# endif()

if(DEFINED ENV{CLANG_COMPATIBLE_FLAGS})
set(CLANG_COMPATIBLE_FLAGS $ENV{CLANG_COMPATIBLE_FLAGS})
endif()

message(STATUS "CLANG_BASE_FLAGS: ${CLANG_BASE_FLAGS}")
message(STATUS "CLANG_COMPATIBLE_FLAGS: ${CLANG_COMPATIBLE_FLAGS}")

set(CLANG_INCLUDE_FLAGS
"-I${LLVM_HOME}/include"
Expand All @@ -419,6 +424,7 @@ set(CLANG_INCLUDE_FLAGS
"-I${THIRDPARTY_DIR}/include/event/"
"-I${GPERFTOOLS_HOME}/include"
${CLANG_BASE_FLAGS}
${CLANG_COMPATIBLE_FLAGS}
)

# Set include dirs
Expand Down
5 changes: 5 additions & 0 deletions env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,8 @@ if [[ ! "$(printf '%s\n' "$required_ver" "$gcc_ver" | sort -V | head -n1)" = "$r
exit 1
fi

# export CLANG COMPATIBLE FLAGS
export CLANG_COMPATIBLE_FLAGS=`echo | ${DORIS_GCC_HOME}/bin/gcc -Wp,-v -xc++ - -fsyntax-only 2>&1 \
| grep -E '^\s+/' | awk '{print "-I" $1}' | tr '\n' ' '`


0 comments on commit fbde6a8

Please sign in to comment.