diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-10-24 15:43:05 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-10-24 16:40:08 +0200 |
commit | cd9a89257a0004ca18460befc4b141bc07ed5c22 (patch) | |
tree | e336a602b561854f043557096b83140aa04cd63a | |
parent | 10c765948471e6d13e2eb45b44ac6c4d108dafc5 (diff) | |
download | qtlocation-mapboxgl-cd9a89257a0004ca18460befc4b141bc07ed5c22.tar.gz |
restructure gyp files
-rw-r--r-- | Makefile | 24 | ||||
-rw-r--r-- | common.gypi | 2 | ||||
-rw-r--r-- | gyp/certificates.gypi | 13 | ||||
-rw-r--r-- | gyp/fixtures.gypi | 18 | ||||
-rw-r--r-- | gyp/library.gypi | 75 | ||||
-rw-r--r-- | gyp/npm_install.gypi | 21 | ||||
-rw-r--r-- | gyp/platform-ios.gypi | 51 | ||||
-rw-r--r-- | gyp/platform-linux.gypi | 53 | ||||
-rw-r--r-- | gyp/platform-osx.gypi | 33 | ||||
-rw-r--r-- | gyp/shaders.gypi | 36 | ||||
-rw-r--r-- | gyp/styles.gypi | 36 | ||||
-rw-r--r-- | include/mbgl/platform/darwin/log_nslog.hpp (renamed from common/nslog_log.hpp) | 0 | ||||
-rw-r--r-- | include/mbgl/platform/darwin/reachability.h (renamed from common/Reachability.h) | 0 | ||||
-rw-r--r-- | include/mbgl/platform/darwin/settings_nsuserdefaults.hpp (renamed from common/settings_nsuserdefaults.hpp) | 0 | ||||
-rw-r--r-- | include/mbgl/platform/default/glfw_view.hpp (renamed from common/glfw_view.hpp) | 0 | ||||
-rw-r--r-- | include/mbgl/platform/default/headless_view.hpp (renamed from common/headless_view.hpp) | 0 | ||||
-rw-r--r-- | include/mbgl/platform/default/log_stderr.hpp (renamed from common/stderr_log.hpp) | 0 | ||||
-rw-r--r-- | include/mbgl/platform/default/settings_json.hpp (renamed from common/settings_json.hpp) | 0 | ||||
m--------- | ios/mapbox-gl-cocoa | 0 | ||||
-rw-r--r-- | linux/main.cpp | 9 | ||||
-rw-r--r-- | linux/mapboxgl-app.gyp | 21 | ||||
-rw-r--r-- | macosx/main.mm | 11 | ||||
-rw-r--r-- | macosx/mapboxgl-app.gyp | 18 | ||||
-rw-r--r-- | mapboxgl.gyp | 254 | ||||
-rw-r--r-- | platform/darwin/http_request_baton_cocoa.mm (renamed from common/http_request_baton_cocoa.mm) | 0 | ||||
-rw-r--r-- | platform/darwin/log_nslog.mm (renamed from common/nslog_log.mm) | 2 | ||||
-rw-r--r-- | platform/darwin/reachability.m (renamed from common/Reachability.m) | 2 | ||||
-rw-r--r-- | platform/darwin/settings_nsuserdefaults.mm (renamed from common/settings_nsuserdefaults.mm) | 2 | ||||
-rw-r--r-- | platform/darwin/string_nsstring.mm (renamed from common/platform_nsstring.mm) | 2 | ||||
-rw-r--r-- | platform/default/cache_database_tmp.cpp (renamed from common/linux.cpp) | 0 | ||||
-rw-r--r-- | platform/default/glfw_view.cpp (renamed from common/glfw_view.cpp) | 2 | ||||
-rw-r--r-- | platform/default/headless_view.cpp (renamed from common/headless_view.cpp) | 0 | ||||
-rw-r--r-- | platform/default/http_request_baton_curl.cpp (renamed from common/http_request_baton_curl.cpp) | 0 | ||||
-rw-r--r-- | platform/default/log_stderr.cpp (renamed from common/stderr_log.cpp) | 2 | ||||
-rw-r--r-- | platform/default/settings_json.cpp (renamed from common/settings_json.cpp) | 2 | ||||
-rw-r--r-- | platform/default/string_stdlib.cpp (renamed from common/platform_default.cpp) | 0 | ||||
-rw-r--r-- | platform/ios/cache_database_library.mm (renamed from common/ios.mm) | 0 | ||||
-rw-r--r-- | platform/osx/cache_database_application_support.mm (renamed from common/osx.mm) | 0 | ||||
-rw-r--r-- | test/test.gyp | 1 |
39 files changed, 391 insertions, 299 deletions
@@ -2,6 +2,12 @@ BUILDTYPE ?= Release PYTHON ?= python V ?= 1 +ifeq ($(shell uname -s), Darwin) +PLATFORM ?= osx +endif +PLATFORM ?= linux + + all: mbgl config.gypi: configure @@ -12,13 +18,13 @@ config-ios.gypi: configure # Builds the regular library mbgl: config.gypi mapboxgl.gyp - deps/run_gyp mapboxgl.gyp -Iconfig.gypi --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make + deps/run_gyp mapboxgl.gyp -Iconfig.gypi -Dplatform=$(PLATFORM) --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make $(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) mapboxgl ##### Test cases ############################################################### build/test/Makefile: src common config.gypi test/test.gyp - deps/run_gyp test/test.gyp -Iconfig.gypi --depth=. -Goutput_dir=.. --generator-output=./build/test -f make + deps/run_gyp test/test.gyp -Iconfig.gypi -Dplatform=$(PLATFORM) --depth=. -Goutput_dir=.. --generator-output=./build/test -f make test: build/test/Makefile $(MAKE) -C build/test BUILDTYPE=$(BUILDTYPE) V=$(V) test @@ -29,7 +35,7 @@ test_%: build/test/Makefile # build Mac OS X project for Xcode xtest: config.gypi clear_xcode_cache - deps/run_gyp test/test.gyp -Iconfig.gypi --depth=. -Goutput_dir=.. --generator-output=./build -f xcode + deps/run_gyp test/test.gyp -Iconfig.gypi -Dplatform=osx --depth=. -Goutput_dir=.. --generator-output=./build -f xcode open ./build/test/test.xcodeproj ##### Makefile builds ########################################################## @@ -37,7 +43,7 @@ xtest: config.gypi clear_xcode_cache # Builds the linux app with make. linux: config.gypi linux/mapboxgl-app.gyp - deps/run_gyp linux/mapboxgl-app.gyp -Iconfig.gypi --depth=. -Goutput_dir=.. --generator-output=./build/linux -f make + deps/run_gyp linux/mapboxgl-app.gyp -Iconfig.gypi -Dplatform=linux --depth=. -Goutput_dir=.. --generator-output=./build/linux -f make $(MAKE) -C build/linux BUILDTYPE=$(BUILDTYPE) V=$(V) linuxapp # Executes the Linux binary @@ -48,7 +54,7 @@ run-linux: linux # Builds the OS X app with make. osx: config.gypi macosx/mapboxgl-app.gyp - deps/run_gyp macosx/mapboxgl-app.gyp -Iconfig.gypi --depth=. -Goutput_dir=.. --generator-output=./build/macosx -f make + deps/run_gyp macosx/mapboxgl-app.gyp -Iconfig.gypi -Dplatform=osx --depth=. -Goutput_dir=.. --generator-output=./build/macosx -f make $(MAKE) -C build/macosx BUILDTYPE=$(BUILDTYPE) V=$(V) osxapp # Executes the OS X binary @@ -70,21 +76,21 @@ clear_xcode_cache: # build Mac OS X project for Xcode xproj-cli: config.gypi macosx/mapboxgl-app.gyp clear_xcode_cache - deps/run_gyp macosx/mapboxgl-app.gyp -Iconfig.gypi --depth=. --generator-output=./build -f xcode + deps/run_gyp macosx/mapboxgl-app.gyp -Iconfig.gypi -Dplatform=osx --depth=. --generator-output=./build -f xcode xproj: xproj-cli open ./build/macosx/mapboxgl-app.xcodeproj # build iOS project for Xcode iproj-cli: config-ios.gypi ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp clear_xcode_cache - deps/run_gyp ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp -Iconfig-ios.gypi --depth=. --generator-output=./build -f xcode + deps/run_gyp ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp -Iconfig-ios.gypi -Dplatform=ios --depth=. --generator-output=./build -f xcode iproj: iproj-cli open ./build/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj # build Linux project for Xcode (Runs on Mac OS X too, but without platform-specific code) lproj: config.gypi linux/mapboxgl-app.gyp clear_xcode_cache - deps/run_gyp linux/mapboxgl-app.gyp -Iconfig.gypi --depth=. --generator-output=./build -f xcode + deps/run_gyp linux/mapboxgl-app.gyp -Iconfig.gypi -Dplatform=linux --depth=. --generator-output=./build -f xcode open ./build/linux/mapboxgl-app.xcodeproj @@ -98,5 +104,5 @@ clean: clear_xcode_cache distclean: clean -rm -rf ./mason_packages -.PHONY: mbgl test linux build/test/Makefile +.PHONY: mbgl test linux clear_xcode_cache build/test/Makefile # DO NOT DELETE diff --git a/common.gypi b/common.gypi index 5d02a71c13..97481c1bb2 100644 --- a/common.gypi +++ b/common.gypi @@ -34,6 +34,6 @@ 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES' } }, - } + }, } } diff --git a/gyp/certificates.gypi b/gyp/certificates.gypi new file mode 100644 index 0000000000..6a358f0dbf --- /dev/null +++ b/gyp/certificates.gypi @@ -0,0 +1,13 @@ +{ + 'targets': [ + { + 'target_name': 'copy_certificate_bundle', + 'type': 'none', + 'hard_dependency': 1, + 'copies': [{ + 'files': [ '../common/ca-bundle.crt' ], + 'destination': '<(PRODUCT_DIR)' + }], + }, + ] +} diff --git a/gyp/fixtures.gypi b/gyp/fixtures.gypi new file mode 100644 index 0000000000..f290da5d53 --- /dev/null +++ b/gyp/fixtures.gypi @@ -0,0 +1,18 @@ +{ + 'targets': [ + { + 'target_name': 'copy_fixtures', + 'type': 'none', + 'hard_dependency': 1, + 'dependencies': [ + 'bundle_styles' + ], + 'copies': [ + { + 'files': [ '../styles' ], + 'destination': '../test/fixtures/style_parser' + } + ] + }, + ] +} diff --git a/gyp/library.gypi b/gyp/library.gypi new file mode 100644 index 0000000000..bb86432dac --- /dev/null +++ b/gyp/library.gypi @@ -0,0 +1,75 @@ +{ + 'targets': [ + { + 'target_name': 'mapboxgl', + 'product_name': 'mapboxgl', + 'type': 'static_library', + 'hard_dependency': 1, + 'dependencies': [ + 'shaders', + ], + 'sources': [ + '<!@(find src -name "*.cpp")', + '<!@(test -f "config/constants_local.cpp" && echo "config/constants_local.cpp" || echo "config/constants.cpp")', + '<!@(find src -name "*.c")', + '<!@(find src -name "*.h")', + '<!@(find include -name "*.hpp")', + '<!@(find include -name "*.h")', + '<!@(find src -name "*.glsl")', + 'bin/style.json' + ], + 'include_dirs': [ + '../include' + ], + 'conditions': [ + ['OS == "mac"', { + 'xcode_settings': { + 'PUBLIC_HEADERS_FOLDER_PATH': 'include', + 'OTHER_CPLUSPLUSFLAGS': [ + '<@(png_cflags)', + '<@(uv_cflags)', + '<@(sqlite3_cflags)', + '<@(zlib_cflags)', + '-I<(boost_root)/include', + ], + 'OTHER_CFLAGS': [ + '<@(uv_cflags)', + ], + }, + }, { + 'cflags': [ + '<@(png_cflags)', + '<@(uv_cflags)', + '<@(sqlite3_cflags)', + '<@(zlib_cflags)', + '-I<(boost_root)/include', + ], + }] + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '../include', + ], + 'conditions': [ + ['OS == "mac"', { + 'xcode_settings': { + 'OTHER_LDFLAGS': [ + '<@(png_libraries)', + '<@(uv_libraries)', + '<@(sqlite3_libraries)', + '<@(zlib_libraries)', + ] + } + }, { + 'libraries': [ + '<@(png_libraries)', + '<@(uv_libraries)', + '<@(sqlite3_libraries)', + '<@(zlib_libraries)', + ] + }] + ] + } + } + ] +} diff --git a/gyp/npm_install.gypi b/gyp/npm_install.gypi new file mode 100644 index 0000000000..07d2e3e00e --- /dev/null +++ b/gyp/npm_install.gypi @@ -0,0 +1,21 @@ +{ + 'targets': [ + { + 'target_name': 'npm_install', + 'type': 'none', + 'hard_dependency': 1, + 'actions': [ + { + 'action_name': 'npm install', + 'inputs': [ + '../bin/package.json', + ], + 'outputs': [ + '../bin/node_modules', + ], + 'action': ['./scripts/npm_install.sh', '<@(npm)'] + } + ], + }, + ] +} diff --git a/gyp/platform-ios.gypi b/gyp/platform-ios.gypi new file mode 100644 index 0000000000..d070744925 --- /dev/null +++ b/gyp/platform-ios.gypi @@ -0,0 +1,51 @@ +{ + 'target_defaults': { + 'target_conditions': [ + ['_type == "static_library"', { + 'xcode_settings': { + 'SDKROOT': 'iphoneos', + 'SUPPORTED_PLATFORMS': 'iphonesimulator iphoneos', + 'CLANG_CXX_LIBRARY': 'libc++', + 'CLANG_CXX_LANGUAGE_STANDARD':'c++11', + 'IPHONEOS_DEPLOYMENT_TARGET':'7.0', + 'TARGETED_DEVICE_FAMILY': '1,2', + 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', + 'CLANG_ENABLE_OBJC_ARC': 'YES', + 'CODE_SIGN_IDENTITY': 'iPhone Developer', + 'PUBLIC_HEADERS_FOLDER_PATH': 'include', + } + }], + ], + }, + 'targets': [ + { + 'target_name': 'mapboxgl-ios', + 'product_name': 'mapboxgl-ios', + 'type': 'static_library', + 'include_dirs': [ + '../include', + ], + 'sources': [ + '../platform/ios/cache_database_library.mm', + '../platform/darwin/log_nslog.mm', + '../platform/darwin/string_nsstring.mm', + '../platform/darwin/http_request_baton_cocoa.mm', + ], + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ + '<@(uv_cflags)', + ], + }, + 'direct_dependent_settings': { + 'include_dirs': [ + '../include', + ], + 'xcode_settings': { + 'OTHER_LDFLAGS': [ + '<@(uv_libraries)', + ], + }, + }, + }, + ], +} diff --git a/gyp/platform-linux.gypi b/gyp/platform-linux.gypi new file mode 100644 index 0000000000..4288def7fc --- /dev/null +++ b/gyp/platform-linux.gypi @@ -0,0 +1,53 @@ +{ + 'targets': [ + { + 'target_name': 'mapboxgl-linux', + 'product_name': 'mapboxgl-linux', + 'type': 'static_library', + 'include_dirs': [ + '../include' + ], + 'sources': [ + '../platform/default/cache_database_tmp.cpp', + '../platform/default/log_stderr.cpp', + '../platform/default/string_stdlib.cpp', + '../platform/default/http_request_baton_curl.cpp', + ], + 'conditions': [ + ['OS == "mac"', { + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ + '<@(uv_cflags)', + '<@(curl_cflags)', + ], + } + }, { + 'cflags': [ + '<@(uv_cflags)', + '<@(curl_cflags)', + ], + }] + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '../include', + ], + 'conditions': [ + ['OS == "mac"', { + 'xcode_settings': { + 'OTHER_LDFLAGS': [ + '<@(uv_libraries)', + '<@(curl_libraries)', + ] + } + }, { + 'libraries': [ + '<@(uv_libraries)', + '<@(curl_libraries)', + ] + }] + ] + } + }, + ] +} diff --git a/gyp/platform-osx.gypi b/gyp/platform-osx.gypi new file mode 100644 index 0000000000..adc0d3232c --- /dev/null +++ b/gyp/platform-osx.gypi @@ -0,0 +1,33 @@ +{ + 'targets': [ + { + 'target_name': 'mapboxgl-osx', + 'product_name': 'mapboxgl-osx', + 'type': 'static_library', + 'include_dirs': [ + '../include', + ], + 'sources': [ + '../platform/osx/cache_database_application_support.mm', + '../platform/darwin/log_nslog.mm', + '../platform/darwin/string_nsstring.mm', + '../platform/darwin/http_request_baton_cocoa.mm', + ], + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ + '<@(uv_cflags)', + ], + }, + 'direct_dependent_settings': { + 'include_dirs': [ + '../include', + ], + 'xcode_settings': { + 'OTHER_LDFLAGS': [ + '<@(uv_libraries)', + ], + }, + }, + }, + ], +} diff --git a/gyp/shaders.gypi b/gyp/shaders.gypi new file mode 100644 index 0000000000..9435bd7d9c --- /dev/null +++ b/gyp/shaders.gypi @@ -0,0 +1,36 @@ +{ + 'targets': [ + { + 'target_name': 'shaders', + 'type': 'none', + 'hard_dependency': 1, + 'dependencies': [ + 'npm_install' + ], + 'actions': [ + { + 'action_name': 'Build Shaders', + 'inputs': [ + '<!@(find src -name "*.glsl")' + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/shader/shaders.hpp', + '<(SHARED_INTERMEDIATE_DIR)/src/shader/shaders_gl.cpp', + '<(SHARED_INTERMEDIATE_DIR)/src/shader/shaders_gles2.cpp', + ], + 'action': ['<@(node)', 'bin/build-shaders.js', '<(SHARED_INTERMEDIATE_DIR)'], + } + ], + 'direct_dependent_settings': { + 'sources': [ + '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/shader/shaders.hpp', + '<(SHARED_INTERMEDIATE_DIR)/src/shader/shaders_gl.cpp', + '<(SHARED_INTERMEDIATE_DIR)/src/shader/shaders_gles2.cpp' + ], + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)/include/', + ] + } + }, + ] +} diff --git a/gyp/styles.gypi b/gyp/styles.gypi new file mode 100644 index 0000000000..31bf530c5f --- /dev/null +++ b/gyp/styles.gypi @@ -0,0 +1,36 @@ +{ + 'targets': [ + { + 'target_name': 'touch_styles', + 'type': 'none', + 'hard_dependency': 1, + 'actions': [ + { + 'action_name': 'Touch Stylesheet Directory', + 'inputs': ['../styles'], + 'outputs': ['<(SHARED_INTERMEDIATE_DIR)/'], # need to specify a distinct directory + 'action': ['touch', '../styles'], + } + ], + }, + { + 'target_name': 'bundle_styles', + 'type': 'none', + 'hard_dependency': 1, + 'dependencies': [ 'touch_styles' ], # required for xcode http://openradar.appspot.com/7232149 + 'direct_dependent_settings': { + 'mac_bundle_resources': [ '../styles' ], + } + }, + { + 'target_name': 'copy_styles', + 'type': 'none', + 'hard_dependency': 1, + 'dependencies': [ 'touch_styles' ], # required for xcode http://openradar.appspot.com/7232149 + 'copies': [{ + 'files': [ '../styles' ], + 'destination': '<(PRODUCT_DIR)' + }], + }, + ] +} diff --git a/common/nslog_log.hpp b/include/mbgl/platform/darwin/log_nslog.hpp index d40f963036..d40f963036 100644 --- a/common/nslog_log.hpp +++ b/include/mbgl/platform/darwin/log_nslog.hpp diff --git a/common/Reachability.h b/include/mbgl/platform/darwin/reachability.h index 1cf7d2ecea..1cf7d2ecea 100644 --- a/common/Reachability.h +++ b/include/mbgl/platform/darwin/reachability.h diff --git a/common/settings_nsuserdefaults.hpp b/include/mbgl/platform/darwin/settings_nsuserdefaults.hpp index 3533e3da35..3533e3da35 100644 --- a/common/settings_nsuserdefaults.hpp +++ b/include/mbgl/platform/darwin/settings_nsuserdefaults.hpp diff --git a/common/glfw_view.hpp b/include/mbgl/platform/default/glfw_view.hpp index 481b1598bb..481b1598bb 100644 --- a/common/glfw_view.hpp +++ b/include/mbgl/platform/default/glfw_view.hpp diff --git a/common/headless_view.hpp b/include/mbgl/platform/default/headless_view.hpp index 42f9c46da2..42f9c46da2 100644 --- a/common/headless_view.hpp +++ b/include/mbgl/platform/default/headless_view.hpp diff --git a/common/stderr_log.hpp b/include/mbgl/platform/default/log_stderr.hpp index 45f76f0d1a..45f76f0d1a 100644 --- a/common/stderr_log.hpp +++ b/include/mbgl/platform/default/log_stderr.hpp diff --git a/common/settings_json.hpp b/include/mbgl/platform/default/settings_json.hpp index 25c2179ba0..25c2179ba0 100644 --- a/common/settings_json.hpp +++ b/include/mbgl/platform/default/settings_json.hpp diff --git a/ios/mapbox-gl-cocoa b/ios/mapbox-gl-cocoa -Subproject bc2c5fe6974fa99ea4816e9e793757cc1706659 +Subproject cfbd1cfad47802ee5489aef24a59e340b841e49 diff --git a/linux/main.cpp b/linux/main.cpp index a4f9a6298d..604e471dd1 100644 --- a/linux/main.cpp +++ b/linux/main.cpp @@ -1,15 +1,16 @@ #include <mbgl/mbgl.hpp> -#include <mbgl/platform/platform.hpp> #include <mbgl/util/uv.hpp> +#include <mbgl/platform/platform.hpp> +#include <mbgl/platform/default/settings_json.hpp> +#include <mbgl/platform/default/glfw_view.hpp> +#include <mbgl/platform/default/log_stderr.hpp> #include <signal.h> #include <getopt.h> #include <fstream> #include <sstream> -#include "../common/settings_json.hpp" -#include "../common/glfw_view.hpp" -#include "../common/stderr_log.hpp" + GLFWView *view = nullptr; diff --git a/linux/mapboxgl-app.gyp b/linux/mapboxgl-app.gyp index 05716dd11c..09734fc1c4 100644 --- a/linux/mapboxgl-app.gyp +++ b/linux/mapboxgl-app.gyp @@ -1,7 +1,6 @@ { 'includes': [ '../common.gypi', - '../config.gypi', ], 'targets': [ { @@ -10,15 +9,9 @@ 'type': 'executable', 'sources': [ './main.cpp', - '../common/settings_json.cpp', - '../common/settings_json.hpp', - '../common/platform_default.cpp', - '../common/glfw_view.hpp', - '../common/glfw_view.cpp', - '../common/http_request_baton_curl.cpp', - '../common/linux.cpp', - '../common/stderr_log.hpp', - '../common/stderr_log.cpp', + '../platform/default/settings_json.cpp', + '../platform/default/glfw_view.cpp', + '../platform/default/log_stderr.cpp', ], 'conditions': [ @@ -29,11 +22,9 @@ 'xcode_settings': { 'OTHER_CPLUSPLUSFLAGS':[ '<@(glfw3_cflags)', - '<@(curl_cflags)', ], 'OTHER_LDFLAGS': [ '<@(glfw3_libraries)', - '<@(curl_libraries)', ], } }, @@ -42,19 +33,19 @@ { 'cflags': [ '<@(glfw3_cflags)', - '<@(curl_cflags)', ], 'link_settings': { 'libraries': [ '<@(glfw3_libraries)', - '<@(curl_libraries)', - '-lboost_regex' + '-L<(boost_root)/lib', + '-lboost_regex', ], }, }], ], 'dependencies': [ '../mapboxgl.gyp:mapboxgl', + '../mapboxgl.gyp:mapboxgl-linux', '../mapboxgl.gyp:copy_styles', '../mapboxgl.gyp:copy_certificate_bundle', ], diff --git a/macosx/main.mm b/macosx/main.mm index 8cf3cc81c3..81494821cf 100644 --- a/macosx/main.mm +++ b/macosx/main.mm @@ -1,12 +1,10 @@ -#include "../common/settings_nsuserdefaults.hpp" -#include "../common/glfw_view.hpp" -#include "../common/nslog_log.hpp" -#include "../common/Reachability.h" +#include <mbgl/platform/darwin/settings_nsuserdefaults.hpp> +#include <mbgl/platform/darwin/log_nslog.hpp> +#include <mbgl/platform/darwin/Reachability.h> +#include <mbgl/platform/default/glfw_view.hpp> #import <Foundation/Foundation.h> -#include <uv.h> - @interface URLHandler : NSObject @property (nonatomic) mbgl::Map *map; @@ -71,7 +69,6 @@ @end int main() { - fprintf(stderr, "main thread: 0x%lx\n", uv_thread_self()); mbgl::Log::Set<mbgl::NSLogBackend>(); GLFWView view; diff --git a/macosx/mapboxgl-app.gyp b/macosx/mapboxgl-app.gyp index 51f591fdd0..4451a207b4 100644 --- a/macosx/mapboxgl-app.gyp +++ b/macosx/mapboxgl-app.gyp @@ -1,7 +1,6 @@ { 'includes': [ '../common.gypi', - '../config.gypi' ], 'targets': [ { @@ -10,17 +9,11 @@ 'type': 'executable', 'sources': [ './main.mm', - '../common/settings_nsuserdefaults.hpp', - '../common/settings_nsuserdefaults.mm', - '../common/platform_nsstring.mm', - '../common/glfw_view.hpp', - '../common/glfw_view.cpp', - '../common/reachability.h', - '../common/reachability.m', - '../common/http_request_baton_cocoa.mm', - '../common/osx.mm', - '../common/nslog_log.hpp', - '../common/nslog_log.mm', + '../platform/darwin/settings_nsuserdefaults.hpp', + '../platform/darwin/settings_nsuserdefaults.mm', + '../platform/darwin/reachability.m', + '../platform/default/glfw_view.hpp', + '../platform/default/glfw_view.cpp', ], 'product_extension': 'app', 'mac_bundle': 1, @@ -45,6 +38,7 @@ 'dependencies': [ '../mapboxgl.gyp:bundle_styles', '../mapboxgl.gyp:mapboxgl', + '../mapboxgl.gyp:mapboxgl-osx', ] } ] diff --git a/mapboxgl.gyp b/mapboxgl.gyp index bdecb94d06..64c0ccc0c7 100644 --- a/mapboxgl.gyp +++ b/mapboxgl.gyp @@ -1,248 +1,16 @@ { 'includes': [ './common.gypi', + './gyp/shaders.gypi', + './gyp/npm_install.gypi', + './gyp/styles.gypi', + './gyp/fixtures.gypi', + './gyp/certificates.gypi', + './gyp/library.gypi', + ], + 'conditions': [ + ['platform == "osx"', { 'includes': ['./gyp/platform-osx.gypi'] }], + ['platform == "ios"', { 'includes': ['./gyp/platform-ios.gypi'] }], + ['platform == "linux"', { 'includes': ['./gyp/platform-linux.gypi'] }], ], - 'targets': [ - { - 'target_name': 'shaders', - 'type': 'none', - 'hard_dependency': 1, - 'dependencies': [ - 'npm_install' - ], - 'actions': [ - { - 'action_name': 'Build Shaders', - 'inputs': [ - '<!@(find src -name "*.glsl")' - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/shader/shaders.hpp', - '<(SHARED_INTERMEDIATE_DIR)/src/shader/shaders_gl.cpp', - '<(SHARED_INTERMEDIATE_DIR)/src/shader/shaders_gles2.cpp', - ], - 'action': ['<@(node)', 'bin/build-shaders.js', '<(SHARED_INTERMEDIATE_DIR)'], - } - ], - 'direct_dependent_settings': { - 'sources': [ - '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/shader/shaders.hpp', - '<(SHARED_INTERMEDIATE_DIR)/src/shader/shaders_gl.cpp', - '<(SHARED_INTERMEDIATE_DIR)/src/shader/shaders_gles2.cpp' - ], - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)/include/', - ] - } - }, - { - 'target_name': 'npm_install', - 'type': 'none', - 'hard_dependency': 1, - 'actions': [ - { - 'action_name': 'npm install', - 'inputs': [ - 'bin/package.json', - ], - 'outputs': [ - 'bin/node_modules', - ], - 'action': ['./scripts/npm_install.sh', '<@(npm)'] - } - ], - }, - { - 'target_name': 'touch_styles', - 'type': 'none', - 'hard_dependency': 1, - 'actions': [ - { - 'action_name': 'Touch Stylesheet Directory', - 'inputs': ['styles'], - 'outputs': ['<(SHARED_INTERMEDIATE_DIR)/'], # need to specify a distinct directory - 'action': ['touch', 'styles'], - } - ], - }, - { - 'target_name': 'bundle_styles', - 'type': 'none', - 'hard_dependency': 1, - 'dependencies': [ 'touch_styles' ], # required for xcode http://openradar.appspot.com/7232149 - 'direct_dependent_settings': { - 'mac_bundle_resources': [ 'styles' ], - } - }, - { - 'target_name': 'copy_styles', - 'type': 'none', - 'hard_dependency': 1, - 'dependencies': [ 'touch_styles' ], # required for xcode http://openradar.appspot.com/7232149 - 'copies': [{ - 'files': [ 'styles' ], - 'destination': '<(PRODUCT_DIR)' - }], - }, - { - 'target_name': 'copy_fixtures', - 'type': 'none', - 'hard_dependency': 1, - 'dependencies': [ - 'bundle_styles' - ], - 'copies': [ - { - 'files': [ 'styles' ], - 'destination': 'test/fixtures/style_parser' - } - ] - }, - { - 'target_name': 'copy_certificate_bundle', - 'type': 'none', - 'hard_dependency': 1, - 'copies': [{ - 'files': [ 'common/ca-bundle.crt' ], - 'destination': '<(PRODUCT_DIR)' - }], - }, - { - 'target_name': 'mapboxgl', - 'product_name': 'mapboxgl', - 'type': 'static_library', - 'hard_dependency': 1, - 'dependencies': [ - 'shaders', - ], - 'sources': [ - '<!@(find src -name "*.cpp")', - '<!@(test -f "config/constants_local.cpp" && echo "config/constants_local.cpp" || echo "config/constants.cpp")', - '<!@(find src -name "*.c")', - '<!@(find src -name "*.h")', - '<!@(find include -name "*.hpp")', - '<!@(find include -name "*.h")', - '<!@(find src -name "*.glsl")', - 'bin/style.json' - ], - 'include_dirs': [ - './include' - ], - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'SDKROOT': 'macosx', - 'SUPPORTED_PLATFORMS': ['macosx'], - 'MACOSX_DEPLOYMENT_TARGET': '10.9', - 'PUBLIC_HEADERS_FOLDER_PATH': 'include', - 'OTHER_CPLUSPLUSFLAGS': [ - '<@(png_cflags)', - '<@(uv_cflags)', - '<@(sqlite3_cflags)', - '<@(zlib_cflags)', - '-I<(boost_root)/include', - ], - 'OTHER_CFLAGS': [ - '<@(uv_cflags)', - ], - }, - }, { - 'cflags': [ - '<@(png_cflags)', - '<@(uv_cflags)', - '<@(sqlite3_cflags)', - '<@(zlib_cflags)', - '-I<(boost_root)/include', - ], - }] - ], - 'direct_dependent_settings': { - 'include_dirs': [ - './include', - ], - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ - '<@(uv_cflags)', - ], - 'OTHER_LDFLAGS': [ - '<@(png_libraries)', - '<@(uv_libraries)', - '<@(sqlite3_libraries)', - '<@(zlib_libraries)', - ] - } - }, { - 'cflags': [ - '<@(uv_cflags)', - ], - 'libraries': [ - '<@(png_libraries)', - '<@(uv_libraries)', - '<@(sqlite3_libraries)', - '<@(zlib_libraries)', - ] - }] - ] - } - }, - { - 'target_name': 'mapboxgl-ios', - 'product_name': 'mapboxgl-ios', - 'type': 'static_library', - 'hard_dependency': 1, - 'dependencies': [ - 'shaders', - ], - 'sources': [ - '<!@(find src/ \( -name "*.cpp" ! -name shaders.hpp ! -name shaders_gles2.cpp ! -name shaders_gl.cpp \))', - '<!@(test -f "config/constants_local.cpp" && echo "config/constants_local.cpp" || echo "config/constants.cpp")', - '<!@(find src -name "*.c")', - '<!@(find src -name "*.h")', - '<!@(find include -name "*.hpp")', - '<!@(find include -name "*.h")', - '<!@(find src -name "*.glsl")', - 'bin/style.json' - ], - 'xcode_settings': { - 'SDKROOT': 'iphoneos', - 'SUPPORTED_PLATFORMS': 'iphonesimulator iphoneos', - 'TARGETED_DEVICE_FAMILY': '1,2', - 'CODE_SIGN_IDENTITY': 'iPhone Developer', - 'IPHONEOS_DEPLOYMENT_TARGET': '7.0', - 'PUBLIC_HEADERS_FOLDER_PATH': 'include', - 'GCC_INPUT_FILETYPE': 'sourcecode.cpp.cpp', - 'OTHER_CPLUSPLUSFLAGS': [ - '<@(png_cflags)', - '<@(uv_cflags)', - '<@(sqlite3_cflags)', - '<@(zlib_cflags)', - '-I<(boost_root)/include', - ], - }, - 'include_dirs': [ - './include' - ], - 'direct_dependent_settings': { - 'include_dirs': [ - './include', - ], - 'xcode_settings': { - 'OTHER_LDFLAGS': [ - '<@(png_libraries)', - '<@(uv_libraries)', - '<@(sqlite3_libraries)', - '<@(zlib_libraries)', - ], - 'OTHER_CPLUSPLUSFLAGS': [ - '<@(uv_cflags)', - ], - 'OTHER_CFLAGS': [ - '<@(uv_cflags)', - ], - } - } - } - ] } diff --git a/common/http_request_baton_cocoa.mm b/platform/darwin/http_request_baton_cocoa.mm index a9992fad8c..a9992fad8c 100644 --- a/common/http_request_baton_cocoa.mm +++ b/platform/darwin/http_request_baton_cocoa.mm diff --git a/common/nslog_log.mm b/platform/darwin/log_nslog.mm index 12230143ac..231037b2dd 100644 --- a/common/nslog_log.mm +++ b/platform/darwin/log_nslog.mm @@ -1,4 +1,4 @@ -#include "nslog_log.hpp" +#include "log_nslog.hpp" #import <Foundation/Foundation.h> diff --git a/common/Reachability.m b/platform/darwin/reachability.m index c6f6388f52..8234659402 100644 --- a/common/Reachability.m +++ b/platform/darwin/reachability.m @@ -25,7 +25,7 @@ POSSIBILITY OF SUCH DAMAGE. */ -#import "Reachability.h" +#import <mbgl/platform/darwin/reachability.h> NSString *const kReachabilityChangedNotification = @"kReachabilityChangedNotification"; diff --git a/common/settings_nsuserdefaults.mm b/platform/darwin/settings_nsuserdefaults.mm index dfc601bddb..b9b0e134bf 100644 --- a/common/settings_nsuserdefaults.mm +++ b/platform/darwin/settings_nsuserdefaults.mm @@ -1,6 +1,6 @@ #import <Foundation/Foundation.h> -#include "settings_nsuserdefaults.hpp" +#include <mbgl/platform/darwin/settings_nsuserdefaults.hpp> using namespace mbgl; diff --git a/common/platform_nsstring.mm b/platform/darwin/string_nsstring.mm index 9119f2a8fe..9b1dc745cb 100644 --- a/common/platform_nsstring.mm +++ b/platform/darwin/string_nsstring.mm @@ -18,4 +18,4 @@ std::string lowercase(const std::string &string) { } } -}
\ No newline at end of file +} diff --git a/common/linux.cpp b/platform/default/cache_database_tmp.cpp index 6132ace692..6132ace692 100644 --- a/common/linux.cpp +++ b/platform/default/cache_database_tmp.cpp diff --git a/common/glfw_view.cpp b/platform/default/glfw_view.cpp index edfb3a6a6f..fed21f7d96 100644 --- a/common/glfw_view.cpp +++ b/platform/default/glfw_view.cpp @@ -1,4 +1,4 @@ -#include "glfw_view.hpp" +#include <mbgl/platform/default/glfw_view.hpp> #include <mbgl/util/string.hpp> diff --git a/common/headless_view.cpp b/platform/default/headless_view.cpp index ace41d38c0..ace41d38c0 100644 --- a/common/headless_view.cpp +++ b/platform/default/headless_view.cpp diff --git a/common/http_request_baton_curl.cpp b/platform/default/http_request_baton_curl.cpp index d4753266c0..d4753266c0 100644 --- a/common/http_request_baton_curl.cpp +++ b/platform/default/http_request_baton_curl.cpp diff --git a/common/stderr_log.cpp b/platform/default/log_stderr.cpp index bcb84447bb..62938b6d63 100644 --- a/common/stderr_log.cpp +++ b/platform/default/log_stderr.cpp @@ -1,4 +1,4 @@ -#include "stderr_log.hpp" +#include <mbgl/platform/default/log_stderr.hpp> #include <iostream> #include <cstdarg> diff --git a/common/settings_json.cpp b/platform/default/settings_json.cpp index f2f1248aa6..f81c75115e 100644 --- a/common/settings_json.cpp +++ b/platform/default/settings_json.cpp @@ -1,4 +1,4 @@ -#include "settings_json.hpp" +#include <mbgl/platform/default/settings_json.hpp> #include <rapidjson/prettywriter.h> #include <rapidjson/filestream.h> #include <rapidjson/document.h> diff --git a/common/platform_default.cpp b/platform/default/string_stdlib.cpp index 1acbfa8508..1acbfa8508 100644 --- a/common/platform_default.cpp +++ b/platform/default/string_stdlib.cpp diff --git a/common/ios.mm b/platform/ios/cache_database_library.mm index 7989e73a4e..7989e73a4e 100644 --- a/common/ios.mm +++ b/platform/ios/cache_database_library.mm diff --git a/common/osx.mm b/platform/osx/cache_database_application_support.mm index 974ea537cb..974ea537cb 100644 --- a/common/osx.mm +++ b/platform/osx/cache_database_application_support.mm diff --git a/test/test.gyp b/test/test.gyp index 1f63756e71..865bac8673 100644 --- a/test/test.gyp +++ b/test/test.gyp @@ -1,7 +1,6 @@ { 'includes': [ '../common.gypi', - '../config.gypi' ], 'targets': [ { |