diff --git a/CMakeLists.txt b/CMakeLists.txt index f46988bc..ee7b92b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,8 +85,15 @@ else() string(APPEND StdCpp "11") endif() -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${StdCpp} -DHIPIFY_CLANG_RES=\\\"${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}\\\"") +# Address Sanitize Flag +if (ADDRESS_SANITIZER) + set(addr_var -fsanitize=address) +else() + set(addr_var ) +endif() + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${addr_var}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${StdCpp} -DHIPIFY_CLANG_RES=\\\"${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}\\\" ${addr_var}") set(INSTALL_PATH_DOC_STRING "hipify-clang Installation Path") set(HIPIFY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}) diff --git a/README.md b/README.md index 3658a66f..b32cd058 100644 --- a/README.md +++ b/README.md @@ -262,7 +262,7 @@ Run `Visual Studio 16 2019`, open the generated `LLVM.sln`, build all, build pro -DCMAKE_INSTALL_PREFIX=../dist \ -DLLVM_SOURCE_DIR=../llvm-project \ -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" \ - -DLLVM_ENABLE_PROJECTS="clang" \ + -DLLVM_ENABLE_PROJECTS="clang;compiler-rt" \ -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \ -DCMAKE_BUILD_TYPE=Release \ ../llvm-project/llvm @@ -276,7 +276,7 @@ Run `Visual Studio 16 2019`, open the generated `LLVM.sln`, build all, build pro -DCMAKE_INSTALL_PREFIX=../dist \ -DLLVM_SOURCE_DIR=../llvm-project \ -DLLVM_TARGETS_TO_BUILD="NVPTX" \ - -DLLVM_ENABLE_PROJECTS="clang" \ + -DLLVM_ENABLE_PROJECTS="clang;compiler-rt" \ -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \ -DCMAKE_BUILD_TYPE=Release \ -Thost=x64 \