Commit 7199f96b authored by Sergio Martins's avatar Sergio Martins

Merge branch '1.7'

parents 111c6971 882da655
......@@ -119,11 +119,13 @@ Be sure to point CLANG_LIBRARY_IMPORT to clang.lib. It's probably inside your LL
## macOS with MacPorts
Note: clazy-standalone isn't parsing arguments correctly on LLVM > 8.0. Feel free to use LLVM 10 if you don't need clazy-standalone.
### Install clang
```
$ sudo port install clang-3.9 llvm-3.9
$ sudo ln -sf /opt/local/bin/llvm-config-mp-3.9 /opt/local/bin/llvm-config
$ sudo port select --set clang mp-clang-3.9
$ sudo port install llvm-8.0 clang-8.0 cmake ninja coreutils
$ sudo ln -sf /opt/local/bin/llvm-config-mp-8.0 /opt/local/bin/llvm-config
$ sudo port select --set clang mp-clang-8.0
```
### Build clazy
......@@ -353,11 +355,12 @@ finding builtin headers, like stddef.h. Alternatively, you can symlink to the fo
(Assuming clazy was built with `-DCMAKE_INSTALL_PREFIX=/myprefix/`)
```
$ touch foo.c && clang++ '-###' -c foo.c 2>&1 | tr ' ' '\n' | grep -A1 resource
$ touch foo.c && clang++ '-###' -c foo.c 2>&1 | tr ' ' '\n' | grep -A1 resource # Make sure this clang here is not Apple clang. Use for example clang++-mp-8.0 if on macOS and haven't run `port select` yet.
"-resource-dir"
"/usr/bin/../lib/clang/4.0.1" # this is the interesting path (without the version)
$ ln -sf /usr/bin/../lib/clang/ /myprefix/lib/clang
$ ln -sf /usr/bin/../include/c++/ /myprefix/include/c++ # Required on macOS
"/opt/local/libexec/llvm-8.0/lib/clang/8.0.1" # The interesting part is /opt/local/libexec/llvm-8.0
$ ln -sf /opt/local/libexec/llvm-8.0/lib/clang/ /myprefix/lib/clang
$ mkdir /myprefix/include/
$ ln -sf /opt/local/libexec/llvm-8.0/include/c++/ /myprefix/include/c++ # Required on macOS
```
If that doesn't work, run `clang -v` and check what's the InstalledDir. Move clazy-standalone to that folder.
......@@ -409,6 +412,9 @@ with each other modifying the same source lines.
- macOS: Be sure you're not using Apple Clang
- macOS: System Integrity Protection blocks the use of DYLD_LIBRARY_PATH. With SIP enabled you need to pass the full path
to ClazyPlugin.dylib, otherwise you'll get `image not found` error.
- Windows: fatal error LNK1112: module machine type ‘X86’ conflicts with target machine type ‘x64’
If you're building in 32-bit, open clazy-cl.bat and insert a -m32 argument.
Should read: %~dp0\clang\clang.exe –driver-mode=cl -m32 (...)
......
......@@ -3,17 +3,34 @@ MAINTAINER Sergio Martins (sergio.martins@kdab.com)
WORKDIR /
RUN yum update -y
RUN yum install -y git wget
RUN yum install -y git wget zip texinfo bison flex svn boost-regex boost-devel
RUN wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
RUN yum install -y devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++
ENV PATH=/opt/rh/devtoolset-2/root/usr/bin/:$PATH
# Build GCC
WORKDIR /
RUN svn co svn://gcc.gnu.org/svn/gcc/tags/gcc_5_4_0_release/
WORKDIR /gcc_5_4_0_release/
RUN ./contrib/download_prerequisites
RUN mkdir /gcc_5_4_0_release_build/
WORKDIR /gcc_5_4_0_release_build/
RUN ../gcc_5_4_0_release/configure --disable-multilib
RUN make -j12
RUN make install
RUN echo "/usr/local/lib64" > /etc/ld.so.conf.d/newStdLib.conf
RUN ldconfig
ENV CXX=/usr/local/bin/g++
ENV CC=/usr/local/bin/gcc
# Copy appdir template
ADD clazy.AppDir /clazy.AppDir/
# Build Python
WORKDIR /
RUN wget https://www.python.org/ftp/python/2.7.16/Python-2.7.16.tgz
RUN tar xzf Python-2.7.16.tgz
WORKDIR /Python-2.7.16
......@@ -32,7 +49,7 @@ RUN make install
#Build LLVM
WORKDIR /
RUN wget -O - https://github.com/llvm/llvm-project/tarball/llvmorg-9.0.0 | tar xz
RUN wget -O - https://github.com/llvm/llvm-project/tarball/llvmorg-10.0.0 | tar xz
RUN mv llvm-llvm-project-* llvm-project
WORKDIR /llvm-project/
RUN echo "LLVM sha1: `git rev-parse HEAD`" > /clazy.AppDir/sha1
......
......@@ -5,9 +5,6 @@
# $1 clazy sha1 to build
# $2 user uid to chown the files to before leaving docker
CC=gcc
CXX=g++
mkdir /tmp/clazy_work/
cp -r /clazy.AppDir/ /tmp/clazy_work/
......
{
"tests" : [
{
"filename" : "main.cpp"
"filename" : "main.cpp",
"should_run_on_32bit" : false
}
]
}
......@@ -14,6 +14,9 @@ _verbose = False
def isWindows():
return _platform == 'win32'
def isMacOS():
return _platform == 'darwin'
class QtInstallation:
def __init__(self):
self.int_version = 000
......@@ -21,7 +24,12 @@ class QtInstallation:
self.qmake_lib_path = "/usr/lib"
def compiler_flags(self):
return "-isystem " + self.qmake_header_path + ("" if isWindows() else " -fPIC") + " -L " + self.qmake_lib_path
extra_includes = ''
if isMacOS():
extra_includes = ' -iframework ' + self.qmake_header_path + '/../lib/ '
return "-isystem " + self.qmake_header_path + ("" if isWindows() else " -fPIC") + " -L " + self.qmake_lib_path + extra_includes
class Test:
def __init__(self, check):
......@@ -46,6 +54,7 @@ class Test:
self.ignore_dirs = ""
self.has_fixits = False
self.should_run_fixits_test = False
self.should_run_on_32bit = True
def filename(self):
if len(self.filenames) == 1:
......@@ -239,6 +248,8 @@ def load_json(check_name):
test.header_filter = t['header_filter']
if 'ignore_dirs' in t:
test.ignore_dirs = t['ignore_dirs']
if 'should_run_on_32bit' in t:
test.should_run_on_32bit = t['should_run_on_32bit']
if not test.checks:
test.checks.append(test.check.name)
......@@ -558,6 +569,9 @@ def file_contains(filename, text):
f.close()
return text in contents
def is32Bit():
return platform.architecture()[0] == '32bit'
def run_unit_test(test, is_standalone):
if test.check.clazy_standalone_only and not is_standalone:
return True
......@@ -579,6 +593,11 @@ def run_unit_test(test, is_standalone):
print("Skipping " + test.check.name + " because it is blacklisted for this platform")
return True
if not test.should_run_on_32bit and is32Bit():
if (_verbose):
print("Skipping " + test.check.name + " because it is blacklisted on 32bit")
return True;
checkname = test.check.name
filename = checkname + "/" + test.filename()
......@@ -587,7 +606,7 @@ def run_unit_test(test, is_standalone):
expected_file = filename + ".expected"
# Some tests have different output on 32 bit
if platform.architecture()[0] == '32bit' and os.path.exists(expected_file + '.x86'):
if is32Bit() and os.path.exists(expected_file + '.x86'):
expected_file = expected_file + '.x86'
if is_standalone and test.isScript():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment