Skip to content

Commit

Permalink
Fix PCH build failures (#7613)
Browse files Browse the repository at this point in the history
* Fix PCH build failures

(Harvested from #7604 to land separately)

* Update CMakeLists.txt
  • Loading branch information
steven-johnson authored Jun 6, 2023
1 parent ffd20c9 commit 123d855
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 4 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@ mark_as_advanced(Halide_CCACHE_BUILD)
if (Halide_CCACHE_BUILD)
find_program(CCACHE_PROGRAM ccache REQUIRED)

# TODO: ccache recommends setting CCACHE_SLOPPINESS=pch_defines,time_macros to
# enable precompiled header caching. Our timing found it slightly faster with
# just CCACHE_SLOPPINESS=pch_defines, so that's what we're using. Maybe revisit
# if issues occur (but we don't use any of the time macros so should be irrelevant).
set(Halide_CCACHE_PARAMS CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines
set(Halide_CCACHE_PARAMS
CCACHE_CPP2=yes
CCACHE_HASHDIR=yes
CCACHE_SLOPPINESS=pch_defines,time_macros,include_file_mtime,include_file_ctime
CACHE STRING "Parameters to pass through to ccache")
mark_as_advanced(Halide_CCACHE_PARAMS)

Expand Down
7 changes: 7 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ add_executable(_test_internal internal.cpp)
target_link_libraries(_test_internal PRIVATE Halide::Test)
target_include_directories(_test_internal PRIVATE "${Halide_SOURCE_DIR}/src")
target_precompile_headers(_test_internal PRIVATE <Halide.h>)
if (Halide_CCACHE_BUILD)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(_test_internal PRIVATE
"$<$<COMPILE_LANGUAGE:CXX>:SHELL:-Xclang -fno-pch-timestamp>"
)
endif()
endif()

add_halide_test(_test_internal GROUPS internal)

Expand Down

0 comments on commit 123d855

Please sign in to comment.