summaryrefslogtreecommitdiff
path: root/next/test/CMakeLists.txt
blob: cb0519ade9595d7e3471d8cee6680b332c079b46 (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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
add_library(
    mbgl-test STATIC EXCLUDE_FROM_ALL
    ${MBGL_ROOT}/test/actor/actor.test.cpp
    ${MBGL_ROOT}/test/actor/actor_ref.test.cpp
    ${MBGL_ROOT}/test/algorithm/update_renderables.test.cpp
    ${MBGL_ROOT}/test/algorithm/update_tile_masks.test.cpp
    ${MBGL_ROOT}/test/api/annotations.test.cpp
    ${MBGL_ROOT}/test/api/api_misuse.test.cpp
    ${MBGL_ROOT}/test/api/custom_geometry_source.test.cpp
    ${MBGL_ROOT}/test/api/custom_layer.test.cpp
    ${MBGL_ROOT}/test/api/query.test.cpp
    ${MBGL_ROOT}/test/api/recycle_map.cpp
    ${MBGL_ROOT}/test/geometry/dem_data.test.cpp
    ${MBGL_ROOT}/test/geometry/line_atlas.test.cpp
    ${MBGL_ROOT}/test/gl/bucket.test.cpp
    ${MBGL_ROOT}/test/gl/context.test.cpp
    ${MBGL_ROOT}/test/gl/gl_functions.test.cpp
    ${MBGL_ROOT}/test/gl/object.test.cpp
    ${MBGL_ROOT}/test/map/map.test.cpp
    ${MBGL_ROOT}/test/map/prefetch.test.cpp
    ${MBGL_ROOT}/test/map/transform.test.cpp
    ${MBGL_ROOT}/test/math/clamp.test.cpp
    ${MBGL_ROOT}/test/math/minmax.test.cpp
    ${MBGL_ROOT}/test/math/wrap.test.cpp
    ${MBGL_ROOT}/test/programs/symbol_program.test.cpp
    ${MBGL_ROOT}/test/renderer/backend_scope.test.cpp
    ${MBGL_ROOT}/test/renderer/image_manager.test.cpp
    ${MBGL_ROOT}/test/renderer/pattern_atlas.test.cpp
    ${MBGL_ROOT}/test/sprite/sprite_loader.test.cpp
    ${MBGL_ROOT}/test/sprite/sprite_parser.test.cpp
    ${MBGL_ROOT}/test/src/mbgl/test/fixture_log_observer.cpp
    ${MBGL_ROOT}/test/src/mbgl/test/getrss.cpp
    ${MBGL_ROOT}/test/src/mbgl/test/sqlite3_test_fs.cpp
    ${MBGL_ROOT}/test/src/mbgl/test/stub_file_source.cpp
    ${MBGL_ROOT}/test/src/mbgl/test/test.cpp
    ${MBGL_ROOT}/test/src/mbgl/test/util.cpp
    ${MBGL_ROOT}/test/storage/asset_file_source.test.cpp
    ${MBGL_ROOT}/test/storage/database_file_source.test.cpp
    ${MBGL_ROOT}/test/storage/headers.test.cpp
    ${MBGL_ROOT}/test/storage/http_file_source.test.cpp
    ${MBGL_ROOT}/test/storage/local_file_source.test.cpp
    ${MBGL_ROOT}/test/storage/main_resource_loader.test.cpp
    ${MBGL_ROOT}/test/storage/offline.test.cpp
    ${MBGL_ROOT}/test/storage/offline_database.test.cpp
    ${MBGL_ROOT}/test/storage/offline_download.test.cpp
    ${MBGL_ROOT}/test/storage/online_file_source.test.cpp
    ${MBGL_ROOT}/test/storage/resource.test.cpp
    ${MBGL_ROOT}/test/storage/sqlite.test.cpp
    ${MBGL_ROOT}/test/style/conversion/conversion_impl.test.cpp
    ${MBGL_ROOT}/test/style/conversion/function.test.cpp
    ${MBGL_ROOT}/test/style/conversion/geojson_options.test.cpp
    ${MBGL_ROOT}/test/style/conversion/layer.test.cpp
    ${MBGL_ROOT}/test/style/conversion/light.test.cpp
    ${MBGL_ROOT}/test/style/conversion/property_value.test.cpp
    ${MBGL_ROOT}/test/style/conversion/stringify.test.cpp
    ${MBGL_ROOT}/test/style/conversion/tileset.test.cpp
    ${MBGL_ROOT}/test/style/expression/expression.test.cpp
    ${MBGL_ROOT}/test/style/expression/util.test.cpp
    ${MBGL_ROOT}/test/style/filter.test.cpp
    ${MBGL_ROOT}/test/style/properties.test.cpp
    ${MBGL_ROOT}/test/style/property_expression.test.cpp
    ${MBGL_ROOT}/test/style/source.test.cpp
    ${MBGL_ROOT}/test/style/style.test.cpp
    ${MBGL_ROOT}/test/style/style_image.test.cpp
    ${MBGL_ROOT}/test/style/style_layer.test.cpp
    ${MBGL_ROOT}/test/style/style_parser.test.cpp
    ${MBGL_ROOT}/test/text/bidi.test.cpp
    ${MBGL_ROOT}/test/text/calculate_tile_distances.test.cpp
    ${MBGL_ROOT}/test/text/cross_tile_symbol_index.test.cpp
    ${MBGL_ROOT}/test/text/formatted.test.cpp
    ${MBGL_ROOT}/test/text/get_anchors.test.cpp
    ${MBGL_ROOT}/test/text/glyph_manager.test.cpp
    ${MBGL_ROOT}/test/text/glyph_pbf.test.cpp
    ${MBGL_ROOT}/test/text/language_tag.test.cpp
    ${MBGL_ROOT}/test/text/local_glyph_rasterizer.test.cpp
    ${MBGL_ROOT}/test/text/quads.test.cpp
    ${MBGL_ROOT}/test/text/shaping.test.cpp
    ${MBGL_ROOT}/test/text/tagged_string.test.cpp
    ${MBGL_ROOT}/test/tile/custom_geometry_tile.test.cpp
    ${MBGL_ROOT}/test/tile/geojson_tile.test.cpp
    ${MBGL_ROOT}/test/tile/geometry_tile_data.test.cpp
    ${MBGL_ROOT}/test/tile/raster_dem_tile.test.cpp
    ${MBGL_ROOT}/test/tile/raster_tile.test.cpp
    ${MBGL_ROOT}/test/tile/tile_cache.test.cpp
    ${MBGL_ROOT}/test/tile/tile_coordinate.test.cpp
    ${MBGL_ROOT}/test/tile/tile_id.test.cpp
    ${MBGL_ROOT}/test/tile/vector_tile.test.cpp
    ${MBGL_ROOT}/test/util/async_task.test.cpp
    ${MBGL_ROOT}/test/util/dtoa.test.cpp
    ${MBGL_ROOT}/test/util/geo.test.cpp
    ${MBGL_ROOT}/test/util/grid_index.test.cpp
    ${MBGL_ROOT}/test/util/http_timeout.test.cpp
    ${MBGL_ROOT}/test/util/image.test.cpp
    ${MBGL_ROOT}/test/util/mapbox.test.cpp
    ${MBGL_ROOT}/test/util/memory.test.cpp
    ${MBGL_ROOT}/test/util/merge_lines.test.cpp
    ${MBGL_ROOT}/test/util/number_conversions.test.cpp
    ${MBGL_ROOT}/test/util/offscreen_texture.test.cpp
    ${MBGL_ROOT}/test/util/position.test.cpp
    ${MBGL_ROOT}/test/util/projection.test.cpp
    ${MBGL_ROOT}/test/util/run_loop.test.cpp
    ${MBGL_ROOT}/test/util/string.test.cpp
    ${MBGL_ROOT}/test/util/text_conversions.test.cpp
    ${MBGL_ROOT}/test/util/thread.test.cpp
    ${MBGL_ROOT}/test/util/thread_local.test.cpp
    ${MBGL_ROOT}/test/util/tile_cover.test.cpp
    ${MBGL_ROOT}/test/util/tile_range.test.cpp
    ${MBGL_ROOT}/test/util/timer.test.cpp
    ${MBGL_ROOT}/test/util/token.test.cpp
    ${MBGL_ROOT}/test/util/url.test.cpp
)

find_program(MBGL_TEST_NODEJS NAMES nodejs node)
find_program(MBGL_TEST_NPM NAMES npm)

if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL Android OR NOT MBGL_TEST_NODEJS OR NOT MBGL_TEST_NPM)
    message("Target platform does not support HTTP tests or dependencies not found.")

    set(MBGL_TEST_HAS_TEST_SERVER 0)
else()
    set(MBGL_TEST_HAS_TEST_SERVER 1)
endif()

if(NOT DEFINED ENV{CI})
    set(MBGL_TEST_BUILD_ON_CI 0)
else()
    set(MBGL_TEST_BUILD_ON_CI 1)
endif()

target_compile_definitions(
    mbgl-test
    PRIVATE NODE_EXECUTABLE=${MBGL_TEST_NODEJS} TEST_HAS_SERVER=${MBGL_TEST_HAS_TEST_SERVER} CI_BUILD=${MBGL_TEST_BUILD_ON_CI}
)

target_include_directories(
    mbgl-test
    PRIVATE
        ${MBGL_ROOT}/platform/default/include
        ${MBGL_ROOT}/platform/gfx/gl/src
        ${MBGL_ROOT}/src
        ${MBGL_ROOT}/test/src
)

target_include_directories(
    mbgl-test
    PUBLIC ${MBGL_ROOT}/include ${MBGL_ROOT}/test/include
)

include(${PROJECT_SOURCE_DIR}/vendor/googletest.cmake)

# Needed for testing private classes
get_target_property(MBGL_CORE_PRIVATE_LIBRARIES mbgl-core LINK_LIBRARIES)

target_link_libraries(
    mbgl-test
    PRIVATE
        ${MBGL_CORE_PRIVATE_LIBRARIES}
        Mapbox::Base::Extras::args
        Mapbox::Base::pixelmatch-cpp
        mbgl-compiler-options
    PUBLIC mbgl-core
)

target_link_libraries(
    mbgl-test
    PUBLIC mbgl-vendor-googletest
)

set_property(TARGET mbgl-test PROPERTY FOLDER Core)