[build] move default_styles to platform/default
This commit is contained in:
@@ -61,7 +61,11 @@ static_assert(mbgl::util::default_styles::currentVersion == MGLStyleDefaultVersi
|
||||
} \
|
||||
\
|
||||
+ (NSURL *)name##StyleURL##WithVersion:(NSInteger)version { \
|
||||
return [NSURL URLWithString:[@"mapbox://styles/mapbox/" #fileName "-v" stringByAppendingFormat:@"%li", (long)version]]; \
|
||||
if (mbgl::util::default_styles::currentVersion == version) { \
|
||||
return [NSURL URLWithString:@(mbgl::util::default_styles::name.url)]; \
|
||||
} else { \
|
||||
return [NSURL URLWithString:[@"mapbox://styles/mapbox/" #fileName "-v" stringByAppendingFormat:@"%li", (long)version]]; \
|
||||
} \
|
||||
}
|
||||
|
||||
MGL_DEFINE_STYLE(streets, streets)
|
||||
|
||||
16
platform/default/mbgl/util/default_styles.cpp
Normal file
16
platform/default/mbgl/util/default_styles.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <mbgl/util/default_styles.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace util {
|
||||
namespace default_styles {
|
||||
|
||||
const DefaultStyle streets = { "mapbox://styles/mapbox/streets-v9", "Streets" };
|
||||
const DefaultStyle outdoors = { "mapbox://styles/mapbox/outdoors-v9", "Outdoors" };
|
||||
const DefaultStyle light = { "mapbox://styles/mapbox/light-v9", "Light" };
|
||||
const DefaultStyle dark = { "mapbox://styles/mapbox/dark-v9", "Dark" };
|
||||
const DefaultStyle satellite = { "mapbox://styles/mapbox/satellite-v9", "Satellite" };
|
||||
const DefaultStyle satelliteStreets = { "mapbox://styles/mapbox/satellite-streets-v9", "Satellite Streets" };
|
||||
|
||||
} // namespace default_styles
|
||||
} // end namespace util
|
||||
} // end namespace mbgl
|
||||
31
platform/default/mbgl/util/default_styles.hpp
Normal file
31
platform/default/mbgl/util/default_styles.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace mbgl {
|
||||
namespace util {
|
||||
namespace default_styles {
|
||||
|
||||
struct DefaultStyle {
|
||||
const char* url;
|
||||
const char* name;
|
||||
};
|
||||
|
||||
extern const DefaultStyle streets;
|
||||
extern const DefaultStyle outdoors;
|
||||
extern const DefaultStyle light;
|
||||
extern const DefaultStyle dark;
|
||||
extern const DefaultStyle satellite;
|
||||
extern const DefaultStyle satelliteStreets;
|
||||
|
||||
const DefaultStyle orderedStyles[] = {
|
||||
streets, outdoors, light, dark, satellite, satelliteStreets,
|
||||
};
|
||||
const size_t numOrderedStyles = sizeof(orderedStyles) / sizeof(DefaultStyle);
|
||||
|
||||
static const unsigned currentVersion = 9;
|
||||
|
||||
} // end namespace default_styles
|
||||
} // end namespace util
|
||||
} // end namespace mbgl
|
||||
@@ -18,6 +18,10 @@ macro(mbgl_platform_core)
|
||||
PRIVATE platform/default/local_file_source.cpp
|
||||
PRIVATE platform/default/online_file_source.cpp
|
||||
|
||||
# Default styles
|
||||
PRIVATE platform/default/mbgl/util/default_styles.hpp
|
||||
PRIVATE platform/default/mbgl/util/default_styles.cpp
|
||||
|
||||
# Offline
|
||||
PRIVATE platform/default/mbgl/storage/offline.cpp
|
||||
PRIVATE platform/default/mbgl/storage/offline_database.cpp
|
||||
@@ -62,7 +66,7 @@ macro(mbgl_platform_core)
|
||||
|
||||
target_include_directories(mbgl-core
|
||||
PUBLIC platform/darwin
|
||||
PRIVATE platform/default
|
||||
PUBLIC platform/default
|
||||
)
|
||||
|
||||
target_link_libraries(mbgl-core
|
||||
|
||||
@@ -18,6 +18,10 @@ macro(mbgl_platform_core)
|
||||
PRIVATE platform/default/local_file_source.cpp
|
||||
PRIVATE platform/default/online_file_source.cpp
|
||||
|
||||
# Default styles
|
||||
PRIVATE platform/default/mbgl/util/default_styles.hpp
|
||||
PRIVATE platform/default/mbgl/util/default_styles.cpp
|
||||
|
||||
# Offline
|
||||
PRIVATE platform/default/mbgl/storage/offline.cpp
|
||||
PRIVATE platform/default/mbgl/storage/offline_database.cpp
|
||||
@@ -55,7 +59,7 @@ macro(mbgl_platform_core)
|
||||
|
||||
target_include_directories(mbgl-core
|
||||
PUBLIC platform/darwin
|
||||
PRIVATE platform/default
|
||||
PUBLIC platform/default
|
||||
)
|
||||
|
||||
target_link_libraries(mbgl-core
|
||||
|
||||
@@ -15,7 +15,7 @@ macro(mbgl_platform_core)
|
||||
)
|
||||
|
||||
target_include_directories(mbgl-core
|
||||
PRIVATE platform/default
|
||||
PUBLIC platform/default
|
||||
PRIVATE platform/qt/include
|
||||
)
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ add_library(qmapboxgl SHARED
|
||||
platform/qt/src/qmapbox.cpp
|
||||
platform/qt/src/qmapboxgl.cpp
|
||||
platform/qt/src/qmapboxgl_p.hpp
|
||||
platform/default/mbgl/util/default_styles.hpp
|
||||
platform/default/mbgl/util/default_styles.cpp
|
||||
)
|
||||
|
||||
# C++ app
|
||||
|
||||
Reference in New Issue
Block a user