summaryrefslogtreecommitdiff
path: root/libs/assimp/contrib/draco/cmake/draco_tests.cmake
blob: a6dfc5b57329c82fda22ade35054f161cfb95dc0 (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
126
127
128
129
130
131
132
133
if(DRACO_CMAKE_DRACO_TESTS_CMAKE)
  return()
endif()
set(DRACO_CMAKE_DRACO_TESTS_CMAKE 1)

# The factory tests are in a separate target to avoid breaking tests that rely
# on file I/O via the factories. The fake reader and writer implementations
# interfere with normal file I/O function.
set(draco_factory_test_sources
    "${draco_src_root}/io/file_reader_factory_test.cc"
    "${draco_src_root}/io/file_writer_factory_test.cc")

list(
  APPEND
    draco_test_sources
    "${draco_src_root}/animation/keyframe_animation_encoding_test.cc"
    "${draco_src_root}/animation/keyframe_animation_test.cc"
    "${draco_src_root}/attributes/point_attribute_test.cc"
    "${draco_src_root}/compression/attributes/point_d_vector_test.cc"
    "${draco_src_root}/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_transform_test.cc"
    "${draco_src_root}/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_transform_test.cc"
    "${draco_src_root}/compression/attributes/sequential_integer_attribute_encoding_test.cc"
    "${draco_src_root}/compression/bit_coders/rans_coding_test.cc"
    "${draco_src_root}/compression/decode_test.cc"
    "${draco_src_root}/compression/encode_test.cc"
    "${draco_src_root}/compression/entropy/shannon_entropy_test.cc"
    "${draco_src_root}/compression/entropy/symbol_coding_test.cc"
    "${draco_src_root}/compression/mesh/mesh_edgebreaker_encoding_test.cc"
    "${draco_src_root}/compression/mesh/mesh_encoder_test.cc"
    "${draco_src_root}/compression/point_cloud/point_cloud_kd_tree_encoding_test.cc"
    "${draco_src_root}/compression/point_cloud/point_cloud_sequential_encoding_test.cc"
    "${draco_src_root}/core/buffer_bit_coding_test.cc"
    "${draco_src_root}/core/draco_test_base.h"
    "${draco_src_root}/core/draco_test_utils.cc"
    "${draco_src_root}/core/draco_test_utils.h"
    "${draco_src_root}/core/math_utils_test.cc"
    "${draco_src_root}/core/quantization_utils_test.cc"
    "${draco_src_root}/core/status_test.cc"
    "${draco_src_root}/core/vector_d_test.cc"
    "${draco_src_root}/io/file_reader_test_common.h"
    "${draco_src_root}/io/file_utils_test.cc"
    "${draco_src_root}/io/stdio_file_reader_test.cc"
    "${draco_src_root}/io/stdio_file_writer_test.cc"
    "${draco_src_root}/io/obj_decoder_test.cc"
    "${draco_src_root}/io/obj_encoder_test.cc"
    "${draco_src_root}/io/ply_decoder_test.cc"
    "${draco_src_root}/io/ply_reader_test.cc"
    "${draco_src_root}/io/point_cloud_io_test.cc"
    "${draco_src_root}/mesh/mesh_are_equivalent_test.cc"
    "${draco_src_root}/mesh/mesh_cleanup_test.cc"
    "${draco_src_root}/mesh/triangle_soup_mesh_builder_test.cc"
    "${draco_src_root}/metadata/metadata_encoder_test.cc"
    "${draco_src_root}/metadata/metadata_test.cc"
    "${draco_src_root}/point_cloud/point_cloud_builder_test.cc"
    "${draco_src_root}/point_cloud/point_cloud_test.cc")

list(APPEND draco_gtest_all
            "${draco_root}/../googletest/googletest/src/gtest-all.cc")
list(APPEND draco_gtest_main
            "${draco_root}/../googletest/googletest/src/gtest_main.cc")

macro(draco_setup_test_targets)
  if(DRACO_TESTS)
    if(NOT (EXISTS ${draco_gtest_all} AND EXISTS ${draco_gtest_main}))
      message(FATAL "googletest must be a sibling directory of ${draco_root}.")
    endif()

    list(APPEND draco_test_defines GTEST_HAS_PTHREAD=0)

    draco_add_library(TEST
                      NAME
                      draco_gtest
                      TYPE
                      STATIC
                      SOURCES
                      ${draco_gtest_all}
                      DEFINES
                      ${draco_defines}
                      ${draco_test_defines}
                      INCLUDES
                      ${draco_test_include_paths})

    draco_add_library(TEST
                      NAME
                      draco_gtest_main
                      TYPE
                      STATIC
                      SOURCES
                      ${draco_gtest_main}
                      DEFINES
                      ${draco_defines}
                      ${draco_test_defines}
                      INCLUDES
                      ${draco_test_include_paths})

    set(DRACO_TEST_DATA_DIR "${draco_root}/testdata")
    set(DRACO_TEST_TEMP_DIR "${draco_build}/draco_test_temp")
    file(MAKE_DIRECTORY "${DRACO_TEST_TEMP_DIR}")

    # Sets DRACO_TEST_DATA_DIR and DRACO_TEST_TEMP_DIR.
    configure_file("${draco_root}/cmake/draco_test_config.h.cmake"
                   "${draco_build}/testing/draco_test_config.h")

    # Create the test targets.
    draco_add_executable(NAME
                         draco_tests
                         SOURCES
                         ${draco_test_sources}
                         DEFINES
                         ${draco_defines}
                         ${draco_test_defines}
                         INCLUDES
                         ${draco_test_include_paths}
                         LIB_DEPS
                         draco_static
                         draco_gtest
                         draco_gtest_main)

    draco_add_executable(NAME
                         draco_factory_tests
                         SOURCES
                         ${draco_factory_test_sources}
                         DEFINES
                         ${draco_defines}
                         ${draco_test_defines}
                         INCLUDES
                         ${draco_test_include_paths}
                         LIB_DEPS
                         draco_static
                         draco_gtest
                         draco_gtest_main)
  endif()
endmacro()