allow installing the library

This commit is contained in:
Konstantin Käfer
2014-10-27 10:05:05 -04:00
parent 0e928b5204
commit 84700fce90
18 changed files with 97 additions and 53 deletions

View File

@@ -1,6 +1,7 @@
BUILDTYPE ?= Release
PYTHON ?= python
V ?= 1
PREFIX ?= /usr/local
ifeq ($(shell uname -s), Darwin)
PLATFORM ?= osx
@@ -19,7 +20,11 @@ config-ios.gypi: configure
# Builds the regular library
mbgl: config.gypi mapboxgl.gyp
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
$(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) mbgl
install: config.gypi mapboxgl.gyp
deps/run_gyp mapboxgl.gyp -Iconfig.gypi -Dplatform=$(PLATFORM) -Dinstall_prefix=$(PREFIX) --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make
$(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) install
##### Test cases ###############################################################
@@ -104,5 +109,5 @@ clean: clear_xcode_cache
distclean: clean
-rm -rf ./mason_packages
.PHONY: mbgl test linux clear_xcode_cache build/test/Makefile clean distclean
.PHONY: mbgl install test linux clear_xcode_cache build/test/Makefile clean distclean
# DO NOT DELETE

View File

@@ -1,7 +1,6 @@
{
'targets': [
{
'target_name': 'copy_certificate_bundle',
{ 'target_name': 'copy_certificate_bundle',
'type': 'none',
'hard_dependency': 1,
'copies': [{

View File

@@ -1,4 +1,7 @@
{
'variables': {
'install_prefix%': '',
},
'target_defaults': {
'default_configuration': 'Release',
'conditions': [

View File

@@ -1,7 +1,6 @@
{
'targets': [
{
'target_name': 'copy_fixtures',
{ 'target_name': 'copy_fixtures',
'type': 'none',
'hard_dependency': 1,
'dependencies': [

23
gyp/install.gypi Normal file
View File

@@ -0,0 +1,23 @@
{
'conditions': [
['install_prefix != ""', {
'targets': [
{ 'target_name': 'install',
'type': 'none',
'hard_dependency': 1,
'dependencies': [
'mbgl',
'mbgl-headless',
'mbgl-<(platform)',
],
'copies': [
{ 'files': [ '<(PRODUCT_DIR)/libmbgl.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': [ '../include/mbgl' ], 'destination': '<(install_prefix)/include' }
],
},
]
}],
],
}

15
gyp/mbgl-headless.gypi Normal file
View File

@@ -0,0 +1,15 @@
{
'targets': [
{ 'target_name': 'mbgl-headless',
'product_name': 'mbgl-headless',
'type': 'static_library',
'include_dirs': [
'../include',
],
'sources': [
'../platform/default/headless_view.cpp',
'../platform/default/headless_display.cpp',
],
},
]
}

View File

@@ -18,10 +18,10 @@
],
},
'targets': [
{
'target_name': 'mapboxgl-ios',
'product_name': 'mapboxgl-ios',
{ 'target_name': 'mbgl-ios',
'product_name': 'mbgl-ios',
'type': 'static_library',
'hard_dependency': 1,
'include_dirs': [
'../include',
],

View File

@@ -1,9 +1,9 @@
{
'targets': [
{
'target_name': 'mapboxgl-linux',
'product_name': 'mapboxgl-linux',
{ 'target_name': 'mbgl-linux',
'product_name': 'mbgl-linux',
'type': 'static_library',
'hard_dependency': 1,
'include_dirs': [
'../include'
],

View File

@@ -1,9 +1,9 @@
{
'targets': [
{
'target_name': 'mapboxgl-osx',
'product_name': 'mapboxgl-osx',
{ 'target_name': 'mbgl-osx',
'product_name': 'mbgl-osx',
'type': 'static_library',
'hard_dependency': 1,
'include_dirs': [
'../include',
],

16
gyp/mbgl-platform.gypi Normal file
View File

@@ -0,0 +1,16 @@
{
'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' },
}],
],
}

View File

@@ -1,8 +1,7 @@
{
'targets': [
{
'target_name': 'mapboxgl',
'product_name': 'mapboxgl',
{ 'target_name': 'mbgl',
'product_name': 'mbgl',
'type': 'static_library',
'hard_dependency': 1,
'dependencies': [

View File

@@ -1,7 +1,6 @@
{
'targets': [
{
'target_name': 'npm_install',
{ 'target_name': 'npm_install',
'type': 'none',
'hard_dependency': 1,
'actions': [

View File

@@ -1,16 +0,0 @@
{
'conditions': [
['platform == "osx"', {
'includes': ['platform-osx.gypi'],
'variables': { 'platform_library': 'mapboxgl-osx' },
}],
['platform == "ios"', {
'includes': ['platform-ios.gypi'],
'variables': { 'platform_library': 'mapboxgl-ios' },
}],
['platform == "linux"', {
'includes': ['platform-linux.gypi'],
'variables': { 'platform_library': 'mapboxgl-linux' },
}],
],
}

View File

@@ -44,8 +44,8 @@
}],
],
'dependencies': [
'../mapboxgl.gyp:mapboxgl',
'../mapboxgl.gyp:mapboxgl-linux',
'../mapboxgl.gyp:mbgl',
'../mapboxgl.gyp:mbgl-linux',
'../mapboxgl.gyp:copy_styles',
'../mapboxgl.gyp:copy_certificate_bundle',
],

View File

@@ -37,8 +37,8 @@
},
'dependencies': [
'../mapboxgl.gyp:bundle_styles',
'../mapboxgl.gyp:mapboxgl',
'../mapboxgl.gyp:mapboxgl-osx',
'../mapboxgl.gyp:mbgl',
'../mapboxgl.gyp:mbgl-osx',
]
}
]

View File

@@ -6,7 +6,9 @@
'./gyp/styles.gypi',
'./gyp/fixtures.gypi',
'./gyp/certificates.gypi',
'./gyp/library.gypi',
'./gyp/platform.gypi',
'./gyp/mbgl.gypi',
'./gyp/mbgl-platform.gypi',
'./gyp/mbgl-headless.gypi',
'./gyp/install.gypi',
],
}

View File

@@ -1,7 +1,7 @@
{
'includes': [
'../gyp/common.gypi',
'../gyp/platform.gypi',
'../gyp/mbgl-platform.gypi',
],
'targets': [
{ 'target_name': 'rotation_range',
@@ -13,7 +13,7 @@
],
'dependencies': [
'../deps/gtest/gtest.gyp:gtest',
'../mapboxgl.gyp:mapboxgl',
'../mapboxgl.gyp:mbgl',
]
},
{ 'target_name': 'clip_ids',
@@ -25,7 +25,7 @@
],
'dependencies': [
'../deps/gtest/gtest.gyp:gtest',
'../mapboxgl.gyp:mapboxgl',
'../mapboxgl.gyp:mbgl',
]
},
{ 'target_name': 'enums',
@@ -37,7 +37,7 @@
],
'dependencies': [
'../deps/gtest/gtest.gyp:gtest',
'../mapboxgl.gyp:mapboxgl',
'../mapboxgl.gyp:mbgl',
]
},
{ 'target_name': 'style_parser',
@@ -51,7 +51,7 @@
],
'dependencies': [
'../deps/gtest/gtest.gyp:gtest',
'../mapboxgl.gyp:mapboxgl',
'../mapboxgl.gyp:mbgl',
'../mapboxgl.gyp:copy_fixtures',
]
},
@@ -64,7 +64,7 @@
],
'dependencies': [
'../deps/gtest/gtest.gyp:gtest',
'../mapboxgl.gyp:mapboxgl',
'../mapboxgl.gyp:mbgl',
]
},
{ 'target_name': 'comparisons',
@@ -76,7 +76,7 @@
],
'dependencies': [
'../deps/gtest/gtest.gyp:gtest',
'../mapboxgl.gyp:mapboxgl',
'../mapboxgl.gyp:mbgl',
]
},
{ 'target_name': 'tile',
@@ -88,7 +88,7 @@
],
'dependencies': [
'../deps/gtest/gtest.gyp:gtest',
'../mapboxgl.gyp:mapboxgl',
'../mapboxgl.gyp:mbgl',
]
},
{ 'target_name': 'functions',
@@ -100,7 +100,7 @@
],
'dependencies': [
'../deps/gtest/gtest.gyp:gtest',
'../mapboxgl.gyp:mapboxgl',
'../mapboxgl.gyp:mbgl',
]
},
{ 'target_name': 'headless',
@@ -130,7 +130,7 @@
],
'dependencies': [
'../deps/gtest/gtest.gyp:gtest',
'../mapboxgl.gyp:mapboxgl',
'../mapboxgl.gyp:mbgl',
'<(platform_library)',
],
},