File tree Expand file tree Collapse file tree 3 files changed +42
-15
lines changed Expand file tree Collapse file tree 3 files changed +42
-15
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,13 @@ set(CMAKE_CXX_STANDARD 14)
4
4
set (CMAKE_STANDARD_REQUIRED ON )
5
5
6
6
include (${CMAKE_BINARY_DIR} /conanbuildinfo.cmake )
7
- conan_basic_setup ()
7
+ conan_set_find_paths ()
8
8
9
- find_package (QtBasemapPlugin )
9
+ find_package (Qt5 COMPONENTS
10
+ Core
11
+ Location
12
+ REQUIRED QUIET )
13
+ find_package (QtBasemapPlugin REQUIRED QUIET )
10
14
11
15
add_executable (example example.cpp )
12
16
get_property (_libFileName TARGET qtgeoservices_basemap_pix4d PROPERTY IMPORTED_LOCATION_RELEASE )
@@ -24,17 +28,20 @@ else()
24
28
endif ()
25
29
26
30
set (DEPLOY_TARGET ${CMAKE_BINARY_DIR} )
27
- set (MAP_PLUGIN_DESTINATION ${DEPLOY_TARGET} /Plugins /geoservices )
31
+ set (MAP_PLUGIN_DESTINATION ${DEPLOY_TARGET} /plugins /geoservices )
28
32
set (MAP_PLUGIN ${_libFileName} )
29
33
30
34
message (STATUS "Map plugin path ${MAP_PLUGIN} " )
31
35
32
36
file (MAKE_DIRECTORY ${MAP_PLUGIN_DESTINATION} )
33
37
file (COPY ${MAP_PLUGIN} DESTINATION ${MAP_PLUGIN_DESTINATION} )
34
38
35
-
39
+ target_link_libraries (example PRIVATE
40
+ Qt5::Core
41
+ Qt5::Location
42
+ )
36
43
# don't link with it because this is needed only by the Qt runtime to give a full path to the folder containing it
37
44
#target_link_libraries(example PRIVATE
38
45
# qtgeoservices_basemap_pix4d
39
46
#)
40
-
47
+
Original file line number Diff line number Diff line change @@ -6,15 +6,13 @@ class QtBasemapPluginTestConan(ConanFile):
6
6
generators = 'cmake'
7
7
8
8
def build (self ):
9
- cmake = CMake (self )
10
- cmake .configure (source_dir = self . conanfile_directory , build_dir = './' )
9
+ cmake = CMake (self , parallel = True )
10
+ cmake .configure (build_dir = './' )
11
11
cmake .build ()
12
+ # Note: Not running from the install target to avoid packaging qt properly
12
13
13
- def imports (self ):
14
- self .copy ('*.dll' , dst = 'bin' , src = 'x64/vc15/bin' )
15
- self .copy ('*.dylib*' , dst = 'lib' , src = 'lib' )
16
- self .copy ('*.so*' , dst = 'bin' , src = 'lib' )
14
+ def requirements (self ):
15
+ self .requires ('Qt5/[5.12.7-2]@pix4d/stable' )
17
16
18
17
def test (self ):
19
- os .chdir ('bin' )
20
- self .run ('.%sexample' % os .sep )
18
+ self .run (os .path .join ('bin' , 'example' ))
Original file line number Diff line number Diff line change 1
- int main () {
2
- return 0 ;
1
+ #include < QCoreApplication>
2
+ #include < QGeoServiceProvider>
3
+
4
+ #include < iostream>
5
+
6
+ int main (int argc, char * argv[])
7
+ {
8
+ QCoreApplication app (argc, argv);
9
+ QCoreApplication::addLibraryPath (QCoreApplication::applicationDirPath () + " /plugins" );
10
+ if (!QGeoServiceProvider::availableServiceProviders ().contains (QStringLiteral (" basemap_pix4d" ), Qt::CaseInsensitive))
11
+ {
12
+ std::cout << " ERROR locating plugin!" << std::endl;
13
+ return EXIT_FAILURE;
14
+ }
15
+
16
+ QGeoServiceProvider plugin (" basemap_pix4d" );
17
+ if (plugin.error ())
18
+ {
19
+ std::cout << " ERROR loading plugin!" << std::endl;
20
+ return EXIT_FAILURE;
21
+ }
22
+
23
+ std::cout << " Plugin available" << std::endl;
24
+ return EXIT_SUCCESS;
3
25
}
You can’t perform that action at this time.
0 commit comments