From 3d8a89bad9ccc48e7877fa1c4219a1064666b7c9 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Wed, 14 Jul 2021 09:31:33 +0430 Subject: added llvm 12 and 13 to travis. added some dockerfiles i used for building/testing against different llvm versions. --- .travis.yml | 30 ++++++++++++++++++++++++++++++ CMakeLists.txt | 8 -------- README.md | 4 ++-- compile_commands.json | 48 ------------------------------------------------ docker/11/Dockerfile | 17 +++++++++++++++++ docker/12/Dockerfile | 17 +++++++++++++++++ docker/13/Dockerfile | 17 +++++++++++++++++ 7 files changed, 83 insertions(+), 58 deletions(-) delete mode 100644 compile_commands.json create mode 100644 docker/11/Dockerfile create mode 100644 docker/12/Dockerfile create mode 100644 docker/13/Dockerfile diff --git a/.travis.yml b/.travis.yml index 6dbe14f..16d0da9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -152,3 +152,33 @@ matrix: - make CXX=clang-11 LLVM_CONF=llvm-config-11 after_success: bash run.sh + - dist: bionic + name: llvm12 + sudo: required + language: cpp + before_script: + - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y + - sudo apt-get update -y + - wget https://apt.llvm.org/llvm.sh + - chmod +x llvm.sh + - sudo ./llvm.sh 12 + - sudo apt-get install -y clang-12 llvm-12-dev libclang-common-12-dev libclang-12-dev + - git submodule init + - git submodule update + script: + - mkdir build && cd build && cmake ../ -DLLVM_CONF=llvm-config-12 -DCMAKE_CXX_COMPILER=clang++-12 -DUSE_MONOLITH_LIBTOOLING=OFF&& make -j2 + - dist: bionic + name: llvm13 + sudo: required + language: cpp + before_script: + - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y + - sudo apt-get update -y + - wget https://apt.llvm.org/llvm.sh + - chmod +x llvm.sh + - sudo ./llvm.sh 13 + - sudo apt-get install -y clang-13 llvm-13-dev libclang-common-13-dev libclang-13-dev + - git submodule init + - git submodule update + script: + - mkdir build && cd build && cmake ../ -DLLVM_CONF=llvm-config-13 -DCMAKE_CXX_COMPILER=clang++-13 -DUSE_MONOLITH_LIBTOOLING=OFF&& make -j2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 72507d7..d144b7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,6 @@ cmake_minimum_required(VERSION 3.14.5) project(cgrep VERSION 1.1) -# set(CMAKE_CXX_COMPILER clang++-10 CACHE STRING "set the actual name of clang++, i.e. clang++-10" FORCE) -# set(CMAKE_CXX_COMPILER clang++-10) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) set(LLVM_CONF llvm-config-10 CACHE STRING "set the actual name of llvm-config, i.e. llvm-config-10") @@ -15,10 +13,6 @@ execute_process(COMMAND ${LLVM_CONF} --includedir OUTPUT_VARIABLE LLVM_INC_DIR) string(REGEX REPLACE "\n$" "" LLVM_INC_DIR "${LLVM_INC_DIR}") execute_process(COMMAND ${LLVM_CONF} --cxxflags OUTPUT_VARIABLE LLVM_CXX_FLAGS) string(REGEX REPLACE "\n$" "" LLVM_CXX_FLAGS "${LLVM_CXX_FLAGS}") -# execute_process(COMMAND ${LLVM_CONF} --src-root OUTPUT_VARIABLE LLVM_SRC_ROOT) -# string(REGEX REPLACE "\n$" "" LLVM_SRC_ROOT "${LLVM_SRC_ROOT}") -# execute_process(COMMAND ${LLVM_CONF} --obj-root OUTPUT_VARIABLE LLVM_OBJ_ROOT) -# string(REGEX REPLACE "\n$" "" LLVM_OBJ_ROOT "${LLVM_OBJ_ROOT}") execute_process(COMMAND ${LLVM_CONF} --libdir OUTPUT_VARIABLE LLVM_LIB_DIR) string(REGEX REPLACE "\n" "" LLVM_LIB_DIR "${LLVM_LIB_DIR}") execute_process(COMMAND ${LLVM_CONF} --ldflags OUTPUT_VARIABLE LLVM_LD_FLAGS) @@ -32,8 +26,6 @@ string(REGEX REPLACE "^-l" "" LLVM_SYS_LIBS "${LLVM_SYS_LIBS}") add_compile_options(${LLVM_CXX_FLAGS}) add_compile_options(-I${LLVM_INC_DIR}) -# add_compile_options(-I"${LLVM_SRC_ROOT}/tools/clang/include") -# add_compile_options(-I"${LLVM_OBJ_ROOT}/tools/clang/include") set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin) set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}) diff --git a/README.md b/README.md index e683a4c..a0c02f9 100644 --- a/README.md +++ b/README.md @@ -158,14 +158,14 @@ For an up-to-date list, you can run `cgrep --help` or look at the man page. ## Known Issues `cgrep` complains that it cannot find `stddef.h` or some other similar header. If that happens to you , it's because cgrep can't find the clang built-in headers. run `llvm-config --libdir`, then head on to `clang`. Inside that directory you should see one(or maybe more) llvm/clang versions. Pick the one you used to build cgrep against. Inside that directory there will be a directory named `include`. Pass that to cgrep any way you see fit.
-Alternatively, `$(llvm-config --libdir)/clang/$(llvm-config --version)/include` should give the path cgrep needs to include. If you build your llvm/clang from upstream, this might not work. SVN bulds will have the svn string attached to the version number.
+Alternatively, `$(llvm-config --libdir)/clang/$(llvm-config --version)/include` should give the path cgrep needs to include. If you build your llvm/clang from upstream, this might not work. SVN builds will have the svn string attached to the version number.
You could,for example, use `--extra-arg=-I/usr/lib/llvm-9/lib/clang/9.0.0/include` to call cgrep or you could just alias `cgrep` to `cgrep --extra-arg=-I/usr/lib/llvm-9/lib/clang/9.0.0/include`.
`cgrep`, replaces the clang diagnosticConsumer with a simple one that only tells you there are erros during the compilation. You can get the normal clang output using the `--clangdiag` switch. The decision was made to declutter the output generated by cgrep. ## License -cgrep is licensed under GPL-3.0. Eveything else is licensed under it's own respective license. +cgrep is licensed under GPL-3.0. Everything else is licensed under it's own respective license. [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fbloodstalker%2Fcgrep.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fbloodstalker%2Fcgrep?ref=badge_large) diff --git a/compile_commands.json b/compile_commands.json deleted file mode 100644 index 8a07e94..0000000 --- a/compile_commands.json +++ /dev/null @@ -1,48 +0,0 @@ -[ - { - "arguments": [ - "clang++", - "-c", - "-fpic", - "-I/usr/lib/llvm-10/include", - "-std=c++14", - "-fno-exceptions", - "-D_GNU_SOURCE", - "-D__STDC_CONSTANT_MACROS", - "-D__STDC_FORMAT_MACROS", - "-D__STDC_LIMIT_MACROS", - "-I/usr/lib/llvm-10/build//tools/clang/include", - "-I/usr/lib/llvm-10/build//tools/clang/include", - "-std=c++17", - "-fexceptions", - "-o", - "cfe-extra/cfe_extra.o", - "cfe-extra/cfe_extra.cpp" - ], - "directory": "/home/devi/devi/cgrep.git/master", - "file": "cfe-extra/cfe_extra.cpp" - }, - { - "arguments": [ - "clang++", - "-c", - "-fpic", - "-I/usr/lib/llvm-10/include", - "-std=c++14", - "-fno-exceptions", - "-D_GNU_SOURCE", - "-D__STDC_CONSTANT_MACROS", - "-D__STDC_FORMAT_MACROS", - "-D__STDC_LIMIT_MACROS", - "-I/usr/lib/llvm-10/build//tools/clang/include", - "-I/usr/lib/llvm-10/build//tools/clang/include", - "-std=c++17", - "-fexceptions", - "-o", - "cgrep.o", - "cgrep.cpp" - ], - "directory": "/home/devi/devi/cgrep.git/master", - "file": "cgrep.cpp" - } -] \ No newline at end of file diff --git a/docker/11/Dockerfile b/docker/11/Dockerfile new file mode 100644 index 0000000..edef053 --- /dev/null +++ b/docker/11/Dockerfile @@ -0,0 +1,17 @@ +FROM debian:bullseye-slim + +RUN apt update && apt upgrade -y +RUN apt install -y wget cmake git lsb-release software-properties-common gnupg2 +RUN wget apt.llvm.org/llvm.sh && chmod +x ./llvm.sh && ./llvm.sh 11 +RUN apt install -y llvm-11-dev libclang-common-11-dev libclang-11-dev clang-11 + +RUN git clone https://github.com/bloodstalker/cgrep \ + && cd cgrep \ + && git submodule init \ + && git submodule update \ + && mkdir build \ + && cd build \ + && cmake ../ -DLLVM_CONF=llvm-config-11 -DCMAKE_CXX_COMPILER=clang++-11 -DUSE_MONOLITH_LIBTOOLING=OFF\ + && make + +RUN rm -rf /var/apt/cache diff --git a/docker/12/Dockerfile b/docker/12/Dockerfile new file mode 100644 index 0000000..bba51c0 --- /dev/null +++ b/docker/12/Dockerfile @@ -0,0 +1,17 @@ +FROM debian:bullseye-slim + +RUN apt update && apt upgrade -y +RUN apt install -y wget cmake git lsb-release software-properties-common gnupg2 +RUN wget apt.llvm.org/llvm.sh && chmod +x ./llvm.sh && ./llvm.sh 12 +RUN apt install -y llvm-12-dev libclang-common-12-dev libclang-12-dev clang-12 + +RUN git clone https://github.com/bloodstalker/cgrep \ + && cd cgrep \ + && git submodule init \ + && git submodule update \ + && mkdir build \ + && cd build \ + && cmake ../ -DLLVM_CONF=llvm-config-12 -DCMAKE_CXX_COMPILER=clang++-12 -DUSE_MONOLITH_LIBTOOLING=OFF\ + && make + +RUN rm -rf /var/apt/cache diff --git a/docker/13/Dockerfile b/docker/13/Dockerfile new file mode 100644 index 0000000..0906e2f --- /dev/null +++ b/docker/13/Dockerfile @@ -0,0 +1,17 @@ +FROM debian:bullseye-slim + +RUN apt update && apt upgrade -y +RUN apt install -y wget cmake git lsb-release software-properties-common gnupg2 +RUN wget apt.llvm.org/llvm.sh && chmod +x ./llvm.sh && ./llvm.sh 13 +RUN apt install -y llvm-13-dev libclang-common-13-dev libclang-13-dev clang-13 + +RUN git clone https://github.com/bloodstalker/cgrep \ + && cd cgrep \ + && git submodule init \ + && git submodule update \ + && mkdir build \ + && cd build \ + && cmake ../ -DLLVM_CONF=llvm-config-13 -DCMAKE_CXX_COMPILER=clang++-13 -DUSE_MONOLITH_LIBTOOLING=OFF\ + && make + +RUN rm -rf /var/apt/cache -- cgit v1.2.3