diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-01-23 16:31:48 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-02-04 10:49:07 +0100 |
commit | 272fa8935ed1e97a7c8a5e6cbd44bb47ac7dc00b (patch) | |
tree | 50b5747dd57680acadb4ab45ad52e075553ec11e | |
parent | fbe30e04c48353a9fdd14151728e27ffe168c9ca (diff) | |
download | qtlocation-mapboxgl-272fa8935ed1e97a7c8a5e6cbd44bb47ac7dc00b.tar.gz |
make storage lib separate so we can build without storage libs
-rw-r--r-- | .gitmodules | 7 | ||||
-rw-r--r-- | Makefile | 4 | ||||
m--------- | app/ios | 0 | ||||
-rw-r--r-- | bin/render.gyp | 8 | ||||
-rw-r--r-- | gyp/common.gypi | 43 | ||||
-rw-r--r-- | gyp/install.gypi | 10 | ||||
-rw-r--r-- | gyp/mbgl-core.gypi | 56 | ||||
-rw-r--r-- | gyp/mbgl-headless.gypi | 5 | ||||
-rw-r--r-- | gyp/mbgl-ios.gypi | 39 | ||||
-rw-r--r-- | gyp/mbgl-linux.gypi | 63 | ||||
-rw-r--r-- | gyp/mbgl-osx.gypi | 40 | ||||
-rw-r--r-- | gyp/mbgl-platform.gypi | 20 | ||||
-rw-r--r-- | gyp/mbgl-storage-cocoa.gypi | 62 | ||||
-rw-r--r-- | gyp/mbgl-storage-curl.gypi | 68 | ||||
-rw-r--r-- | linux/mapboxgl-app.gyp | 51 | ||||
-rw-r--r-- | macosx/mapboxgl-app.gyp | 76 | ||||
-rw-r--r-- | mapboxgl.gyp | 13 | ||||
-rw-r--r-- | mbgl.gyp | 38 | ||||
-rw-r--r-- | platform/default/compression.cpp (renamed from src/mbgl/util/compression.cpp) | 17 | ||||
-rw-r--r-- | platform/default/compression.hpp (renamed from src/mbgl/util/compression.hpp) | 0 | ||||
-rw-r--r-- | platform/default/default_file_source.cpp (renamed from src/mbgl/storage/default_file_source.cpp) | 0 | ||||
-rw-r--r-- | platform/default/sqlite3.cpp (renamed from src/mbgl/util/sqlite3.cpp) | 22 | ||||
-rw-r--r-- | platform/default/sqlite3.hpp (renamed from src/mbgl/util/sqlite3.hpp) | 0 | ||||
-rw-r--r-- | platform/default/sqlite_cache.cpp (renamed from src/mbgl/storage/sqlite_cache.cpp) | 4 | ||||
-rw-r--r-- | src/mbgl/map/map.cpp | 32 | ||||
-rw-r--r-- | test/test.gyp | 7 |
26 files changed, 444 insertions, 241 deletions
diff --git a/.gitmodules b/.gitmodules index 588802377e..9e4f20d0a7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,5 +1,5 @@ -[submodule "ios/mapbox-gl-cocoa"] - path = ios/mapbox-gl-cocoa +[submodule "ios"] + path = ios url = https://github.com/mapbox/mapbox-gl-cocoa.git [submodule "test/suite"] @@ -13,3 +13,6 @@ [submodule "styles"] path = styles url = https://github.com/mapbox/mapbox-gl-styles.git +[submodule "app/ios"] + path = app/ios + url = https://github.com/mapbox/mapbox-gl-cocoa.git @@ -39,8 +39,8 @@ install: build/mbgl/Makefile #### Build scripts ############################################################# .PHONY: build/mbgl/Makefile -build/mbgl/Makefile: mapboxgl.gyp config.gypi - deps/run_gyp mapboxgl.gyp -Iconfig.gypi -Dplatform=$(PLATFORM) -Dinstall_prefix=$(PREFIX) --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make +build/mbgl/Makefile: mbgl.gyp config.gypi + deps/run_gyp mbgl.gyp -Iconfig.gypi -Dplatform=$(PLATFORM) -Dinstall_prefix=$(PREFIX) --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make .PHONY: build/test/Makefile build/test/Makefile: test/test.gyp config.gypi diff --git a/app/ios b/app/ios new file mode 160000 +Subproject 2e5bfbdcd54c893864c263b41a27846627e10f0 diff --git a/bin/render.gyp b/bin/render.gyp index 0a41b02a8f..71b36fba5e 100644 --- a/bin/render.gyp +++ b/bin/render.gyp @@ -44,10 +44,10 @@ ], 'include_dirs': [ '../src' ], 'dependencies': [ - '../mapboxgl.gyp:mbgl-standalone', - '../mapboxgl.gyp:mbgl-headless', - '../mapboxgl.gyp:mbgl-<(platform)', - '../mapboxgl.gyp:copy_certificate_bundle', + '../mbgl.gyp:<(core_library)', + '../mbgl.gyp:<(headless_library)', + '../mbgl.gyp:<(platform_library)', + '../mbgl.gyp:copy_certificate_bundle', ], }, ], diff --git a/gyp/common.gypi b/gyp/common.gypi index 3d3bddb67f..3a2024415f 100644 --- a/gyp/common.gypi +++ b/gyp/common.gypi @@ -1,19 +1,47 @@ { 'variables': { 'install_prefix%': '', - 'standalone_product_dir':'<!@(pwd)/build' + 'standalone_product_dir':'<!@(pwd)/build', + 'core_library%': 'mbgl-core', + 'headless_library%': 'mbgl-headless', }, + 'conditions': [ + ['platform == "osx"', { + 'variables': { + 'platform_library%': 'mbgl-osx', + 'storage_library%': 'mbgl-storage-cocoa', + }, + }], + ['platform == "ios"', { + 'variables': { + 'platform_library%': 'mbgl-ios', + 'storage_library%': 'mbgl-storage-cocoa', + }, + }], + ['platform == "linux"', { + 'variables': { + 'platform_library%': 'mbgl-linux', + 'storage_library%': 'mbgl-storage-curl', + }, + }], + ['platform == "android"', { + 'variables': { + 'platform_library%': 'mbgl-android', + 'storage_library%': 'mbgl-storage-curl', + }, + }], + ], 'target_defaults': { 'default_configuration': 'Release', 'conditions': [ ['OS=="mac"', { 'xcode_settings': { - 'MACOSX_DEPLOYMENT_TARGET':'10.9', + 'MACOSX_DEPLOYMENT_TARGET': '10.9', 'CLANG_CXX_LIBRARY': 'libc++', - 'CLANG_CXX_LANGUAGE_STANDARD':'c++11', + 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11', 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', - 'GCC_ENABLE_CPP_RTTI':'YES', + 'GCC_ENABLE_CPP_RTTI': 'YES', 'OTHER_CPLUSPLUSFLAGS': [ '-Werror', '-Wall', @@ -38,6 +66,7 @@ ['OS=="mac"', { 'xcode_settings': { 'OTHER_CPLUSPLUSFLAGS': [ '-fPIC' ], + 'SKIP_INSTALL': 'YES', }, }, { 'cflags_cc': [ '-fPIC' ], @@ -46,14 +75,10 @@ 'xcode_settings': { 'SDKROOT': 'iphoneos', 'SUPPORTED_PLATFORMS': 'iphonesimulator iphoneos', - 'CLANG_CXX_LIBRARY': 'libc++', - 'CLANG_CXX_LANGUAGE_STANDARD':'c++11', - 'IPHONEOS_DEPLOYMENT_TARGET':'7.0', + 'IPHONEOS_DEPLOYMENT_TARGET': '7.0', 'TARGETED_DEVICE_FAMILY': '1,2', 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', - 'CLANG_ENABLE_OBJC_ARC': 'NO', 'CODE_SIGN_IDENTITY': 'iPhone Developer', - 'SKIP_INSTALL': 'YES' }, 'configurations': { 'Release': { diff --git a/gyp/install.gypi b/gyp/install.gypi index 1c5066a9c0..48a7a997db 100644 --- a/gyp/install.gypi +++ b/gyp/install.gypi @@ -6,16 +6,18 @@ 'type': 'none', 'hard_dependency': 1, 'dependencies': [ - 'mbgl-core', + '<(core_library)', + '<(headless_library)', + '<(platform_library)', + '<(storage_library)', 'mbgl-standalone', - 'mbgl-headless', - 'mbgl-<(platform)', ], 'copies': [ { 'files': [ '<(standalone_product_dir)/libmbgl.a' ], 'destination': '<(install_prefix)/lib' }, { 'files': [ '<(PRODUCT_DIR)/libmbgl-core.a' ], 'destination': '<(install_prefix)/lib' }, { 'files': [ '<(PRODUCT_DIR)/libmbgl-headless.a' ], 'destination': '<(install_prefix)/lib' }, - { 'files': [ '<(PRODUCT_DIR)/libmbgl-<(platform).a' ], 'destination': '<(install_prefix)/lib' }, + { 'files': [ '<(PRODUCT_DIR)/lib<(platform_library).a' ], 'destination': '<(install_prefix)/lib' }, + { 'files': [ '<(PRODUCT_DIR)/lib<(storage_library).a' ], 'destination': '<(install_prefix)/lib' }, { 'files': [ '../include/mbgl' ], 'destination': '<(install_prefix)/include' }, ], 'variables': { diff --git a/gyp/mbgl-core.gypi b/gyp/mbgl-core.gypi index aa30c5b4dd..cf33b4ae1e 100644 --- a/gyp/mbgl-core.gypi +++ b/gyp/mbgl-core.gypi @@ -9,18 +9,9 @@ 'shaders', 'version', ], - 'variables': { - 'cflags_cc': [ - '<@(uv_cflags)', - '<@(sqlite3_cflags)', - '<@(zlib_cflags)', - '-I<(boost_root)/include', - ], - 'cflags': [ - '<@(uv_cflags)','-fPIC' - ], - }, + 'sources': [ + '<!@(find src -name "*.hpp")', '<!@(find src -name "*.cpp")', '<!@(find src -name "*.c")', '<!@(find src -name "*.h")', @@ -29,25 +20,60 @@ '<!@(find src -name "*.glsl")', 'bin/style.json' ], + + 'variables': { + 'cflags_cc': [ + '<@(uv_cflags)', + '-I<(boost_root)/include', + ], + 'cflags': [ + '<@(uv_cflags)', + '-fPIC' + ], + 'ldflags': [ + '<@(uv_ldflags)', + ], + 'libraries': [ + '<@(uv_static_libs)', + ], + }, + 'include_dirs': [ '../include', '../src', ], + 'conditions': [ ['OS == "mac"', { 'xcode_settings': { 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], 'OTHER_CFLAGS': [ '<@(cflags)' ], - 'SKIP_INSTALL': 'YES' }, }, { 'cflags_cc': [ '<@(cflags_cc)' ], 'cflags': [ '<@(cflags)' ], }] - ] + ], + + 'link_settings': { + 'libraries': [ '<@(libraries)' ], + 'conditions': [ + ['OS == "mac"', { + 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] } + }, { + 'ldflags': [ '<@(ldflags)' ], + }] + ], + }, + + 'direct_dependent_settings': { + 'include_dirs': [ + '../include', + ], + }, }, - { - 'target_name': 'mbgl-standalone', + + { 'target_name': 'mbgl-standalone', 'type': 'none', 'hard_dependency': 1, 'dependencies': [ diff --git a/gyp/mbgl-headless.gypi b/gyp/mbgl-headless.gypi index a96ec24c9e..e2d4e010ce 100644 --- a/gyp/mbgl-headless.gypi +++ b/gyp/mbgl-headless.gypi @@ -8,9 +8,6 @@ 'cflags_cc': [ '<@(uv_cflags)', ], - 'cflags': [ - '<@(uv_cflags)', - ], }, 'include_dirs': [ '../include', @@ -19,11 +16,9 @@ ['OS == "mac"', { 'xcode_settings': { 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - 'OTHER_CFLAGS': [ '<@(cflags)' ], } }, { 'cflags_cc': [ '<@(cflags_cc)' ], - 'cflags': [ '<@(cflags)' ], }] ], 'sources': [ diff --git a/gyp/mbgl-ios.gypi b/gyp/mbgl-ios.gypi index e6fa245890..c2a7b6ca70 100644 --- a/gyp/mbgl-ios.gypi +++ b/gyp/mbgl-ios.gypi @@ -8,34 +8,47 @@ 'dependencies': [ 'version', ], + 'sources': [ '../platform/darwin/log_nslog.mm', '../platform/darwin/string_nsstring.mm', - '../platform/darwin/http_request_cocoa.mm', '../platform/darwin/application_root.mm', '../platform/darwin/image.mm', - '../platform/default/asset_request_libuv.cpp', ], + + 'variables': { + 'cflags_cc': [ + '<@(uv_cflags)', + '-I<(boost_root)/include', + ], + 'libraries': [ + '<@(uv_static_libs)', + ], + 'ldflags': [ + '-framework ImageIO', + '-framework MobileCoreServices', + ], + }, + 'include_dirs': [ '../include', - '../src', ], + 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ - '<@(uv_cflags)', - '-I<(boost_root)/include', - ], + 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], }, + + 'link_settings': { + 'libraries': [ '<@(libraries)' ], + 'xcode_settings': { + 'OTHER_LDFLAGS': [ '<@(ldflags)' ], + }, + }, + 'direct_dependent_settings': { 'include_dirs': [ '../include', ], - 'xcode_settings': { - 'OTHER_LDFLAGS': [ - '-framework ImageIO', - '-framework MobileCoreServices', - ], - }, }, }, ], diff --git a/gyp/mbgl-linux.gypi b/gyp/mbgl-linux.gypi index ae873c5a9e..85fc4a5127 100644 --- a/gyp/mbgl-linux.gypi +++ b/gyp/mbgl-linux.gypi @@ -8,19 +8,27 @@ 'dependencies': [ 'version', ], + + 'sources': [ + '../platform/default/log_stderr.cpp', + '../platform/default/string_stdlib.cpp', + '../platform/default/http_request_curl.cpp', + '../platform/default/asset_request_libuv.cpp', + '../platform/default/application_root.cpp', + '../platform/default/image.cpp', + '../platform/default/image_reader.cpp', + '../platform/default/png_reader.cpp', + '../platform/default/jpeg_reader.cpp', + ], + 'variables': { 'cflags_cc': [ '<@(png_cflags)', '<@(jpeg_cflags)', '<@(uv_cflags)', - '<@(curl_cflags)', '<@(nu_cflags)', '-I<(boost_root)/include', ], - 'cflags': [ - '<@(uv_cflags)', - '<@(nu_cflags)', - ], 'ldflags': [ '<@(png_ldflags)', '<@(jpeg_ldflags)', @@ -28,54 +36,45 @@ '<@(curl_ldflags)', '<@(nu_ldflags)', ], - }, - 'sources': [ - '../platform/default/log_stderr.cpp', - '../platform/default/string_stdlib.cpp', - '../platform/default/http_request_curl.cpp', - '../platform/default/asset_request_libuv.cpp', - '../platform/default/application_root.cpp', - '../platform/default/image.cpp', - '../platform/default/image_reader.cpp', - '../platform/default/png_reader.cpp', - '../platform/default/jpeg_reader.cpp', - ], - 'include_dirs': [ - '../include', - '../src', - ], - 'link_settings': { 'libraries': [ '<@(png_static_libs)', '<@(jpeg_static_libs)', - '<@(nu_static_libs)' + '<@(uv_static_libs)', + '<@(nu_static_libs)', ], }, + + 'include_dirs': [ + '../include', + '../src', + ], + 'conditions': [ ['OS == "mac"', { 'xcode_settings': { 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - 'OTHER_CFLAGS': [ '<@(cflags)' ], } }, { 'cflags_cc': [ '<@(cflags_cc)' ], - 'cflags': [ '<@(cflags)' ], }] ], - 'direct_dependent_settings': { - 'include_dirs': [ - '../include', - ], + + 'link_settings': { + 'libraries': [ '<@(libraries)' ], 'conditions': [ ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - } + 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] } }, { 'ldflags': [ '<@(ldflags)' ], }] ], }, + + 'direct_dependent_settings': { + 'include_dirs': [ + '../include', + ], + }, }, ], } diff --git a/gyp/mbgl-osx.gypi b/gyp/mbgl-osx.gypi index 352a132a06..d90d88ef43 100644 --- a/gyp/mbgl-osx.gypi +++ b/gyp/mbgl-osx.gypi @@ -8,35 +8,49 @@ 'dependencies': [ 'version', ], + 'sources': [ '../platform/darwin/log_nslog.mm', '../platform/darwin/string_nsstring.mm', - '../platform/darwin/http_request_cocoa.mm', '../platform/darwin/application_root.mm', '../platform/darwin/image.mm', - '../platform/default/asset_request_libuv.cpp', ], + + 'variables': { + 'cflags_cc': [ + '<@(uv_cflags)', + '-I<(boost_root)/include', + ], + 'libraries': [ + '<@(uv_static_libs)', + ], + 'ldflags': [ + '-framework Foundation', + '-framework ImageIO', + '-framework CoreServices', + ], + }, + 'include_dirs': [ '../include', '../src', ], + 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ - '<@(uv_cflags)', - '-I<(boost_root)/include', - ], + 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], }, + + 'link_settings': { + 'libraries': [ '<@(libraries)' ], + 'xcode_settings': { + 'OTHER_LDFLAGS': [ '<@(ldflags)' ], + }, + }, + 'direct_dependent_settings': { 'include_dirs': [ '../include', ], - 'xcode_settings': { - 'OTHER_LDFLAGS': [ - '-framework Foundation', - '-framework ImageIO', - '-framework CoreServices', - ], - }, }, }, ], diff --git a/gyp/mbgl-platform.gypi b/gyp/mbgl-platform.gypi deleted file mode 100644 index 08fa5f821c..0000000000 --- a/gyp/mbgl-platform.gypi +++ /dev/null @@ -1,20 +0,0 @@ -{ - 'conditions': [ - ['platform == "osx"', { - 'includes': ['mbgl-osx.gypi'], - 'variables': { 'platform_library': 'mbgl-osx' }, - }], - ['platform == "ios"', { - 'includes': ['mbgl-ios.gypi'], - 'variables': { 'platform_library': 'mbgl-ios' }, - }], - ['platform == "linux"', { - 'includes': ['mbgl-linux.gypi'], - 'variables': { 'platform_library': 'mbgl-linux' }, - }], - ['platform == "android"', { - 'includes': ['mbgl-android.gypi'], - 'variables': { 'platform_library': 'mbgl-android' }, - }], - ], -} diff --git a/gyp/mbgl-storage-cocoa.gypi b/gyp/mbgl-storage-cocoa.gypi new file mode 100644 index 0000000000..c22216b823 --- /dev/null +++ b/gyp/mbgl-storage-cocoa.gypi @@ -0,0 +1,62 @@ +{ + 'targets': [ + { 'target_name': 'mbgl-storage-cocoa', + 'product_name': 'mbgl-storage-cocoa', + 'type': 'static_library', + 'standalone_static_library': 1, + 'hard_dependency': 1, + + 'sources': [ + '../platform/default/default_file_source.cpp', + '../platform/default/sqlite_cache.cpp', + '../platform/darwin/http_request_cocoa.mm', + '../platform/default/asset_request_libuv.cpp', + '../platform/default/sqlite3.hpp', + '../platform/default/sqlite3.cpp', + '../platform/default/compression.hpp', + '../platform/default/compression.cpp', + ], + + 'include_dirs': [ + '../include', + ], + + 'variables': { + 'cflags_cc': [ + '<@(uv_cflags)', + '<@(sqlite3_cflags)', + '-I<(boost_root)/include', + ], + 'ldflags': [ + '-framework Foundation', # For NSURLRequest + '<@(uv_ldflags)', + '<@(sqlite3_ldflags)', + '<@(zlib_ldflags)', + ], + 'libraries': [ + '<@(uv_static_libs)', + '<@(sqlite3_static_libs)', + '<@(zlib_static_libs)', + ], + }, + + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], + 'CLANG_ENABLE_OBJC_ARC': 'NO', + }, + + 'link_settings': { + 'libraries': [ '<@(libraries)' ], + 'xcode_settings': { + 'OTHER_LDFLAGS': [ '<@(ldflags)' ], + }, + }, + + 'direct_dependent_settings': { + 'include_dirs': [ + '../include', + ], + }, + }, + ], +} diff --git a/gyp/mbgl-storage-curl.gypi b/gyp/mbgl-storage-curl.gypi new file mode 100644 index 0000000000..c47f2232dd --- /dev/null +++ b/gyp/mbgl-storage-curl.gypi @@ -0,0 +1,68 @@ +{ + 'targets': [ + { 'target_name': 'mbgl-storage-curl', + 'product_name': 'mbgl-storage-curl', + 'type': 'static_library', + 'standalone_static_library': 1, + 'hard_dependency': 1, + + 'sources': [ + '../platform/default/default_file_source.cpp', + '../platform/default/sqlite_cache.cpp', + '../platform/default/http_request_curl.cpp', + '../platform/default/asset_request_libuv.cpp', + '../platform/default/sqlite3.hpp', + '../platform/default/sqlite3.cpp', + '../platform/default/compression.hpp', + '../platform/default/compression.cpp', + ], + + 'include_dirs': [ + '../include', + ], + + 'variables': { + 'cflags_cc': [ + '<@(uv_cflags)', + '<@(sqlite3_cflags)', + '-I<(boost_root)/include', + ], + 'ldflags': [ + '<@(uv_ldflags)', + '<@(sqlite3_ldflags)', + '<@(zlib_ldflags)', + ], + 'libraries': [ + '<@(uv_static_libs)', + '<@(sqlite3_static_libs)', + '<@(zlib_static_libs)', + ], + }, + + 'conditions': [ + ['OS == "mac"', { + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], + }, + }, { + 'cflags_cc': [ '<@(cflags_cc)' ], + }], + ], + + 'link_settings': { + 'libraries': [ '<@(libraries)' ], + 'conditions': [ + ['OS == "mac"', { + 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] } + }, { + 'ldflags': [ '<@(ldflags)' ], + }] + ], + }, + + 'direct_dependent_settings': { + 'include_dirs': [ '../include' ], + }, + }, + ], +} diff --git a/linux/mapboxgl-app.gyp b/linux/mapboxgl-app.gyp index 60eb16de38..e7db26f2b7 100644 --- a/linux/mapboxgl-app.gyp +++ b/linux/mapboxgl-app.gyp @@ -3,55 +3,50 @@ '../gyp/common.gypi', ], 'targets': [ - { - 'target_name': 'linuxapp', + { 'target_name': 'linuxapp', 'product_name': 'mapbox-gl', 'type': 'executable', + + 'dependencies': [ + '../mbgl.gyp:<(core_library)', + '../mbgl.gyp:<(platform_library)', + '../mbgl.gyp:<(storage_library)', + '../mbgl.gyp:bundle_styles', + '../mbgl.gyp:copy_certificate_bundle', + ], + 'sources': [ - './main.cpp', + 'main.cpp', '../platform/default/settings_json.cpp', '../platform/default/glfw_view.cpp', '../platform/default/log_stderr.cpp', ], - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS':[ + + 'variables' : { + 'cxxflags': [ '<@(glfw3_cflags)', - '<@(png_cflags)', - '<@(jpeg_cflags)', ], - }, - 'cflags_cc': [ - '<@(glfw3_cflags)', - '<@(png_cflags)', - '<@(jpeg_cflags)', - '-I<(boost_root)/include', - ], - 'variables': { 'ldflags': [ - '<@(png_ldflags)', - '<@(sqlite3_static_libs)', - '<@(sqlite3_ldflags)', - '<@(glfw3_static_libs)', '<@(glfw3_ldflags)', - '<@(curl_ldflags)', - '<@(zlib_ldflags)', + ], + 'libraries': [ + '<@(glfw3_static_libs)', ], }, + + 'libraries': [ '<@(libraries)' ], 'conditions': [ ['OS == "mac"', { 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ '<@(cxxflags)' ], 'OTHER_LDFLAGS': [ '<@(ldflags)' ], } }, { - 'libraries': [ '<@(ldflags)' ], + 'cxxflags': [ '<@(cxxflags)' ], + 'ldflags': [ '<@(ldflags)' ], }] ], - 'dependencies': [ - '../mapboxgl.gyp:mbgl-standalone', - '../mapboxgl.gyp:mbgl-linux', - '../mapboxgl.gyp:bundle_styles', - '../mapboxgl.gyp:copy_certificate_bundle', - ], + 'copies': [{ 'files': [ '../styles/styles' ], 'destination': '<(PRODUCT_DIR)' diff --git a/macosx/mapboxgl-app.gyp b/macosx/mapboxgl-app.gyp index aab12a82e9..6bb2537ceb 100644 --- a/macosx/mapboxgl-app.gyp +++ b/macosx/mapboxgl-app.gyp @@ -3,10 +3,22 @@ '../gyp/common.gypi', ], 'targets': [ - { - 'target_name': 'osxapp', + { 'target_name': 'osxapp', 'product_name': 'Mapbox GL', 'type': 'executable', + 'product_extension': 'app', + 'mac_bundle': 1, + 'mac_bundle_resources': [ + 'Icon.icns', + ], + + 'dependencies': [ + '../mbgl.gyp:bundle_styles', + '../mbgl.gyp:<(core_library)', + '../mbgl.gyp:<(platform_library)', + '../mbgl.gyp:<(storage_library)', + ], + 'sources': [ './main.mm', '../platform/darwin/settings_nsuserdefaults.hpp', @@ -15,54 +27,34 @@ '../platform/default/glfw_view.hpp', '../platform/default/glfw_view.cpp', ], - 'product_extension': 'app', - 'mac_bundle': 1, - 'mac_bundle_resources': [ - 'Icon.icns', + + 'variables' : { + 'cxxflags': [ + '<@(glfw3_cflags)', + ], + 'ldflags': [ + '-framework SystemConfiguration', # For NSUserDefaults and Reachability + '<@(glfw3_ldflags)', + ], + 'libraries': [ + '<@(glfw3_static_libs)', + ], + }, + + 'libraries': [ + '<@(libraries)', ], + 'xcode_settings': { 'SDKROOT': 'macosx', 'SUPPORTED_PLATFORMS':'macosx', - 'OTHER_CPLUSPLUSFLAGS': [ - '<@(glfw3_cflags)' - ], - 'OTHER_LDFLAGS': [ - '<@(glfw3_ldflags)', - '-framework SystemConfiguration', - ], + 'OTHER_CPLUSPLUSFLAGS': [ '<@(cxxflags)' ], + 'OTHER_LDFLAGS': [ '<@(ldflags)' ], 'SDKROOT': 'macosx', 'INFOPLIST_FILE': 'Info.plist', - 'MACOSX_DEPLOYMENT_TARGET':'10.9', + 'MACOSX_DEPLOYMENT_TARGET': '10.9', 'CLANG_ENABLE_OBJC_ARC': 'YES' }, - 'variables' : { - 'ldflags': [ - '<@(uv_ldflags)', - '<@(uv_static_libs)', - '<@(sqlite3_static_libs)', - '<@(sqlite3_ldflags)', - '<@(glfw3_static_libs)', - '<@(glfw3_ldflags)', - '<@(zlib_ldflags)', - ] - }, - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - } - }, { - 'ldflags': [ '<@(ldflags)' ], - }] - ], - 'include_dirs': [ - '../src' - ], - 'dependencies': [ - '../mapboxgl.gyp:bundle_styles', - '../mapboxgl.gyp:mbgl-core', - '../mapboxgl.gyp:mbgl-osx', - ] } ] } diff --git a/mapboxgl.gyp b/mapboxgl.gyp deleted file mode 100644 index 7ce215dc6a..0000000000 --- a/mapboxgl.gyp +++ /dev/null @@ -1,13 +0,0 @@ -{ - 'includes': [ - './gyp/common.gypi', - './gyp/shaders.gypi', - './gyp/version.gypi', - './gyp/styles.gypi', - './gyp/certificates.gypi', - './gyp/mbgl-core.gypi', - './gyp/mbgl-platform.gypi', - './gyp/mbgl-headless.gypi', - './gyp/install.gypi', - ], -} diff --git a/mbgl.gyp b/mbgl.gyp new file mode 100644 index 0000000000..2f65caa442 --- /dev/null +++ b/mbgl.gyp @@ -0,0 +1,38 @@ +{ + 'includes': [ + './gyp/common.gypi', + './gyp/shaders.gypi', + './gyp/version.gypi', + './gyp/styles.gypi', + './gyp/certificates.gypi', + './gyp/mbgl-core.gypi', + './gyp/mbgl-headless.gypi', + './gyp/mbgl-storage-curl.gypi', + './gyp/install.gypi', + ], + + 'conditions': [ + ['platform == "osx"', { + 'includes': [ + './gyp/mbgl-osx.gypi', + './gyp/mbgl-storage-cocoa.gypi' + ], + }], + ['platform == "ios"', { + 'includes': [ + './gyp/mbgl-ios.gypi', + './gyp/mbgl-storage-cocoa.gypi' + ], + }], + ['platform == "linux"', { + 'includes': [ + './gyp/mbgl-linux.gypi' + ], + }], + ['platform == "android"', { + 'includes': [ + './gyp/mbgl-android.gypi' + ], + }], + ], +} diff --git a/src/mbgl/util/compression.cpp b/platform/default/compression.cpp index d6d6370546..c8b38e742f 100644 --- a/src/mbgl/util/compression.cpp +++ b/platform/default/compression.cpp @@ -1,10 +1,25 @@ -#include <mbgl/util/compression.hpp> +#include "compression.hpp" #include <zlib.h> #include <cstring> #include <stdexcept> + +// Check zlib library version. +const static bool zlibVersionCheck = []() { + const char *const version = zlibVersion(); + if (version[0] != ZLIB_VERSION[0]) { + char message[96]; + snprintf(message, 96, "zlib version mismatch: headers report %s, but library reports %s", + ZLIB_VERSION, version); + throw std::runtime_error(message); + } + + return true; +}(); + + namespace mbgl { namespace util { diff --git a/src/mbgl/util/compression.hpp b/platform/default/compression.hpp index a33b2476a7..a33b2476a7 100644 --- a/src/mbgl/util/compression.hpp +++ b/platform/default/compression.hpp diff --git a/src/mbgl/storage/default_file_source.cpp b/platform/default/default_file_source.cpp index 60633c789e..60633c789e 100644 --- a/src/mbgl/storage/default_file_source.cpp +++ b/platform/default/default_file_source.cpp diff --git a/src/mbgl/util/sqlite3.cpp b/platform/default/sqlite3.cpp index 787db83992..fda9784607 100644 --- a/src/mbgl/util/sqlite3.cpp +++ b/platform/default/sqlite3.cpp @@ -1,8 +1,28 @@ -#include <mbgl/util/sqlite3.hpp> +#include "sqlite3.hpp" #include <sqlite3.h> #include <cassert> +// Check sqlite3 library version. +const static bool sqliteVersionCheck = []() { + if (sqlite3_libversion_number() != SQLITE_VERSION_NUMBER) { + char message[96]; + snprintf(message, 96, + "sqlite3 libversion mismatch: headers report %d, but library reports %d", + SQLITE_VERSION_NUMBER, sqlite3_libversion_number()); + throw std::runtime_error(message); + } + if (strcmp(sqlite3_sourceid(), SQLITE_SOURCE_ID) != 0) { + char message[256]; + snprintf(message, 256, + "sqlite3 sourceid mismatch: headers report \"%s\", but library reports \"%s\"", + SQLITE_SOURCE_ID, sqlite3_sourceid()); + throw std::runtime_error(message); + } + + return true; +}(); + namespace mapbox { namespace sqlite { diff --git a/src/mbgl/util/sqlite3.hpp b/platform/default/sqlite3.hpp index 3e324f7ce1..3e324f7ce1 100644 --- a/src/mbgl/util/sqlite3.hpp +++ b/platform/default/sqlite3.hpp diff --git a/src/mbgl/storage/sqlite_cache.cpp b/platform/default/sqlite_cache.cpp index 14fbb0ca18..ab1ee040ff 100644 --- a/src/mbgl/storage/sqlite_cache.cpp +++ b/platform/default/sqlite_cache.cpp @@ -7,8 +7,8 @@ #include <mbgl/util/variant.hpp> #include <mbgl/platform/log.hpp> -#include "../util/sqlite3.hpp" -#include "../util/compression.hpp" +#include "sqlite3.hpp" +#include "compression.hpp" #include <uv.h> diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 69056cb57a..d76023c8fb 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -54,38 +54,6 @@ const static bool uvVersionCheck = []() { return true; }(); - -#include <zlib.h> -// Check zlib library version. -const static bool zlibVersionCheck = []() { - const char *const version = zlibVersion(); - if (version[0] != ZLIB_VERSION[0]) { - throw std::runtime_error(mbgl::util::sprintf<96>( - "zlib version mismatch: headers report %s, but library reports %s", ZLIB_VERSION, version)); - } - - return true; -}(); - - -#include <sqlite3.h> -// Check sqlite3 library version. -const static bool sqliteVersionCheck = []() { - if (sqlite3_libversion_number() != SQLITE_VERSION_NUMBER) { - throw std::runtime_error(mbgl::util::sprintf<96>( - "sqlite3 libversion mismatch: headers report %d, but library reports %d", - SQLITE_VERSION_NUMBER, sqlite3_libversion_number())); - } - if (strcmp(sqlite3_sourceid(), SQLITE_SOURCE_ID) != 0) { - throw std::runtime_error(mbgl::util::sprintf<256>( - "sqlite3 sourceid mismatch: headers report \"%s\", but library reports \"%s\"", - SQLITE_SOURCE_ID, sqlite3_sourceid())); - } - - return true; -}(); - - using namespace mbgl; Map::Map(View& view_, FileSource& fileSource_) diff --git a/test/test.gyp b/test/test.gyp index af7dd97eed..012d88e56b 100644 --- a/test/test.gyp +++ b/test/test.gyp @@ -20,9 +20,10 @@ 'include_dirs': [ '../include', '../src' ], 'dependencies': [ 'symlink_TEST_DATA', - '../mapboxgl.gyp:mbgl-core', - '../mapboxgl.gyp:mbgl-<(platform)', - '../mapboxgl.gyp:mbgl-headless', + '../mbgl.gyp:<(core_library)', + '../mbgl.gyp:<(platform_library)', + '../mbgl.gyp:<(storage_library)', + '../mbgl.gyp:<(headless_library)', '../deps/gtest/gtest.gyp:gtest' ], 'sources': [ |