citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit 2460ada93bf5c9a53883735b85bf138b17a2701e
parent 1a4df09e63610e40d281560ed621eff14f8e95af
Author: Kyle Milz <kyle@0x30.net>
Date:   Wed, 27 Jul 2016 20:11:06 -0600

src: push clang include paths into source file

Diffstat:
MJamrules | 6++----
Msrc/Jamfile | 2+-
Msrc/inst_main.cc | 9++++++---
3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/Jamrules b/Jamrules @@ -16,7 +16,6 @@ OPTIM = $(CFLAGS) ; if $(OS) = OPENBSD { C++ = eg++ ; - CLANG_INCL = "-I/usr/local/lib/clang/3.8.0/include" ; LLVM_VER = 38 ; PKG_CONFIG_LIBS = gl glew freetype2 ; @@ -25,8 +24,7 @@ if $(OS) = OPENBSD { } if $(OS) = MACOSX { - C++FLAGS += -DCLANG_INCL="-I/opt/local/libexec/llvm-3.7/lib/clang/3.7/include" ; - C++FLAGS += -Wno-deprecated -DLLVM_VER=37 ; + LLVM_VER = 37 ; PKG_CONFIG_LIBS = glew freetype2 ; LINKLIBS on citrun-gl = -framework OpenGL -framework GLUT -lc++ -lm ; @@ -34,7 +32,7 @@ if $(OS) = MACOSX { } if $(OS) = LINUX { - C++FLAGS += -DLLVM_VER=35 ; + LLVM_VER = 35 ; PKG_CONFIG_LIBS = gl glew freetype2 ; LINKLIBS on citrun-gl = -lbsd -lstdc++ -lm -lglut ; diff --git a/src/Jamfile b/src/Jamfile @@ -60,7 +60,7 @@ Stringize runtime_h.h : $(TOP)/lib/runtime.h ; ObjectC++Flags $(INST_SRCS) : `llvm-config --cxxflags` ; ObjectC++Flags $(INST_SRCS) : -DCITRUN_LIB=$(CITRUN_LIB) -DCITRUN_PATH=$(CITRUN_PATH) ; -ObjectC++Flags $(INST_SRCS) : -DCLANG_INCL=$(CLANG_INCL) -DLLVM_VER=$(LLVM_VER) ; +ObjectC++Flags $(INST_SRCS) : -DLLVM_VER=$(LLVM_VER) ; LINKFLAGS on citrun-inst = `llvm-config --ldflags` ; diff --git a/src/inst_main.cc b/src/inst_main.cc @@ -88,9 +88,12 @@ instrument(int argc, char *argv[], std::vector<std::string> const &source_files) // Append original command line verbatim clang_argv.insert(clang_argv.end(), argv, argv + argc); - // When instrumenting certain code clang sometimes needs its own include - // files. These are defined globally per platform. - clang_argv.push_back(STR(CLANG_INCL)); + // We should be able to get this programmatically, but I don't know how. +#if defined(__OpenBSD__) + clang_argv.push_back("-I/usr/local/lib/clang/3.8.0/include"); +#elif defined(__APPLE__) + clang_argv.push_back("-I/opt/local/libexec/llvm-3.7/lib/clang/3.7/include"); +#endif // give clang it's <source files> -- <native command line> arg style int clang_argc = clang_argv.size();