diff --git a/3party/gflags/CMakeLists.txt b/3party/gflags/CMakeLists.txt index 049e281ac1..c0da7415e3 100644 --- a/3party/gflags/CMakeLists.txt +++ b/3party/gflags/CMakeLists.txt @@ -10,12 +10,6 @@ set( src/gflags/gflags_completions.h src/gflags_completions.cc src/gflags_reporting.cc - src/windows/config.h - src/windows/gflags/gflags.h - src/windows/gflags/gflags_completions.h - src/windows/port.h ) -# if PLATFORM_WINDOWS: src += src/windows/port.cc - add_library(${PROJECT_NAME} ${SRC}) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e200e332d..e3613673bb 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() @@ -148,6 +148,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") @@ -204,6 +235,6 @@ endif() omim_add_test_subdirectory(qt_tstfrm) omim_add_test_subdirectory(3party/gmock) -if (NOT PLATFORM_IPHONE AND NOT PLATFORM_ANDROID AND NOT NO_DESKTOP) +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/generator_tests/CMakeLists.txt b/generator/generator_tests/CMakeLists.txt index c50abd9e5f..0dc12ec937 100644 --- a/generator/generator_tests/CMakeLists.txt +++ b/generator/generator_tests/CMakeLists.txt @@ -32,15 +32,14 @@ omim_link_libraries( platform_tests_support generator drape_frontend + map routing search storage indexer drape - map traffic editor - oauthcpp platform geometry coding @@ -57,17 +56,17 @@ omim_link_libraries( pugixml tess2 gflags + oauthcpp opening_hours ${LIBZ} - ${Qt5Core_LIBRARIES} ) if (PLATFORM_MAC) omim_link_libraries( ${PROJECT_NAME} - "-framework IOKit" - "-framework QuartzCore" "-framework Cocoa" "-framework SystemConfiguration" ) endif() + +link_qt5_core(${PROJECT_NAME}) diff --git a/indexer/indexer_tests/CMakeLists.txt b/indexer/indexer_tests/CMakeLists.txt index 3b7cc28ee4..e2d1f2eef4 100644 --- a/indexer/indexer_tests/CMakeLists.txt +++ b/indexer/indexer_tests/CMakeLists.txt @@ -65,6 +65,7 @@ omim_link_libraries( opening_hours oauthcpp pugixml - ${Qt5Core_LIBRARIES} ${LIBZ} ) + +link_qt5_core(${PROJECT_NAME}) diff --git a/map/CMakeLists.txt b/map/CMakeLists.txt index d89906158f..74fcaa16d3 100644 --- a/map/CMakeLists.txt +++ b/map/CMakeLists.txt @@ -59,12 +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(mwm_tests) omim_add_test_subdirectory(map_tests) omim_add_test_subdirectory(style_tests) diff --git a/map/map_tests/CMakeLists.txt b/map/map_tests/CMakeLists.txt index dc788a4e88..2be098cdb2 100644 --- a/map/map_tests/CMakeLists.txt +++ b/map/map_tests/CMakeLists.txt @@ -15,12 +15,9 @@ set( gps_track_test.cpp kmz_unarchive_test.cpp mwm_url_tests.cpp + working_time_tests.cpp ) -if (NOT PLATFORM_LINUX) - append(SRC working_time_tests.cpp) -endif() - omim_add_test(${PROJECT_NAME} ${SRC}) omim_link_libraries( @@ -55,23 +52,10 @@ omim_link_libraries( oauthcpp drape_frontend drape - ${Qt5Core_LIBRARIES} + ${Qt5Widgets_LIBRARIES} + ${Qt5Network_LIBRARIES} ${LIBZ} ) -if (PLATFORM_MAC) - omim_link_libraries( - ${PROJECT_NAME} - ${Qt5Widgets_LIBRARIES} - "-framework OpenGL" - ) -endif() - - -if (PLATFORM_LINUX) - omim_link_libraries( - ${PROJECT_NAME} - ${Qt5Network_LIBRARIES} - GL - ) -endif() \ No newline at end of file +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 index 4d12f31c23..431c6af4c4 100644 --- a/map/style_tests/CMakeLists.txt +++ b/map/style_tests/CMakeLists.txt @@ -30,6 +30,7 @@ omim_link_libraries( base protobuf stats_client - ${Qt5Core_LIBRARIES} ${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/routing_consistency_tests/CMakeLists.txt b/routing/routing_consistency_tests/CMakeLists.txt index e00bbe7388..f2f9646039 100644 --- a/routing/routing_consistency_tests/CMakeLists.txt +++ b/routing/routing_consistency_tests/CMakeLists.txt @@ -37,14 +37,8 @@ omim_link_libraries( generator gflags pugixml - ${Qt5Core_LIBRARIES} + ${Qt5Widgets_LIBRARIES} ${LIBZ} ) -if (PLATFORM_MAC) - omim_link_libraries( - ${PROJECT_NAME} - ${Qt5Widgets_LIBRARIES} - "-framework IOKit" - ) -endif() +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/storage_integration_tests/CMakeLists.txt b/storage/storage_integration_tests/CMakeLists.txt index 9ff9049741..e581ad41c4 100644 --- a/storage/storage_integration_tests/CMakeLists.txt +++ b/storage/storage_integration_tests/CMakeLists.txt @@ -47,23 +47,11 @@ omim_link_libraries( succinct pugixml oauthcpp - ${Qt5Core_LIBRARIES} + ${Qt5Widgets_LIBRARIES} + ${Qt5Network_LIBRARIES} ${LIBZ} ) -if (PLATFORM_MAC) - omim_link_libraries( - ${PROJECT_NAME} - ${Qt5Widgets_LIBRARIES} - "-framework OpenGL" - ) -endif() +link_opengl(${PROJECT_NAME}) +link_qt5_core(${PROJECT_NAME}) -if(PLATFORM_LINUX) - omim_link_libraries( - ${PROJECT_NAME} - ${Qt5Network_LIBRARIES} - ${Qt5OpenGL_LIBRARIES} - GL - ) -endif() diff --git a/storage/storage_tests/CMakeLists.txt b/storage/storage_tests/CMakeLists.txt index 92f6779b01..cce948625e 100644 --- a/storage/storage_tests/CMakeLists.txt +++ b/storage/storage_tests/CMakeLists.txt @@ -52,20 +52,9 @@ omim_link_libraries( minizip succinct pugixml - ${Qt5Core_LIBRARIES} + ${Qt5Widgets_LIBRARIES} + ${Qt5Network_LIBRARIES} ${LIBZ} ) -if (PLATFORM_MAC) - omim_link_libraries( - ${PROJECT_NAME} - ${Qt5Widgets_LIBRARIES} - ) -endif() - -if(PLATFORM_LINUX) - omim_link_libraries( - ${PROJECT_NAME} - ${Qt5Network_LIBRARIES} - ) -endif() +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})