Skip to content

Commit

Permalink
remove clang-tidy in 3rd
Browse files Browse the repository at this point in the history
Signed-off-by: Zone.N <[email protected]>
  • Loading branch information
MRNIU committed Dec 5, 2024
1 parent ebeb738 commit dbbe710
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
26 changes: 23 additions & 3 deletions cmake/compile_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,28 @@ target_compile_definitions(compile_definitions INTERFACE
$<$<CONFIG:Debug>:SIMPLEKERNEL_DEBUG>
)

# 获取 gcc 的 include 路径
execute_process(
COMMAND
sh -c "echo | ${CMAKE_CXX_COMPILER} -v -x c -E - 2>&1 | sed -n '/#include <...> search starts here:/,/End of search list./{/^ /p}'"
OUTPUT_VARIABLE GCC_OUTPUT
ERROR_VARIABLE GCC_ERROR
RESULT_VARIABLE GCC_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# 检查 gcc 是否成功执行
if(NOT GCC_RESULT EQUAL 0)
message(FATAL_ERROR "Failed to run ${CMAKE_CXX_COMPILER} -v")
endif()
# 分割路径并生成路径列表
string(REPLACE "\n" ";" INCLUDE_PATH_LIST "${GCC_OUTPUT}")
# 使用 `-I` 将路径添加到编译选项中
foreach(INCLUDE_PATH ${INCLUDE_PATH_LIST})
string(REGEX REPLACE " " "" CLEAN_PATH ${INCLUDE_PATH})
list(APPEND CROSS_INCLUDE_PATHS "-I${CLEAN_PATH}")
endforeach()
message(STATUS "GCC Include CROSS_INCLUDE_PATHS: ${CROSS_INCLUDE_PATHS}")

# 通用编译选项
add_library(compile_options INTERFACE)
target_compile_options(compile_options INTERFACE
Expand Down Expand Up @@ -66,9 +88,7 @@ target_compile_options(compile_options INTERFACE
$<$<PLATFORM_ID:Darwin>:
>

-I/usr/lib/gcc-cross/riscv64-linux-gnu/13/include
-I/usr/lib/gcc-cross/riscv64-linux-gnu/13/../../../../riscv64-linux-gnu/include
-I/usr/include
${CROSS_INCLUDE_PATHS}
)

# 通用链接选项
Expand Down
7 changes: 0 additions & 7 deletions cmake/project_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
# project_config.cmake for Simple-XX/SimpleKernel.
# 配置信息

# 设置 cmake 目标环境根目录
# @todo 设置目录
list(APPEND CMAKE_FIND_ROOT_PATH
/usr/x86_64-linux-gnu
/usr/riscv64-linux-gnu
/usr/aarch64-linux-gnu
)
# 在目标环境搜索 program
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# 在目标环境搜索库文件
Expand Down

0 comments on commit dbbe710

Please sign in to comment.