mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 04:53:36 +00:00
[platform] Separete the location_service lib
Signed-off-by: Ferenc Géczi <ferenc.gm@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
c7aacb3b64
commit
5110867b38
@@ -82,25 +82,9 @@ function(omim_add_pybindings_subdirectory subdir)
|
|||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(omim_link_platform_deps target)
|
|
||||||
if ("${ARGN}" MATCHES "platform")
|
|
||||||
if (PLATFORM_MAC)
|
|
||||||
target_link_libraries(
|
|
||||||
${target}
|
|
||||||
"-framework CFNetwork"
|
|
||||||
"-framework Foundation"
|
|
||||||
"-framework IOKit"
|
|
||||||
"-framework SystemConfiguration"
|
|
||||||
"-framework Security"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(omim_link_libraries target)
|
function(omim_link_libraries target)
|
||||||
if (TARGET ${target})
|
if (TARGET ${target})
|
||||||
target_link_libraries(${target} ${ARGN} ${CMAKE_THREAD_LIBS_INIT})
|
target_link_libraries(${target} ${ARGN} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
omim_link_platform_deps(${target} ${ARGN})
|
|
||||||
else()
|
else()
|
||||||
message("~> Skipping linking the libraries to the target ${target} as it"
|
message("~> Skipping linking the libraries to the target ${target} as it"
|
||||||
" does not exist")
|
" does not exist")
|
||||||
|
|||||||
@@ -65,19 +65,6 @@ set(SRC
|
|||||||
utm_mgrs_utils.hpp
|
utm_mgrs_utils.hpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NOT SKIP_QT_GUI AND PLATFORM_DESKTOP AND PLATFORM_LINUX)
|
|
||||||
message("Building with Qt Positioning")
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Positioning)
|
|
||||||
set(QT_POSITIONING true)
|
|
||||||
append(SRC
|
|
||||||
qt_location_service.hpp
|
|
||||||
qt_location_service.cpp
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
message("Building without Qt Positioning")
|
|
||||||
set(QT_POSITIONING false)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (PLATFORM_IPHONE)
|
if (PLATFORM_IPHONE)
|
||||||
append(SRC
|
append(SRC
|
||||||
background_downloader_ios.h
|
background_downloader_ios.h
|
||||||
@@ -127,8 +114,6 @@ else() # neither iPhone nor Android
|
|||||||
|
|
||||||
append(SRC
|
append(SRC
|
||||||
localization_dummy.cpp
|
localization_dummy.cpp
|
||||||
location_service.cpp
|
|
||||||
location_service.hpp
|
|
||||||
network_policy_dummy.cpp
|
network_policy_dummy.cpp
|
||||||
platform_qt.cpp
|
platform_qt.cpp
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/platform_qt_version.cpp"
|
"${CMAKE_CURRENT_BINARY_DIR}/platform_qt_version.cpp"
|
||||||
@@ -148,7 +133,6 @@ else() # neither iPhone nor Android
|
|||||||
)
|
)
|
||||||
elseif(${PLATFORM_MAC})
|
elseif(${PLATFORM_MAC})
|
||||||
append(SRC
|
append(SRC
|
||||||
apple_location_service.mm
|
|
||||||
gui_thread_apple.mm
|
gui_thread_apple.mm
|
||||||
http_client_apple.mm
|
http_client_apple.mm
|
||||||
http_thread_apple.h
|
http_thread_apple.h
|
||||||
@@ -181,9 +165,6 @@ else() # neither iPhone nor Android
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
omim_add_library(${PROJECT_NAME} ${SRC})
|
omim_add_library(${PROJECT_NAME} ${SRC})
|
||||||
if (QT_POSITIONING)
|
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE "QT_LOCATION_SERVICE")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE -fobjc-arc -Wno-nullability-completeness)
|
target_compile_options(${PROJECT_NAME} PRIVATE -fobjc-arc -Wno-nullability-completeness)
|
||||||
@@ -199,11 +180,9 @@ target_link_libraries(${PROJECT_NAME}
|
|||||||
$<$<BOOL:${PLATFORM_DESKTOP}>:Qt6::Core>
|
$<$<BOOL:${PLATFORM_DESKTOP}>:Qt6::Core>
|
||||||
$<$<BOOL:${PLATFORM_LINUX}>:Qt6::Network>
|
$<$<BOOL:${PLATFORM_LINUX}>:Qt6::Network>
|
||||||
$<$<BOOL:${PLATFORM_WIN}>:Qt6::Network>
|
$<$<BOOL:${PLATFORM_WIN}>:Qt6::Network>
|
||||||
$<$<BOOL:${QT_POSITIONING}>:Qt6::Positioning>
|
|
||||||
$<$<BOOL:${PLATFORM_MAC}>:
|
$<$<BOOL:${PLATFORM_MAC}>:
|
||||||
-framework\ Foundation
|
-framework\ Foundation
|
||||||
-framework\ SystemConfiguration
|
-framework\ SystemConfiguration
|
||||||
-framework\ CoreLocation
|
|
||||||
-framework\ CFNetwork
|
-framework\ CFNetwork
|
||||||
-framework\ Security # SecPKCS12Import
|
-framework\ Security # SecPKCS12Import
|
||||||
>
|
>
|
||||||
@@ -211,6 +190,9 @@ target_link_libraries(${PROJECT_NAME}
|
|||||||
|
|
||||||
omim_add_test_subdirectory(platform_tests_support)
|
omim_add_test_subdirectory(platform_tests_support)
|
||||||
omim_add_test_subdirectory(platform_tests)
|
omim_add_test_subdirectory(platform_tests)
|
||||||
|
if (NOT SKIP_QT_GUI)
|
||||||
|
add_subdirectory(location_service)
|
||||||
|
endif()
|
||||||
|
|
||||||
# strings::UniChar clashes with Apple's definition.
|
# strings::UniChar clashes with Apple's definition.
|
||||||
set_property(SOURCE preferred_languages.cpp PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)
|
set_property(SOURCE preferred_languages.cpp PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)
|
||||||
|
|||||||
29
platform/location_service/CMakeLists.txt
Normal file
29
platform/location_service/CMakeLists.txt
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
project(location_service)
|
||||||
|
|
||||||
|
if (NOT SKIP_QT_GUI AND PLATFORM_DESKTOP AND PLATFORM_LINUX)
|
||||||
|
message("Building with Qt Positioning")
|
||||||
|
find_package(Qt6 REQUIRED COMPONENTS Positioning)
|
||||||
|
set(QT_LOCATION_SERVICE true)
|
||||||
|
elseif(NOT SKIP_QT_GUI AND PLATFORM_DESKTOP AND PLATFORM_MAC)
|
||||||
|
set(APPLE_LOCATION_SERVICE true)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(SRC
|
||||||
|
location_service.cpp
|
||||||
|
location_service.hpp
|
||||||
|
$<$<BOOL:${APPLE_LOCATION_SERVICE}>:apple_location_service.mm>
|
||||||
|
$<$<BOOL:${QT_LOCATION_SERVICE}>:qt_location_service.hpp>
|
||||||
|
$<$<BOOL:${QT_LOCATION_SERVICE}>:qt_location_service.cpp>
|
||||||
|
)
|
||||||
|
|
||||||
|
omim_add_library(${PROJECT_NAME} ${SRC})
|
||||||
|
|
||||||
|
if (QT_LOCATION_SERVICE)
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE "QT_LOCATION_SERVICE")
|
||||||
|
target_link_libraries(${PROJECT_NAME} Qt6::Positioning)
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES AUTOMOC ON)
|
||||||
|
elseif(APPLE_LOCATION_SERVICE)
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE "APPLE_LOCATION_SERVICE")
|
||||||
|
target_compile_options(${PROJECT_NAME} PRIVATE -fobjc-arc -Wno-nullability-completeness)
|
||||||
|
target_link_libraries(${PROJECT_NAME} -framework\ CoreLocation)
|
||||||
|
endif()
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "platform/location_service.hpp"
|
#include "platform/location_service/location_service.hpp"
|
||||||
|
|
||||||
#include "base/logging.hpp"
|
#include "base/logging.hpp"
|
||||||
#include "base/macros.hpp"
|
#include "base/macros.hpp"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "platform/location_service.hpp"
|
#include "platform/location_service/location_service.hpp"
|
||||||
|
|
||||||
#include "std/target_os.hpp"
|
#include "std/target_os.hpp"
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ public:
|
|||||||
#if defined(OMIM_OS_LINUX)
|
#if defined(OMIM_OS_LINUX)
|
||||||
m_services.push_back(CreateQtLocationService(*this, "geoclue2"));
|
m_services.push_back(CreateQtLocationService(*this, "geoclue2"));
|
||||||
#endif // OMIM_OS_LINUX
|
#endif // OMIM_OS_LINUX
|
||||||
#elif defined(OMIM_OS_MAC) // No QT_LOCATION_SERVICE
|
#elif defined(APPLE_LOCATION_SERVICE) // No QT_LOCATION_SERVICE
|
||||||
m_services.push_back(CreateAppleLocationService(*this));
|
m_services.push_back(CreateAppleLocationService(*this));
|
||||||
#endif // QT_LOCATION_SERVICE
|
#endif // QT_LOCATION_SERVICE
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "platform/qt_location_service.hpp"
|
#include "platform/location_service/qt_location_service.hpp"
|
||||||
|
|
||||||
#include "base/logging.hpp"
|
#include "base/logging.hpp"
|
||||||
#include "base/macros.hpp"
|
#include "base/macros.hpp"
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "platform/location_service.hpp"
|
#include "platform/location_service/location_service.hpp"
|
||||||
|
|
||||||
#include <QGeoPositionInfoSource>
|
#include <QGeoPositionInfoSource>
|
||||||
|
|
||||||
@@ -70,6 +70,7 @@ target_link_libraries(${PROJECT_NAME}
|
|||||||
qt_common
|
qt_common
|
||||||
map
|
map
|
||||||
gflags::gflags
|
gflags::gflags
|
||||||
|
location_service
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BUILD_DESIGNER)
|
if (BUILD_DESIGNER)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "storage/storage_defines.hpp"
|
#include "storage/storage_defines.hpp"
|
||||||
|
|
||||||
#include "platform/location.hpp"
|
#include "platform/location.hpp"
|
||||||
#include "platform/location_service.hpp"
|
#include "platform/location_service/location_service.hpp"
|
||||||
|
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
#include <QtWidgets/QMainWindow>
|
#include <QtWidgets/QMainWindow>
|
||||||
|
|||||||
@@ -65,7 +65,6 @@
|
|||||||
675341261C58C616002CF0D9 /* scoped_file.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675340F71C58C4B3002CF0D9 /* scoped_file.hpp */; };
|
675341261C58C616002CF0D9 /* scoped_file.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675340F71C58C4B3002CF0D9 /* scoped_file.hpp */; };
|
||||||
675341271C58C61D002CF0D9 /* scoped_dir.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675340F51C58C4B3002CF0D9 /* scoped_dir.hpp */; };
|
675341271C58C61D002CF0D9 /* scoped_dir.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675340F51C58C4B3002CF0D9 /* scoped_dir.hpp */; };
|
||||||
675341281C58C61D002CF0D9 /* scoped_mwm.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675340F91C58C4B3002CF0D9 /* scoped_mwm.hpp */; };
|
675341281C58C61D002CF0D9 /* scoped_mwm.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675340F91C58C4B3002CF0D9 /* scoped_mwm.hpp */; };
|
||||||
675343B11A3F5D5A00A0A8C3 /* apple_location_service.mm in Sources */ = {isa = PBXBuildFile; fileRef = 675343861A3F5D5900A0A8C3 /* apple_location_service.mm */; };
|
|
||||||
675343B31A3F5D5A00A0A8C3 /* chunks_download_strategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 675343881A3F5D5900A0A8C3 /* chunks_download_strategy.cpp */; };
|
675343B31A3F5D5A00A0A8C3 /* chunks_download_strategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 675343881A3F5D5900A0A8C3 /* chunks_download_strategy.cpp */; };
|
||||||
675343B41A3F5D5A00A0A8C3 /* chunks_download_strategy.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675343891A3F5D5900A0A8C3 /* chunks_download_strategy.hpp */; };
|
675343B41A3F5D5A00A0A8C3 /* chunks_download_strategy.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675343891A3F5D5900A0A8C3 /* chunks_download_strategy.hpp */; };
|
||||||
675343B51A3F5D5A00A0A8C3 /* constants.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6753438A1A3F5D5900A0A8C3 /* constants.hpp */; };
|
675343B51A3F5D5A00A0A8C3 /* constants.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6753438A1A3F5D5900A0A8C3 /* constants.hpp */; };
|
||||||
@@ -74,8 +73,6 @@
|
|||||||
675343B81A3F5D5A00A0A8C3 /* http_thread_apple.h in Headers */ = {isa = PBXBuildFile; fileRef = 6753438D1A3F5D5900A0A8C3 /* http_thread_apple.h */; };
|
675343B81A3F5D5A00A0A8C3 /* http_thread_apple.h in Headers */ = {isa = PBXBuildFile; fileRef = 6753438D1A3F5D5900A0A8C3 /* http_thread_apple.h */; };
|
||||||
675343B91A3F5D5A00A0A8C3 /* http_thread_apple.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6753438E1A3F5D5900A0A8C3 /* http_thread_apple.mm */; };
|
675343B91A3F5D5A00A0A8C3 /* http_thread_apple.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6753438E1A3F5D5900A0A8C3 /* http_thread_apple.mm */; };
|
||||||
675343BA1A3F5D5A00A0A8C3 /* http_thread_callback.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6753438F1A3F5D5A00A0A8C3 /* http_thread_callback.hpp */; };
|
675343BA1A3F5D5A00A0A8C3 /* http_thread_callback.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6753438F1A3F5D5A00A0A8C3 /* http_thread_callback.hpp */; };
|
||||||
675343C01A3F5D5A00A0A8C3 /* location_service.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 675343951A3F5D5A00A0A8C3 /* location_service.cpp */; };
|
|
||||||
675343C11A3F5D5A00A0A8C3 /* location_service.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675343961A3F5D5A00A0A8C3 /* location_service.hpp */; };
|
|
||||||
675343C21A3F5D5A00A0A8C3 /* location.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675343971A3F5D5A00A0A8C3 /* location.hpp */; };
|
675343C21A3F5D5A00A0A8C3 /* location.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675343971A3F5D5A00A0A8C3 /* location.hpp */; };
|
||||||
675343C91A3F5D5A00A0A8C3 /* platform_unix_impl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6753439E1A3F5D5A00A0A8C3 /* platform_unix_impl.cpp */; };
|
675343C91A3F5D5A00A0A8C3 /* platform_unix_impl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6753439E1A3F5D5A00A0A8C3 /* platform_unix_impl.cpp */; };
|
||||||
675343CA1A3F5D5A00A0A8C3 /* platform_unix_impl.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6753439F1A3F5D5A00A0A8C3 /* platform_unix_impl.hpp */; };
|
675343CA1A3F5D5A00A0A8C3 /* platform_unix_impl.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6753439F1A3F5D5A00A0A8C3 /* platform_unix_impl.hpp */; };
|
||||||
@@ -537,7 +534,6 @@
|
|||||||
FADA4B2726F529BD000FF3CA /* locale.hpp in Headers */,
|
FADA4B2726F529BD000FF3CA /* locale.hpp in Headers */,
|
||||||
34C624BE1DABCCD100510300 /* socket.hpp in Headers */,
|
34C624BE1DABCCD100510300 /* socket.hpp in Headers */,
|
||||||
D50B2296238591570056820A /* http_payload.hpp in Headers */,
|
D50B2296238591570056820A /* http_payload.hpp in Headers */,
|
||||||
675343C11A3F5D5A00A0A8C3 /* location_service.hpp in Headers */,
|
|
||||||
ED965B252CD8F72E0049E39E /* duration.hpp in Headers */,
|
ED965B252CD8F72E0049E39E /* duration.hpp in Headers */,
|
||||||
67AB92DD1B7B3D7300AB5194 /* mwm_version.hpp in Headers */,
|
67AB92DD1B7B3D7300AB5194 /* mwm_version.hpp in Headers */,
|
||||||
675343CA1A3F5D5A00A0A8C3 /* platform_unix_impl.hpp in Headers */,
|
675343CA1A3F5D5A00A0A8C3 /* platform_unix_impl.hpp in Headers */,
|
||||||
@@ -735,9 +731,7 @@
|
|||||||
675343B61A3F5D5A00A0A8C3 /* http_request.cpp in Sources */,
|
675343B61A3F5D5A00A0A8C3 /* http_request.cpp in Sources */,
|
||||||
675343CC1A3F5D5A00A0A8C3 /* platform.cpp in Sources */,
|
675343CC1A3F5D5A00A0A8C3 /* platform.cpp in Sources */,
|
||||||
451E32A01F73A8B000964C9F /* secure_storage_ios.mm in Sources */,
|
451E32A01F73A8B000964C9F /* secure_storage_ios.mm in Sources */,
|
||||||
675343B11A3F5D5A00A0A8C3 /* apple_location_service.mm in Sources */,
|
|
||||||
675343B31A3F5D5A00A0A8C3 /* chunks_download_strategy.cpp in Sources */,
|
675343B31A3F5D5A00A0A8C3 /* chunks_download_strategy.cpp in Sources */,
|
||||||
675343C01A3F5D5A00A0A8C3 /* location_service.cpp in Sources */,
|
|
||||||
675343D31A3F5D5A00A0A8C3 /* settings.cpp in Sources */,
|
675343D31A3F5D5A00A0A8C3 /* settings.cpp in Sources */,
|
||||||
675343CE1A3F5D5A00A0A8C3 /* preferred_languages.cpp in Sources */,
|
675343CE1A3F5D5A00A0A8C3 /* preferred_languages.cpp in Sources */,
|
||||||
675343B91A3F5D5A00A0A8C3 /* http_thread_apple.mm in Sources */,
|
675343B91A3F5D5A00A0A8C3 /* http_thread_apple.mm in Sources */,
|
||||||
|
|||||||
Reference in New Issue
Block a user