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
This commit is contained in:
Vladislav Sytchenko
2020-10-05 15:15:13 -04:00
parent c4505bede3
commit 3949675ab0
2 ha cambiato i file con 9 aggiunte e 11 eliminazioni
+7 -9
Vedi File
@@ -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
+2 -2
Vedi File
@@ -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()