Skip to content

Commit

Permalink
Fix PCH build failures
Browse files Browse the repository at this point in the history
(Harvested from #7604 to land separately)
  • Loading branch information
steven-johnson committed Jun 5, 2023
1 parent 7e57438 commit ac51807
Show file tree
Hide file tree
Showing 2 changed files with 9 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
5 changes: 5 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ 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(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(_test_internal PRIVATE
"$<$<COMPILE_LANGUAGE:CXX>:SHELL:-Xclang -fno-pch-timestamp>"
)
endif()

add_halide_test(_test_internal GROUPS internal)

Expand Down

0 comments on commit ac51807

Please sign in to comment.