Created
December 28, 2020 03:38
-
-
Save penglei/f58f9908ec68e78421fac088a052d81d to your computer and use it in GitHub Desktop.
CLion config istio-proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. 下载 envoy 源码,解压放在 staging目录下,建软链接; | |
2. 执行 build.sh,编译生成缺失的依赖; | |
3. 执行 generate-srcs.sh 生成大部分源码文件列表; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}")" && pwd )" | |
ROOTDIR=$(dirname "${SCRIPTPATH}") | |
if [ -f /etc/os-release ]; then | |
os_name=$(source /etc/os-release && echo -n "$NAME") | |
fi | |
if [ "${os_name}" = "Ubuntu" ]; then | |
export CC=clang-8 | |
export CXX=clang++-8 | |
else | |
export CC=clang | |
export CXX=clang++ | |
fi | |
export BAZEL_COMPILER=clang | |
#export CFLAGS="-Wno-error" | |
#export CXXFLAGS="-Wno-error" | |
wasm_define="--define wasm=v8" | |
wasm_define= | |
bazel_opts="--verbose_failures --sandbox_debug" | |
bazel_opts= | |
mode="-c dbg" #Linking time is too long... | |
mode="-c opt --config=sizeopt" | |
envoy_sha=7043f39a2f5f7d072c35b3fe4d50865b5c61a9dc | |
local_envoy="--override_repository=envoy=${SCRIPTPATH}/staging/envoy-${envoy_sha}" | |
bazel build ${local_envoy} ${bazel_opts} ${mode} ${wasm_define} //src/envoy:envoy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.15) | |
project(istio-proxy) | |
macro(print_all_variables) | |
message(STATUS "print_all_variables------------------------------------------{") | |
get_cmake_property(_variableNames VARIABLES) | |
foreach (_variableName ${_variableNames}) | |
message(STATUS "${_variableName}=${${_variableName}}") | |
endforeach() | |
message(STATUS "print_all_variables------------------------------------------}") | |
endmacro() | |
set(CMAKE_CXX_STANDARD 17) | |
add_definitions(-DNULL_PLUGIN) # enable wasm nullvm navigation | |
file(STRINGS ccfiles.txt all_SRCS) | |
execute_process(COMMAND readlink ${CMAKE_SOURCE_DIR}/staging/envoy OUTPUT_VARIABLE envoy_dir) | |
string(STRIP "${envoy_dir}" envoy_dir) | |
#print_all_variables() | |
#https://stackoverflow.com/questions/32028667/are-cmake-source-dir-and-project-source-dir-the-same-in-cmake | |
message(STATUS "envoy_dir=${envoy_dir}") | |
message(STATUS "CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}") | |
message(STATUS "CMAKE_HOME_DIRECTORY=${CMAKE_HOME_DIRECTORY}") | |
add_executable(istio-proxy ${all_SRCS}) | |
set(istio_include_dirs | |
./ | |
./include | |
./src | |
./extensions | |
"./staging/${envoy_dir}" | |
"./staging/${envoy_dir}/source" | |
"./staging/${envoy_dir}/include" | |
"./staging/${envoy_dir}/api/wasm/cpp" | |
./bazel-istio-proxy.git/external/boringssl/src/include/ | |
./bazel-istio-proxy.git/external/com_github_gabime_spdlog/include | |
./bazel-istio-proxy.git/external/com_github_c_ares_c_ares | |
./bazel-istio-proxy.git/external/com_google_absl | |
./bazel-istio-proxy.git/external/com_google_cel_cpp | |
./bazel-istio-proxy.git/external/com_google_protobuf/src | |
./bazel-istio-proxy.git/external/com_github_fmtlib_fmt/include | |
./bazel-istio-proxy.git/external/com_github_eile_tclap/include | |
./bazel-istio-proxy.git/external/com_github_grpc_grpc/include | |
./bazel-istio-proxy.git/external/com_envoyproxy_protoc_gen_validate/ | |
./bazel-istio-proxy.git/external/com_github_tencent_rapidjson/include/ | |
./bazel-istio-proxy.git/external/com_github_datadog_dd_opentracing_cpp/include/ | |
./bazel-istio-proxy.git/external/com_github_libevent_libevent/include | |
./bazel-istio-proxy.git/external/com_github_mirror_tclap/include | |
./bazel-istio-proxy.git/external/com_github_grpc_grpc | |
./bazel-istio-proxy.git/external/com_github_circonus_labs_libcircllhist/src/ | |
./bazel-istio-proxy.git/external/com_github_nodejs_http_parser | |
./bazel-istio-proxy.git/external/com_github_nghttp2_nghttp2/lib/includes/ | |
./bazel-istio-proxy.git/external/com_github_cyan4973_xxhash/ | |
./bazel-istio-proxy.git/external/com_github_google_flatbuffers/include/ | |
#./bazel-istio-proxy.git/external/com_googlesource_chromium_v8/wee8/include/ | |
#./bazel-istio-proxy.git/external/com_googlesource_chromium_v8/wee8/third_party/ | |
#./bazel-istio-proxy.git/external/com_googlesource_chromium_v8/wee8/third_party/zlib/ | |
./bazel-istio-proxy.git/external/com_github_fmtlib_fmt/test | |
./bazel-bin | |
./bazel-bin/external/envoy_api | |
./bazel-bin/external/mixerapi_git | |
#./bazel-bin/external/envoy/bazel/foreign_cc/ares/include | |
./bazel-bin/external/com_envoyproxy_protoc_gen_validate | |
./bazel-bin/external/com_google_googleapis | |
./bazel-bin/external/com_github_cncf_udpa | |
) | |
target_include_directories(istio-proxy PUBLIC ${istio_include_dirs}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
envoy_dir=`readlink staging/envoy` | |
bazel_dir="bazel-istio-proxy.git" | |
echo -n '' > ccfiles.txt | |
find -L $bazel_dir/external -name '*.cc'|grep -v 'test'| grep -v 'external/envoy' >> ccfiles.txt | |
find -L $bazel_dir/external/com_github_nodejs_http_parser -name '*.c'|grep -v 'test' >> ccfiles.txt | |
find -L "staging/$envoy_dir" -name '*.cc' | grep -v 'test' >> ccfiles.txt | |
find -L src -name '*.cc'|grep -v 'test' >> ccfiles.txt | |
find -L extensions -name '*.cc'|grep -v 'test' >> ccfiles.txt | |
#includes | |
#find -L . -wholename '*/zlib.h' | |
#find -L . -wholename '*/google/api/expr/v1alpha1/syntax.pb.h' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment