diff --git a/3party/gflags/CMakeLists.txt b/3party/gflags/CMakeLists.txt new file mode 100644 index 0000000000..c0da7415e3 --- /dev/null +++ b/3party/gflags/CMakeLists.txt @@ -0,0 +1,15 @@ +project(gflags) + +include_directories(src) + +set( + SRC + src/config.h + src/gflags.cc + src/gflags/gflags.h + src/gflags/gflags_completions.h + src/gflags_completions.cc + src/gflags_reporting.cc +) + +add_library(${PROJECT_NAME} ${SRC}) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f346c9ee8..783f796cb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,8 +21,8 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release") add_definitions(-DRELEASE) endif() -if (NOT NO_TESTS) - set(NO_TESTS FALSE) +if (NOT SKIP_TESTS) + set(SKIP_TESTS FALSE) endif() # End of setting environment variables @@ -109,16 +109,16 @@ include_directories( # Functions for using in subdirectories function(omim_add_test executable) - if (NOT NO_TESTS) + if (NOT SKIP_TESTS) add_executable(${executable} ${OMIM_ROOT}/testing/testingmain.cpp ${ARGN}) endif() endfunction() function(omim_add_test_subdirectory subdir) - if (NOT NO_TESTS) + if (NOT SKIP_TESTS) add_subdirectory(${subdir}) else() - message("NO_TESTS: Skipping subdirectory ${subdir}") + message("SKIP_TESTS: Skipping subdirectory ${subdir}") endif() endfunction() @@ -149,6 +149,37 @@ function(append VAR) set(${VAR} ${${VAR}} ${ARGN} PARENT_SCOPE) endfunction() +function(link_opengl target) + if (PLATFORM_MAC) + omim_link_libraries( + ${target} + "-framework OpenGL" + ) + endif() + + if (PLATFORM_LINUX) + omim_link_libraries( + ${target} + ${OPENGL_gl_LIBRARY} + ) + endif() +endfunction() + +function(link_qt5_core target) + omim_link_libraries( + ${target} + ${Qt5Core_LIBRARIES} + ) + + if (PLATFORM_MAC) + omim_link_libraries( + ${target} + "-framework IOKit" + ) + endif() +endfunction() + + macro(check_pybindings) if (NOT PYBINDINGS) message("Skipping " + ${PROJECT_NAME} + " because the PYBINDINGS variale is not set or is set to FALSE") @@ -181,6 +212,7 @@ add_subdirectory(3party/liboauthcpp) add_subdirectory(3party/pugixml) add_subdirectory(3party/succinct) add_subdirectory(3party/osrm) +add_subdirectory(3party/gflags) add_subdirectory(base) add_subdirectory(coding) add_subdirectory(geometry) @@ -204,6 +236,6 @@ endif() omim_add_test_subdirectory(qt_tstfrm) omim_add_test_subdirectory(3party/gmock) -if (NOT PLATFORM_IPHONE AND NOT PLATFORM_ANDROID) +if (NOT PLATFORM_IPHONE AND NOT PLATFORM_ANDROID AND NOT SKIP_DESKTOP) add_subdirectory(qt) endif() diff --git a/drape/drape_tests/CMakeLists.txt b/drape/drape_tests/CMakeLists.txt index 63159690d3..22bb159dd6 100644 --- a/drape/drape_tests/CMakeLists.txt +++ b/drape/drape_tests/CMakeLists.txt @@ -61,12 +61,13 @@ omim_link_libraries( stats_client freetype gmock - ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${LIBZ} ) +link_qt5_core(${PROJECT_NAME}) + if (PLATFORM_MAC) omim_link_libraries( ${PROJECT_NAME} diff --git a/drape_frontend/drape_frontend_tests/CMakeLists.txt b/drape_frontend/drape_frontend_tests/CMakeLists.txt index 1975a62513..77e8f7202e 100644 --- a/drape_frontend/drape_frontend_tests/CMakeLists.txt +++ b/drape_frontend/drape_frontend_tests/CMakeLists.txt @@ -28,5 +28,7 @@ omim_link_libraries( expat stats_client ${LIBZ} - ${Qt5OpenGL_LIBRARIES} -) \ No newline at end of file +) + +link_opengl(${PROJECT_NAME}) +link_qt5_core(${PROJECT_NAME}) diff --git a/generator/CMakeLists.txt b/generator/CMakeLists.txt index 62c0c1c904..2dc8add5cc 100644 --- a/generator/CMakeLists.txt +++ b/generator/CMakeLists.txt @@ -91,3 +91,4 @@ set(SRC add_library(${PROJECT_NAME} ${SRC}) omim_add_test_subdirectory(generator_tests_support) +omim_add_test_subdirectory(generator_tests) diff --git a/generator/generator_tests/CMakeLists.txt b/generator/generator_tests/CMakeLists.txt new file mode 100644 index 0000000000..12fba997bd --- /dev/null +++ b/generator/generator_tests/CMakeLists.txt @@ -0,0 +1,64 @@ +project(generator_tests) + +set( + SRC + altitude_test.cpp + check_mwms.cpp + coasts_test.cpp + feature_builder_test.cpp + feature_merger_test.cpp + metadata_parser_test.cpp + osm2meta_test.cpp + osm_id_test.cpp + osm_o5m_source_test.cpp + osm_type_test.cpp + restriction_collector_test.cpp + restriction_test.cpp + source_data.cpp + source_data.hpp + source_to_element_test.cpp + srtm_parser_test.cpp + tag_admixer_test.cpp + tesselator_test.cpp + triangles_tree_coding_test.cpp + types_helper.hpp +) + +omim_add_test(${PROJECT_NAME} ${SRC}) + +omim_link_libraries( + ${PROJECT_NAME} + generator_tests_support + platform_tests_support + generator + drape_frontend + map + routing + search + storage + indexer + drape + traffic + editor + platform + geometry + coding + base + freetype + expat + fribidi + jansson + protobuf + osrm + stats_client + minizip + succinct + pugixml + tess2 + gflags + oauthcpp + opening_hours + ${LIBZ} +) + +link_qt5_core(${PROJECT_NAME}) diff --git a/indexer/CMakeLists.txt b/indexer/CMakeLists.txt index 0abc38bcfb..716fdf40bd 100644 --- a/indexer/CMakeLists.txt +++ b/indexer/CMakeLists.txt @@ -141,4 +141,4 @@ file(COPY ${OTHER_FILES} DESTINATION ${CMAKE_BINARY_DIR}) add_library(${PROJECT_NAME} ${SRC}) omim_add_test_subdirectory(indexer_tests_support) -#omim_add_test_subdirectory(indexer_tests) +omim_add_test_subdirectory(indexer_tests) diff --git a/indexer/indexer_tests/CMakeLists.txt b/indexer/indexer_tests/CMakeLists.txt new file mode 100644 index 0000000000..e2d1f2eef4 --- /dev/null +++ b/indexer/indexer_tests/CMakeLists.txt @@ -0,0 +1,71 @@ +project(indexer_tests) + +set( + SRC + banners_test.cpp + categories_test.cpp + cell_coverer_test.cpp + cell_id_test.cpp + centers_table_test.cpp + checker_test.cpp + drules_selector_parser_test.cpp + editable_map_object_test.cpp + feature_metadata_test.cpp + feature_names_test.cpp + feature_xml_test.cpp + features_offsets_table_test.cpp + features_vector_test.cpp + geometry_coding_test.cpp + geometry_serialization_test.cpp + index_builder_test.cpp + index_test.cpp + interval_index_test.cpp + mwm_set_test.cpp + osm_editor_test.cpp + osm_editor_test.hpp + point_to_int64_test.cpp + postcodes_matcher_tests.cpp + rank_table_test.cpp + scales_test.cpp + search_string_utils_test.cpp + sort_and_merge_intervals_test.cpp + string_slice_tests.cpp + succinct_trie_test.cpp + test_mwm_set.hpp + test_polylines.cpp + test_polylines.hpp + test_type.cpp + trie_test.cpp + visibility_test.cpp +) + +omim_add_test(${PROJECT_NAME} ${SRC}) + +omim_link_libraries( + ${PROJECT_NAME} + generator_tests_support + search_tests_support + indexer_tests_support + platform_tests_support + generator + search + routing + indexer + storage + editor + platform + coding + geometry + base + stats_client + jansson + tess2 + protobuf + succinct + opening_hours + oauthcpp + pugixml + ${LIBZ} +) + +link_qt5_core(${PROJECT_NAME}) diff --git a/map/CMakeLists.txt b/map/CMakeLists.txt index ede7c4daf7..9085909490 100644 --- a/map/CMakeLists.txt +++ b/map/CMakeLists.txt @@ -59,10 +59,6 @@ set( add_library(${PROJECT_NAME} ${SRC}) -if (NOT PLATFORM_IPHONE AND NOT PLATFORM_ANDROID) - include_directories( - ${Qt5OpenGL_LIBRARIES} - ) -endif() - +omim_add_test_subdirectory(map_tests) omim_add_test_subdirectory(mwm_tests) +omim_add_test_subdirectory(style_tests) diff --git a/map/map_tests/CMakeLists.txt b/map/map_tests/CMakeLists.txt new file mode 100644 index 0000000000..2be098cdb2 --- /dev/null +++ b/map/map_tests/CMakeLists.txt @@ -0,0 +1,61 @@ +project(map_tests) + +add_definitions("-DOMIM_UNIT_TEST_WITH_QT_EVENT_LOOP") + +set( + SRC + address_tests.cpp + bookmarks_test.cpp + chart_generator_tests.cpp + feature_getters_tests.cpp + ge0_parser_tests.cpp + geourl_test.cpp + gps_track_collection_test.cpp + gps_track_storage_test.cpp + gps_track_test.cpp + kmz_unarchive_test.cpp + mwm_url_tests.cpp + working_time_tests.cpp +) + +omim_add_test(${PROJECT_NAME} ${SRC}) + +omim_link_libraries( + ${PROJECT_NAME} + map + drape_frontend + routing + traffic + search + storage + tracking + drape + indexer + partners_api + platform + editor + geometry + coding + base + freetype + fribidi + expat + protobuf + jansson + osrm + stats_client + minizip + succinct + pugixml + stats_client + opening_hours + oauthcpp + drape_frontend + drape + ${Qt5Widgets_LIBRARIES} + ${Qt5Network_LIBRARIES} + ${LIBZ} +) + +link_opengl(${PROJECT_NAME}) +link_qt5_core(${PROJECT_NAME}) diff --git a/map/mwm_tests/CMakeLists.txt b/map/mwm_tests/CMakeLists.txt index 3bda28ff74..4c7f3d50e7 100644 --- a/map/mwm_tests/CMakeLists.txt +++ b/map/mwm_tests/CMakeLists.txt @@ -34,11 +34,12 @@ omim_link_libraries( succinct pugixml stats_client - ${Qt5Core_LIBRARIES} - ${Qt5OpenGL_LIBRARIES} ${LIBZ} ) +link_qt5_core(${PROJECT_NAME}) +link_opengl(${PROJECT_NAME}) + if (PLATFORM_MAC) omim_link_libraries( ${PROJECT_NAME} diff --git a/map/style_tests/CMakeLists.txt b/map/style_tests/CMakeLists.txt new file mode 100644 index 0000000000..431c6af4c4 --- /dev/null +++ b/map/style_tests/CMakeLists.txt @@ -0,0 +1,36 @@ +project(style_tests) + +include_directories(${OMIM_ROOT}/3party/protobuf/src) + +set( + SRC + classificator_tests.cpp + dashes_test.cpp + helpers.hpp + style_symbols_consistency_test.cpp +) + +omim_add_test(${PROJECT_NAME} ${SRC}) + +omim_link_libraries( + ${PROJECT_NAME} + expat + map + traffic + indexer + osrm + pugixml + opening_hours + editor + oauthcpp + platform + jansson + geometry + coding + base + protobuf + stats_client + ${LIBZ} +) + +link_qt5_core(${PROJECT_NAME}) diff --git a/partners_api/partners_api_tests/CMakeLists.txt b/partners_api/partners_api_tests/CMakeLists.txt index 2a35a1d0ae..ee7d699fcc 100644 --- a/partners_api/partners_api_tests/CMakeLists.txt +++ b/partners_api/partners_api_tests/CMakeLists.txt @@ -19,7 +19,8 @@ omim_link_libraries( jansson stats_client ${LIBZ} - ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ) + +link_qt5_core(${PROJECT_NAME}) diff --git a/qt/CMakeLists.txt b/qt/CMakeLists.txt index ee73753c9a..6c9deed978 100644 --- a/qt/CMakeLists.txt +++ b/qt/CMakeLists.txt @@ -80,22 +80,21 @@ omim_link_libraries( pugixml oauthcpp opening_hours - ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${LIBZ} ) +link_qt5_core(${PROJECT_NAME}) + if (PLATFORM_MAC) target_link_libraries( ${PROJECT_NAME} "-framework Foundation" "-framework CoreLocation" "-framework CoreWLAN" - "-framework IOKit" "-framework SystemConfiguration" - "-framework OpenGL" "-framework CFNetwork" ) @@ -106,9 +105,8 @@ if (PLATFORM_MAC) ) endif() -if (PLATFORM_LINUX) - target_link_libraries(${PROJECT_NAME} ${OPENGL_gl_LIBRARY}) -endif() +link_opengl(${PROJECT_NAME}) +link_qt5_core(${PROJECT_NAME}) function(copy_resources) set(files "") diff --git a/routing/CMakeLists.txt b/routing/CMakeLists.txt index 4c8b0b7f01..81ab41d70a 100644 --- a/routing/CMakeLists.txt +++ b/routing/CMakeLists.txt @@ -119,5 +119,4 @@ set( add_library(${PROJECT_NAME} ${SRC}) omim_add_test_subdirectory(routing_tests) omim_add_test_subdirectory(routing_integration_tests) - - +omim_add_test_subdirectory(routing_consistency_tests) diff --git a/routing/routing_consistency_tests/CMakeLists.txt b/routing/routing_consistency_tests/CMakeLists.txt new file mode 100644 index 0000000000..f2f9646039 --- /dev/null +++ b/routing/routing_consistency_tests/CMakeLists.txt @@ -0,0 +1,44 @@ +# This subproject implements routing consistency tests. +# This tests are launched on the whole world dataset. + +project(routing_consistency_tests) + +include_directories(${OMIM_ROOT}/3party/gflags/src) + +set( + SRC + ../routing_integration_tests/routing_test_tools.cpp + routing_consistency_tests.cpp +) + +# Not using omim_add_test because we don't need testingmain.cpp +add_executable(${PROJECT_NAME} ${SRC}) + +omim_link_libraries( + ${PROJECT_NAME} + map + routing + traffic + search + storage + indexer + platform + editor + geometry + oauthcpp + opening_hours + coding + base + osrm + jansson + protobuf + succinct + stats_client + generator + gflags + pugixml + ${Qt5Widgets_LIBRARIES} + ${LIBZ} +) + +link_qt5_core(${PROJECT_NAME}) diff --git a/routing/routing_integration_tests/CMakeLists.txt b/routing/routing_integration_tests/CMakeLists.txt index 06af5bed55..cbf75f285e 100644 --- a/routing/routing_integration_tests/CMakeLists.txt +++ b/routing/routing_integration_tests/CMakeLists.txt @@ -45,6 +45,7 @@ omim_link_libraries( stats_client pugixml opening_hours - ${Qt5Core_LIBRARIES} ${LIBZ} ) + +link_qt5_core(${PROJECT_NAME}) diff --git a/routing/routing_tests/CMakeLists.txt b/routing/routing_tests/CMakeLists.txt index c8631e638c..ba0ae9da55 100644 --- a/routing/routing_tests/CMakeLists.txt +++ b/routing/routing_tests/CMakeLists.txt @@ -48,6 +48,7 @@ omim_link_libraries( map pugixml stats_client - ${Qt5Core_LIBRARIES} ${LIBZ} ) + +link_qt5_core(${PROJECT_NAME}) diff --git a/search/search_integration_tests/CMakeLists.txt b/search/search_integration_tests/CMakeLists.txt index 1d5d5ee789..1b69474920 100644 --- a/search/search_integration_tests/CMakeLists.txt +++ b/search/search_integration_tests/CMakeLists.txt @@ -38,7 +38,8 @@ omim_link_libraries( succinct pugixml opening_hours - ${Qt5Core_LIBRARIES} ${Qt5Network_LIBRARIES} ${LIBZ} ) + +link_qt5_core(${PROJECT_NAME}) diff --git a/search/search_tests/CMakeLists.txt b/search/search_tests/CMakeLists.txt index b57100bbe3..c1ab94d91f 100644 --- a/search/search_tests/CMakeLists.txt +++ b/search/search_tests/CMakeLists.txt @@ -40,6 +40,7 @@ omim_link_libraries( succinct pugixml stats_client - ${Qt5Core_LIBRARIES} ${LIBZ} ) + +link_qt5_core(${PROJECT_NAME}) diff --git a/storage/CMakeLists.txt b/storage/CMakeLists.txt index f29eec17e7..1048cd0ff3 100644 --- a/storage/CMakeLists.txt +++ b/storage/CMakeLists.txt @@ -35,4 +35,5 @@ set( add_library(${PROJECT_NAME} ${SRC}) -#add_subdirectory(storage_tests) +omim_add_test_subdirectory(storage_tests) +omim_add_test_subdirectory(storage_integration_tests) diff --git a/storage/storage_integration_tests/CMakeLists.txt b/storage/storage_integration_tests/CMakeLists.txt new file mode 100644 index 0000000000..cbabeadde9 --- /dev/null +++ b/storage/storage_integration_tests/CMakeLists.txt @@ -0,0 +1,56 @@ +project(storage_integration_tests) + +include_directories(${OMIM_ROOT}/3party/glm) +add_definitions("-DOMIM_UNIT_TEST_WITH_QT_EVENT_LOOP") + +set( + SRC + migrate_tests.cpp + storage_3levels_tests.cpp + storage_downloading_tests.cpp + storage_group_download_tests.cpp + storage_http_tests.cpp + storage_update_tests.cpp + test_defines.cpp + test_defines.hpp +) + +omim_add_test(${PROJECT_NAME} ${SRC}) + +omim_link_libraries( + ${PROJECT_NAME} + map + drape_frontend + routing + search + storage + tracking + traffic + indexer + drape + partners_api + platform_tests_support + platform + editor + opening_hours + geometry + coding + base + freetype + expat + fribidi + jansson + protobuf + osrm + stats_client + minizip + succinct + pugixml + oauthcpp + ${Qt5Widgets_LIBRARIES} + ${Qt5Network_LIBRARIES} + ${LIBZ} +) + +link_opengl(${PROJECT_NAME}) +link_qt5_core(${PROJECT_NAME}) diff --git a/storage/storage_tests/CMakeLists.txt b/storage/storage_tests/CMakeLists.txt new file mode 100644 index 0000000000..cce948625e --- /dev/null +++ b/storage/storage_tests/CMakeLists.txt @@ -0,0 +1,60 @@ +project(storage_tests) + +add_definitions("-DOMIM_UNIT_TEST_WITH_QT_EVENT_LOOP") + +set( + SRC + country_info_getter_test.cpp + country_name_getter_test.cpp + fake_map_files_downloader.cpp + fake_map_files_downloader.hpp + helpers.cpp + helpers.hpp + queued_country_tests.cpp + simple_tree_test.cpp + storage_tests.cpp + task_runner.cpp + task_runner.hpp + test_map_files_downloader.cpp + test_map_files_downloader.hpp +) + +omim_add_test(${PROJECT_NAME} ${SRC}) + +omim_link_libraries( + ${PROJECT_NAME} + drape_frontend + map + traffic + storage + drape + generator_tests_support + generator + search + routing + indexer + platform_tests_support + osrm + editor + oauthcpp + platform + opening_hours + geometry + coding + base + freetype + expat + fribidi + jansson + tess2 + protobuf + stats_client + minizip + succinct + pugixml + ${Qt5Widgets_LIBRARIES} + ${Qt5Network_LIBRARIES} + ${LIBZ} +) + +link_qt5_core(${PROJECT_NAME}) diff --git a/tools/autobuild/ios_cmake.sh b/tools/autobuild/ios_cmake.sh index 919278f980..dbd683a66d 100755 --- a/tools/autobuild/ios_cmake.sh +++ b/tools/autobuild/ios_cmake.sh @@ -37,7 +37,7 @@ BuildCmake() { cd "$SHADOW_DIR" pwd echo "Launching cmake..." - CC=$CC CXX=$CXX cmake -r "$BUILD_TYPE" -DCMAKE_OSX_ARCHITECTURES=$ARCH -DNO_TESTS=TRUE -DPLATFORM=$PLATFORM "$MY_PATH/../.." + CC=$CC CXX=$CXX cmake -r "$BUILD_TYPE" -DCMAKE_OSX_ARCHITECTURES=$ARCH -DSKIP_TESTS=TRUE -DSKIP_DESKTOP=TRUE -DPLATFORM=$PLATFORM "$MY_PATH/../.." # make clean > /dev/null || true make -j $(GetCPUCores) VERBOSE=1 ) diff --git a/traffic/traffic_tests/CMakeLists.txt b/traffic/traffic_tests/CMakeLists.txt index 77087588a7..78b1606216 100644 --- a/traffic/traffic_tests/CMakeLists.txt +++ b/traffic/traffic_tests/CMakeLists.txt @@ -27,7 +27,6 @@ omim_link_libraries( base stats_client jansson - ${Qt5Core_LIBRARIES} ${LIBZ} ) @@ -44,3 +43,5 @@ if (PLATFORM_WIN OR PLATFORM_LINUX) ${Qt5Network_LIBRARIES} ) endif() + +link_qt5_core(${PROJECT_NAME})