diff --git a/hipamd/hipify-clang/CMakeLists.txt b/hipamd/hipify-clang/CMakeLists.txt index 2ec96e51a8..ce839ae0a5 100644 --- a/hipamd/hipify-clang/CMakeLists.txt +++ b/hipamd/hipify-clang/CMakeLists.txt @@ -1,6 +1,15 @@ cmake_minimum_required(VERSION 2.8.8) project(hipify-clang) +set(BUILD_HIPIFY_CLANG 0 CACHE INTERNAL "") + +if (HIPIFY_CLANG_LLVM_DIR) + find_package(LLVM PATHS ${HIPIFY_CLANG_LLVM_DIR} REQUIRED) +else() + message(STATUS "hipify-clang will not be built. To build it please specify absolute path to LLVM 3.8 or higher using HIPIFY_CLANG_LLVM_DIR") + return() +endif() + option(HIPIFY_CLANG_TESTS "Build the tests for hipify-clang, if lit is installed" ON) # Disable the tests if `lit` or `FileCheck` is not installed. @@ -12,10 +21,6 @@ if (NOT LIT_COMMAND OR NOT FILECHECK_COMMAND OR NOT SOCAT_COMMAND) message(STATUS "hipify-clang's tests are not being built because `lit`,`FileCheck` or `socat` could not be found.") endif() -set(BUILD_HIPIFY_CLANG 0 CACHE INTERNAL "") - -find_package(LLVM PATHS ${HIPIFY_CLANG_LLVM_DIR} REQUIRED) - list(APPEND CMAKE_MODULE_PATH ${LLVM_CMAKE_DIR}) include(AddLLVM) @@ -78,16 +83,14 @@ if (HIPIFY_CLANG_TESTS) # value of --cuda-path for the test runs. find_package(CUDA REQUIRED) - set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) - configure_file( - ${CMAKE_SOURCE_DIR}/tests/hipify-clang/lit.site.cfg.in + ${CMAKE_CURRENT_LIST_DIR}/../tests/hipify-clang/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/tests/hipify-clang/lit.site.cfg @ONLY ) add_lit_testsuite(test-hipify "Running HIPify regression tests" - ${CMAKE_SOURCE_DIR}/tests/hipify-clang + ${CMAKE_CURRENT_LIST_DIR}/../tests/hipify-clang PARAMS site_config=${CMAKE_CURRENT_BINARY_DIR}/tests/hipify-clang/lit.site.cfg ARGS -v DEPENDS hipify-clang diff --git a/hipamd/hipify-clang/src/Cuda2Hip.cpp b/hipamd/hipify-clang/src/Cuda2Hip.cpp index 0f73859893..1f0bcdba65 100644 --- a/hipamd/hipify-clang/src/Cuda2Hip.cpp +++ b/hipamd/hipify-clang/src/Cuda2Hip.cpp @@ -3031,7 +3031,7 @@ public: : Cuda2Hip(R, mainFileName) {} virtual bool handleBeginSource(CompilerInstance &CI -#if LLVM_VERSION_MAJOR < 4 +#if LLVM_VERSION_MAJOR <= 4 , StringRef Filename #endif ) override { @@ -3114,7 +3114,7 @@ public: if (_sm->isWrittenInMainFile(MacroNameTok.getLocation())) { // The getNumArgs function was rather unhelpfully renamed in clang 4.0. Its semantics // remain unchanged. -#if LLVM_VERSION_MAJOR > 3 +#if LLVM_VERSION_MAJOR > 4 #define GET_NUM_ARGS() getNumParams() #else #define GET_NUM_ARGS() getNumArgs()