@@ -1645,12 +1645,86 @@ endif()
1645
1645
1646
1646
#---Check for AdaptiveCpp-------------------------------------------------------------------
1647
1647
1648
- if (experimental_adaptivecpp)
1648
+ if (experimental_adaptivecpp OR experimental_builtin_adaptivecpp )
1649
1649
if (experimental_oneapi)
1650
1650
message (WARNING "Disable OneAPI to load AdaptiveCpp" )
1651
1651
set (sycl OFF CACHE BOOL "Disabled because AdaptiveCpp is enabled" FORCE)
1652
1652
else ()
1653
- find_package (AdaptiveCpp)
1653
+
1654
+ if (NOT experimental_builtin_adaptivecpp)
1655
+ message (STATUS "Looking for AdaptiveCpp" )
1656
+ find_package (AdaptiveCpp)
1657
+
1658
+ if (NOT AdaptiveCpp_FOUND)
1659
+ if (fail-on -missing)
1660
+ message (FATAL_ERROR "AdaptiveCpp not found. Ensure that the installation of AdaptiveCpp is in the CMAKE_PREFIX_PATH" )
1661
+ else ()
1662
+ message (STATUS "AdaptiveCpp not found. Ensure that the installation of AdaptiveCpp is in the CMAKE_PREFIX_PATH" )
1663
+ if (NO_CONNECTION)
1664
+ set (experimental_adaptivecpp OFF CACHE BOOL "Disabled because not found and no internet connection" FORCE)
1665
+ else ()
1666
+ message (STATUS " Switching ON 'experimental_builtin_adaptivecpp' option" )
1667
+ set (experimental_builtin_adaptivecpp ON CACHE BOOL "Enabled because external AdaptiveCpp not found" FORCE)
1668
+ endif ()
1669
+ endif ()
1670
+ endif ()
1671
+ endif ()
1672
+
1673
+ if (experimental_builtin_adaptivecpp)
1674
+ # Use ADAPTIVE_CPP_SOURCE_DIR variable if it is defined in the CMake
1675
+ # configuration
1676
+ if (NOT DEFINED ADAPTIVE_CPP_SOURCE_DIR)
1677
+ include (FetchContent)
1678
+ set (ADAPTIVE_CPP_SOURCE_DIR "${CMAKE_BINARY_DIR} /AdaptiveCpp" )
1679
+ FetchContent_Declare(
1680
+ AdaptiveCpp
1681
+ GIT_REPOSITORY https://github.com/devajithvs/AdaptiveCpp.git
1682
+ GIT_TAG 3fb375fdc84ad0423139e05167739e9e906ca183
1683
+ )
1684
+ FetchContent_GetProperties(AdaptiveCpp)
1685
+ if (NOT AdaptiveCpp_POPULATED)
1686
+ FetchContent_Populate(AdaptiveCpp)
1687
+ endif ()
1688
+
1689
+ set (ADAPTIVE_CPP_SOURCE_DIR "${adaptivecpp_SOURCE_DIR} " )
1690
+ endif ()
1691
+
1692
+ set (AdaptiveCpp_FOUND True )
1693
+
1694
+ list (INSERT CMAKE_MODULE_PATH 0 "${ADAPTIVE_CPP_SOURCE_DIR} /cmake/" )
1695
+
1696
+ set (ADAPTIVE_CPP_HEADER_BUILD_PATH
1697
+ "${CMAKE_CURRENT_BINARY_DIR} /include/AdaptiveCpp" )
1698
+ set (ADAPTIVE_CPP_HEADER_INSTALL_PATH
1699
+ "${CMAKE_INSTALL_PREFIX} /include/AdaptiveCpp" )
1700
+
1701
+ add_subdirectory (
1702
+ ${ADAPTIVE_CPP_SOURCE_DIR}
1703
+ ${adaptivecpp_BINARY_DIR}
1704
+ )
1705
+
1706
+ set (ACPP_EXPORTS
1707
+ acpp-common
1708
+ acpp-rt
1709
+ acpp-clang-cbs
1710
+ acpp-clang
1711
+ llvm-to-backend
1712
+ llvm-to-host
1713
+ rt-backend-omp)
1714
+
1715
+ if (WITH_CUDA_BACKEND)
1716
+ list (APPEND ACPP_EXPORTS llvm-to-ptx rt-backend-cuda)
1717
+ endif ()
1718
+
1719
+ if (WITH_OPENCL_BACKEND)
1720
+ list (APPEND ACPP_EXPORTS llvm-to-spirv rt-backend-ocl ocl-cxx-headers ocl-headers)
1721
+ endif ()
1722
+
1723
+ if (WITH_ROCM_BACKEND)
1724
+ list (APPEND ACPP_EXPORTS llvm-to-amdgpu rt-backend-hip)
1725
+ endif ()
1726
+ endif ()
1727
+
1654
1728
if (AdaptiveCpp_FOUND)
1655
1729
set (sycl ON )
1656
1730
set (SYCL_COMPILER_FLAGS "-ffast-math ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${_BUILD_TYPE_UPPER} }" )
0 commit comments