1{
2 lib,
3 stdenv,
4 adaptivecpp,
5 # Within the nix sandbox, and on the CI especially, the tests will likely be unable to access a gpu.
6 # While the CI won't be able to test on a GPU, we can do a sanity check with OMP atleast
7 #
8 # The bulk of work in acpp focuses on the generic target, so we want to test that first and foremost.
9 # Not setting an explicit target makes it default to the generic target.
10 targets ? null,
11 enablePstlTests ? false,
12 tbb,
13 cmake,
14 boost,
15}:
16stdenv.mkDerivation (finalAttrs: {
17 pname = "${adaptivecpp.pname}-tests";
18 inherit (adaptivecpp)
19 version
20 src
21 ;
22
23 nativeBuildInputs = [
24 cmake
25 tbb
26 ];
27 buildInputs = [ boost ];
28
29 sourceRoot = "${adaptivecpp.src.name}/tests";
30
31 cmakeFlags = [
32 (lib.cmakeFeature "AdaptiveCpp_DIR" "${adaptivecpp}/lib/cmake/AdaptiveCpp")
33 (lib.cmakeBool "WITH_PSTL_TESTS" enablePstlTests)
34 ]
35 ++ lib.optionals (targets != null) [
36 (lib.cmakeFeature "DACCP_TARGETS" "${targets}")
37 ];
38
39 installPhase = ''
40 mkdir $out
41 install -Dm755 sycl_tests -t $out/bin/
42 install -Dm755 rt_tests -t $out/bin/
43 install -Dm755 device_compilation_tests -t $out/bin/
44 install -Dm755 dump_test/dump_test -t $out/bin/
45 install -Dm755 platform_api/platform_api -t $out/bin/
46 ''
47 + lib.optionalString enablePstlTests ''
48 install -Dm755 pstl_tests -t $out/bin/
49 '';
50})