From 885f17c538a43a90b1a554ea90c348310e766083 Mon Sep 17 00:00:00 2001 From: Chris Cummins Date: Sat, 25 Mar 2017 13:42:38 +0000 Subject: [PATCH] native: Add oclgrind dep Issue #88. --- .gitignore | 3 ++- Makefile | 1 + make/oclgrind.make | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 make/oclgrind.make diff --git a/.gitignore b/.gitignore index ce233b768..914e9b974 100644 --- a/.gitignore +++ b/.gitignore @@ -20,10 +20,11 @@ # native stuff /native/cmake +/native/gpuverify /native/libclc /native/llvm -/native/gpuverify /native/ninja +/native/oclgrind # build cache /.cache diff --git a/Makefile b/Makefile index d28842e3e..955061fb6 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ include make/gpuverify.make include make/ninja.make include make/llvm.make include make/libclc.make +include make/oclgrind.make data_symlinks = \ $(root)/clgen/data/bin/clang \ diff --git a/make/oclgrind.make b/make/oclgrind.make new file mode 100644 index 000000000..7da6c2a6f --- /dev/null +++ b/make/oclgrind.make @@ -0,0 +1,53 @@ +# Makefile module to pull OCLgrind dependency +# +# Usage: +# +# * Add '$(oclgrind)' to list of prerequisites. +# * Requires $(llvm), $(ninja), and $(cmake). +# +# Copyright 2017 Chris Cummins . +# +# This file is part of CLgen. +# +# CLgen is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# CLgen is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with CLgen. If not, see . +# +oclgrind_version := c3760d07365b74ccda04cd361e1b567a6d99dd8c +oclgrind_remote := git@github.com:jrprice/Oclgrind.git +oclgrind_dir := $(root)/native/oclgrind/$(oclgrind_version) +oclgrind := $(oclgrind_dir)/install/bin/oclgrind + +oclgrind: $(oclgrind) + +oclgrind_cmake = $(cmake) .. -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_INSTALL_PREFIX=../install \ + -DLLVM_DIR=$(llvm_build)/lib/cmake/llvm \ + -DCLANG_ROOT=$(llvm_src)/tools/clang \ + -DCMAKE_CXX_FLAGS="-I$(llvm_build)/tools/clang/include" \ + -DCMAKE_MAKE_PROGRAM=$(ninja) -G Ninja + +$(oclgrind): + mkdir -p $(root)/native/oclgrind + cd $(root)/native/oclgrind && git clone $(oclgrind_remote) $(oclgrind_version) + cd $(oclgrind_dir) && git reset --hard $(oclgrind_version) + rm -rf $(oclgrind_dir)/.git + mkdir $(oclgrind_dir)/build $(oclgrind_dir)/install + cd $(oclgrind_dir)/build && $(oclgrind_cmake) + cd $(oclgrind_dir)/build && $(ninja) + cd $(oclgrind_dir)/build && $(ninja) test + cd $(oclgrind_dir)/build && $(ninja) install + +.PHONY: distclean-oclgrind +distclean-oclgrind: + rm -rf $(root)/native/oclgrind +distclean_targets += distclean-oclgrind