@@ -235,6 +235,12 @@ class HalideBuilder(BuilderConfig):
235235
236236 return None
237237
238+ def cmake_preset (self ):
239+ if self .sanitizer :
240+ return self .sanitizer_preset ()
241+ os_name = {"linux" : "linux" , "osx" : "macos" , "windows" : "windows" }[self .os ]
242+ return f"ci-{ os_name } -{ self .arch } -{ self .bits } "
243+
238244 def handles_hexagon (self ):
239245 return self .arch == "x86" and self .os == "linux" and self .llvm_branch == LLVM_MAIN
240246
@@ -405,27 +411,11 @@ def get_msvc_config_steps(factory, builder_type):
405411
406412
407413def get_cmake_options (builder_type , build_dir ):
408- options = []
409-
410- if builder_type .sanitizer :
411- assert builder_type .handles_sanitizers ()
412- options .append (f"--preset={ builder_type .sanitizer_preset ()} " )
413- # append *after* preset so we override the build dir
414- options += ["-B" , build_dir ]
415-
416- return options
414+ return [f"--preset={ builder_type .cmake_preset ()} " , "-B" , build_dir ]
417415
418416
419417def get_ctest_options (builder_type ):
420- if builder_type .sanitizer :
421- assert builder_type .handles_sanitizers ()
422- # No, this won't work, see https://gitlab.kitware.com/cmake/cmake/-/issues/23982 --
423- # fortunately, we don't need to specify the current sanitizer toolchains
424- # at test time (just at configure time).
425- # return {'preset': builder_type.sanitizer_preset(), 'test_dir': build_dir}
426- return {"build_config" : builder_type .sanitizer_preset ()}
427-
428- return {"build_config" : "Release" }
418+ return {"build_config" : "RelWithDebInfo" }
429419
430420
431421def get_cmake_definitions (builder_type , halide_target = "host" , wasm_jit = "wabt" , extra_cmake_defs = None ):
@@ -436,29 +426,17 @@ def get_cmake_definitions(builder_type, halide_target="host", wasm_jit="wabt", e
436426 "CMAKE_INSTALL_PREFIX" : get_install_path (builder_type ),
437427 "Halide_LLVM_ROOT" : Property ("HALIDE_LLVM_ROOT" ),
438428 "Halide_TARGET" : halide_target ,
439- "WITH_PYTHON_BINDINGS" : "ON" if builder_type .handles_python () else "OFF" ,
440- "WITH_TEST_FUZZ" : "ON" if builder_type .sanitizer == "fuzzer" else "OFF" ,
441429 ** extra_cmake_defs ,
442430 }
443431
444- if builder_type .sanitizer and builder_type .handles_sanitizers ():
445- # The sanitizer toolchain files reference ${LLVM_ROOT} for the compiler paths.
446- cmake_definitions ["LLVM_ROOT" ] = Property ("HALIDE_LLVM_ROOT" )
447- else :
448- cmake_definitions ["CMAKE_BUILD_TYPE" ] = "Release"
449-
450- # Sanitizer builds intermittently fail when using CCache for reasons that aren't
451- # clear ("precompiled header modified") -- for now, just ignore CCache for them
452- if builder_type .has_ccache () and not builder_type .sanitizer_preset ():
432+ if builder_type .has_ccache ():
453433 cmake_definitions ["Halide_CCACHE_BUILD" ] = "ON"
454434
455435 cmake_definitions ["CMAKE_TOOLCHAIN_FILE" ] = Interpolate ("%(prop:VCPKG_ROOT)s/scripts/buildsystems/vcpkg.cmake" )
456436
457437 if builder_type .os == "windows" :
458- # CMake on Windows can't reliably find our pip-installed PyBind11 unless we set pybind11_ROOT to point to it
459438 cmake_definitions ["pybind11_ROOT" ] = Property ("VIRTUAL_ENV" )
460439
461- # Don't bother with anything Python-related if we are targeting WebAssembly.
462440 if "wasm" in halide_target :
463441 cmake_definitions ["WITH_PYTHON_BINDINGS" ] = "OFF"
464442
@@ -540,20 +518,9 @@ def add_env_setup_step(factory, builder_type):
540518 # do this first because the SetPropertyFromCommand step isn't smart enough to merge
541519 get_msvc_config_steps (factory , builder_type )
542520
543- if builder_type .os == "linux" :
544- cc = "gcc-9"
545- cxx = "g++-9"
546- elif builder_type .os == "windows" :
547- cxx = "cl.exe"
548- cc = "cl.exe"
549- else :
550- cxx = "c++"
551- cc = "cc"
552-
553521 env : dict [str , Renderable ] = {
554- "CC" : cc ,
555- "CXX" : cxx ,
556- "LD" : "ld" ,
522+ "VCPKG_INSTALLATION_ROOT" : Property ("VCPKG_INSTALLATION_ROOT" ),
523+ "UV_PROJECT_ENVIRONMENT" : get_builddir_subpath (".venv" ),
557524 }
558525
559526 factory .addStep (
@@ -587,22 +554,6 @@ def add_env_setup_step(factory, builder_type):
587554 # This will have no effect on CPU testing, just Metal testing
588555 env ["METAL_DEVICE_WRAPPER_TYPE" ] = "1"
589556
590- env ["VCPKG_ROOT" ] = Property ("VCPKG_ROOT" )
591- env ["VCPKG_OVERLAY_PORTS" ] = get_source_path ("cmake/vcpkg" )
592- env ["VCPKG_MANIFEST_FEATURES" ] = "developer"
593-
594- if builder_type .os == "windows" :
595- # Current NVidia drivers on our Windows buildbots can corrupt their own
596- # cache, leading to many spurious failures. Disable the cache
597- # for now, pending NVidia investigation.
598- env ["CUDA_CACHE_DISABLE" ] = "1"
599-
600- # We don't ever want an Abort, Retry, Ignore dialog in our tests
601- env ["HL_DISABLE_WINDOWS_ABORT_DIALOG" ] = "1"
602-
603- # UV virtual environments should not pollute the source directory
604- env ["UV_PROJECT_ENVIRONMENT" ] = get_builddir_subpath (".venv" )
605-
606557 # Leaving this here (but commented out) in case we need to temporarily
607558 # disable leak-checking in the future.
608559 #
@@ -661,8 +612,8 @@ def add_vcpkg_step(factory, builder_type):
661612
662613 factory .addStep (
663614 SetProperties (
664- name = "Set VCPKG_ROOT " ,
665- properties = {"VCPKG_ROOT " : vcpkg_dir },
615+ name = "Set VCPKG_INSTALLATION_ROOT " ,
616+ properties = {"VCPKG_INSTALLATION_ROOT " : vcpkg_dir },
666617 )
667618 )
668619
@@ -716,7 +667,6 @@ def add_build_steps(factory, builder_type):
716667 workdir = build_dir ,
717668 env = Property ("env" ),
718669 path = source_dir ,
719- generator = "Ninja" ,
720670 definitions = get_cmake_definitions (builder_type ),
721671 options = get_cmake_options (builder_type , build_dir ),
722672 )
@@ -936,7 +886,6 @@ def add_test_steps(factory, builder_type):
936886 env = env ,
937887 workdir = build_dir ,
938888 path = source_dir ,
939- generator = "Ninja" ,
940889 definitions = cmake_defs ,
941890 options = get_cmake_options (builder_type , build_dir ),
942891 )
@@ -1036,8 +985,14 @@ def add_test_steps(factory, builder_type):
1036985 apps_source_dir = get_source_path ("apps" )
1037986
1038987 # We currently don't attempt to build any of the apps with wasm
1039- apps_cmake_defs = get_cmake_definitions (builder_type , halide_target = halide_target )
1040- apps_cmake_defs ["CMAKE_PREFIX_PATH" ] = get_install_path (builder_type )
988+ apps_cmake_defs : dict [str , Renderable ] = {
989+ "CMAKE_BUILD_TYPE" : "RelWithDebInfo" ,
990+ "CMAKE_PREFIX_PATH" : get_install_path (builder_type ),
991+ "CMAKE_TOOLCHAIN_FILE" : Interpolate (
992+ "%(prop:VCPKG_INSTALLATION_ROOT)s/scripts/buildsystems/vcpkg.cmake"
993+ ),
994+ "Halide_TARGET" : halide_target ,
995+ }
1041996
1042997 # apps/hannk is expensive to build and doesn't (yet) build on all systems, so special-case it here
1043998 want_hannk = builder_type .has_tflite () and not halide_target .startswith ("wasm-" )
@@ -1058,7 +1013,6 @@ def add_test_steps(factory, builder_type):
10581013 path = apps_source_dir ,
10591014 generator = "Ninja" ,
10601015 definitions = apps_cmake_defs ,
1061- options = get_cmake_options (builder_type , build_dir ),
10621016 )
10631017 )
10641018
0 commit comments