aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/CMakeLists.txt
blob: 7277bc947e0b7c8ca2984e385d04a4f697be2179 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
include(TargetArchitectureSpecificSources)

add_executable(dynarmic_tests
    fp/FPToFixed.cpp
    fp/FPValue.cpp
    fp/mantissa_util_tests.cpp
    fp/unpacked_tests.cpp
    rand_int.h
)

if ("A32" IN_LIST DYNARMIC_FRONTENDS)
    target_sources(dynarmic_tests PRIVATE
        A32/test_arm_disassembler.cpp
        A32/test_arm_instructions.cpp
        A32/test_coprocessor.cpp
        A32/test_svc.cpp
        A32/test_thumb_instructions.cpp
        A32/testenv.h
        decoder_tests.cpp
    )
endif()

if ("A64" IN_LIST DYNARMIC_FRONTENDS)
    target_sources(dynarmic_tests PRIVATE
        A64/a64.cpp
        A64/fp_min_max.cpp
        A64/misaligned_page_table.cpp
        A64/test_invalidation.cpp
        A64/testenv.h
    )
endif()

if (DYNARMIC_TESTS_USE_UNICORN)
    target_link_libraries(dynarmic_tests PRIVATE Unicorn::Unicorn)

    target_sources(dynarmic_tests PRIVATE
        fuzz_util.cpp
        fuzz_util.h
    )

    if ("A32" IN_LIST DYNARMIC_FRONTENDS)
        target_sources(dynarmic_tests PRIVATE
            A32/fuzz_arm.cpp
            A32/fuzz_thumb.cpp
            unicorn_emu/a32_unicorn.cpp
            unicorn_emu/a32_unicorn.h
        )
    endif()

    if ("A64" IN_LIST DYNARMIC_FRONTENDS)
        target_sources(dynarmic_tests PRIVATE
            A64/fuzz_with_unicorn.cpp
            A64/verify_unicorn.cpp
            unicorn_emu/a64_unicorn.cpp
            unicorn_emu/a64_unicorn.h
        )
    endif()
endif()

if ("x86_64" IN_LIST ARCHITECTURE)
    target_link_libraries(dynarmic_tests PRIVATE xbyak::xbyak)

    target_architecture_specific_sources(dynarmic_tests "x86_64"
        x64_cpu_info.cpp
    )

    if (NOT MSVC AND NOT DYNARMIC_MULTIARCH_BUILD)
        target_sources(dynarmic_tests PRIVATE
            rsqrt_test.cpp
            rsqrt_test_fn.s
        )
    endif()
endif()

include(CreateDirectoryGroups)

if (("A32" IN_LIST DYNARMIC_FRONTENDS) AND ("A64" IN_LIST DYNARMIC_FRONTENDS))
    add_executable(dynarmic_print_info
        print_info.cpp
    )

    create_target_directory_groups(dynarmic_print_info)

    target_link_libraries(dynarmic_print_info PRIVATE dynarmic Boost::boost fmt::fmt merry::mcl)
    target_include_directories(dynarmic_print_info PRIVATE . ../src)
    target_compile_options(dynarmic_print_info PRIVATE ${DYNARMIC_CXX_FLAGS})
    target_compile_definitions(dynarmic_print_info PRIVATE FMT_USE_USER_DEFINED_LITERALS=1)
endif()

if (("A32" IN_LIST DYNARMIC_FRONTENDS) AND ("A64" IN_LIST DYNARMIC_FRONTENDS))
    add_executable(dynarmic_test_generator
        fuzz_util.cpp
        fuzz_util.h
        test_generator.cpp
    )

    create_target_directory_groups(dynarmic_test_generator)

    target_link_libraries(dynarmic_test_generator PRIVATE dynarmic Boost::boost fmt::fmt merry::mcl)
    target_include_directories(dynarmic_test_generator PRIVATE . ../src)
    target_compile_options(dynarmic_test_generator PRIVATE ${DYNARMIC_CXX_FLAGS})
    target_compile_definitions(dynarmic_test_generator PRIVATE FMT_USE_USER_DEFINED_LITERALS=1)
endif()

if (("A32" IN_LIST DYNARMIC_FRONTENDS) AND ("A64" IN_LIST DYNARMIC_FRONTENDS))
    add_executable(dynarmic_test_reader
        test_reader.cpp
    )

    create_target_directory_groups(dynarmic_test_reader)

    target_link_libraries(dynarmic_test_reader PRIVATE dynarmic Boost::boost fmt::fmt merry::mcl)
    target_include_directories(dynarmic_test_reader PRIVATE . ../src)
    target_compile_options(dynarmic_test_reader PRIVATE ${DYNARMIC_CXX_FLAGS})
    target_compile_definitions(dynarmic_test_reader PRIVATE FMT_USE_USER_DEFINED_LITERALS=1)
endif()

create_target_directory_groups(dynarmic_tests)

target_link_libraries(dynarmic_tests PRIVATE dynarmic Boost::boost Catch2::Catch2WithMain fmt::fmt merry::mcl)
target_include_directories(dynarmic_tests PRIVATE . ../src)
target_compile_options(dynarmic_tests PRIVATE ${DYNARMIC_CXX_FLAGS})
target_compile_definitions(dynarmic_tests PRIVATE FMT_USE_USER_DEFINED_LITERALS=1)

add_test(dynarmic_tests dynarmic_tests --durations yes)