From 3949675ab0ea20b3d16f652aa1ecb5767f13f0ab Mon Sep 17 00:00:00 2001 From: Vladislav Sytchenko Date: Mon, 5 Oct 2020 15:15:13 -0400 Subject: [PATCH] Change __HIP_ENABLE_PCH to be an option Currently all the logic checks if __HIP_ENABLE_PCH is set, so setting it to OFF will still enable PCH. Switching __HIP_ENABLE_PCH to be a CMake option will enable correct build behaviour. Change-Id: I77a663589ffb5f2595c6ad3d144eb9466adcf250 --- CMakeLists.txt | 16 +++++++--------- rocclr/CMakeLists.txt | 4 ++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c7156c478..649e868702 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,19 +8,17 @@ set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared library (.so) or static lib ( set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -if(NOT DEFINED __HIP_ENABLE_PCH) - set(__HIP_ENABLE_PCH ON CACHE BOOL "enable/disable pre-compiled hip headers") -endif() - -if(${__HIP_ENABLE_PCH}) - set(_pchStatus 1) -else() - set(_pchStatus 0) -endif() ############################# # Options ############################# option(BUILD_HIPIFY_CLANG "Enable building the CUDA->HIP converter" OFF) +option(__HIP_ENABLE_PCH "Enable/Disable pre-compiled hip headers" ON) + +if(__HIP_ENABLE_PCH) + set(_pchStatus 1) +else() + set(_pchStatus 0) +endif() ############################# # Setup config generation diff --git a/rocclr/CMakeLists.txt b/rocclr/CMakeLists.txt index b419c93963..64d581959d 100755 --- a/rocclr/CMakeLists.txt +++ b/rocclr/CMakeLists.txt @@ -156,7 +156,7 @@ endif() # Short-Term solution for pre-compiled headers for online compilation # Enable pre compiled header -if(${__HIP_ENABLE_PCH}) +if(__HIP_ENABLE_PCH) execute_process(COMMAND sh -c "${CMAKE_CURRENT_SOURCE_DIR}/../bin/hip_embed_pch.sh ${LLVM_DIR}") add_definitions(-D__HIP_ENABLE_PCH) endif() @@ -223,7 +223,7 @@ add_library(device INTERFACE) target_link_libraries(device INTERFACE host) # Short-Term solution for pre-compiled headers for online compilation -if(${__HIP_ENABLE_PCH}) +if(__HIP_ENABLE_PCH) target_link_libraries(amdhip64 PRIVATE ${CMAKE_BINARY_DIR}/hip_pch.o) endif()