Skip to content

Commit

Permalink
Try to support building and running on Travis
Browse files Browse the repository at this point in the history
This was previously working for my local LLVM build.  Now I want it to
work on Travis, so I have prepared a release of clang-tidy that's
suitable to run there, and set it up to work with either version.
  • Loading branch information
jbytheway committed Jun 19, 2019
1 parent 53d0233 commit 3b73b6f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ SET(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/CMakeModules
)

SET(CMAKE_TLS_VERIFY ON)

# Build options
option(TILES "Build graphical tileset version." "OFF")
option(CURSES "Build curses version." "ON" )
Expand Down
43 changes: 40 additions & 3 deletions tools/clang-tidy-plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,49 @@
include(ExternalProject)

find_package(LLVM REQUIRED CONFIG)
find_package(Clang REQUIRED CONFIG)

add_library(
CataAnalyzerPlugin MODULE
CataTidyModule.cpp NoLongCheck.cpp)
MESSAGE("Building clang-tidy plugin with include paths: ${LLVM_INCLUDE_DIRS}")
if ("${LLVM_INCLUDE_DIRS}" STREQUAL "")

target_include_directories(
CataAnalyzerPlugin SYSTEM PRIVATE
${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS})

if ("${CATA_CLANG_TIDY_INCLUDE_DIR}" STREQUAL "")
SET(ctps_releases
https://github.com/jbytheway/clang-tidy-plugin-support/releases/download)
SET(ctps_version llvm-8.0.1-r12)
SET(ctps_src
${CMAKE_CURRENT_BINARY_DIR}/clang-tidy-plugin-support)

ExternalProject_Add(
clang-tidy-plugin-support
URL ${ctps_releases}/${ctps_version}/clang-tidy-plugin-support-${ctps_version}.tar.xz
URL_HASH SHA256=00ffab0df11250f394830735514c62ae787bd2eb6eb9d5e97471206d270c54e2
SOURCE_DIR ${ctps_src}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)

add_dependencies(CataAnalyzerPlugin clang-tidy-plugin-support)
target_include_directories(
CataAnalyzerPlugin SYSTEM PRIVATE ${ctps_src}/include)
else()
target_include_directories(
CataAnalyzerPlugin SYSTEM PRIVATE ${LLVM_INCLUDE_DIRS})
CataAnalyzerPlugin SYSTEM PRIVATE ${CATA_CLANG_TIDY_INCLUDE_DIR})
endif()

target_compile_definitions(
CataAnalyzerPlugin PRIVATE ${LLVM_DEFINITIONS})

# We need to turn off exceptions and RTTI to match the LLVM build.
# I feel there ought to be a way to extract these flags from the
# LLVMConfig.cmake as we have done for e.g. LLVM_INCLUDE_DIRS above, but I
# haven't found one.
if(MSVC)
else()
target_compile_options(
Expand Down

0 comments on commit 3b73b6f

Please sign in to comment.