Merge pull request #709 from mapbox/version-header-only

Include version symbols only in mbgl-core library
This commit is contained in:
Konstantin Käfer
2014-12-09 14:54:17 +01:00
4 changed files with 17 additions and 31 deletions

View File

@@ -16,7 +16,8 @@
{ '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': [ '../include/mbgl' ], 'destination': '<(install_prefix)/include' }
{ 'files': [ '../include/mbgl' ], 'destination': '<(install_prefix)/include' },
{ 'files': [ '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp' ], 'destination': '<(install_prefix)/include/mbgl/util' },
],
'variables': {
'conditions': [

View File

@@ -6,13 +6,12 @@
'hard_dependency': 1,
'actions': [
{
'action_name': 'Build Version File',
'action_name': 'Build Version Header',
'inputs': [
'../scripts/build-version.py',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp',
'<(SHARED_INTERMEDIATE_DIR)/src/mbgl/util/mbgl_version.cpp',
],
'action': ['<@(python)', 'scripts/build-version.py', '<(SHARED_INTERMEDIATE_DIR)', '<!@(git describe --tags --always --abbrev=0)', '<!@(git rev-parse HEAD)'],
}
@@ -20,7 +19,6 @@
'direct_dependent_settings': {
'sources': [
'<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp',
'<(SHARED_INTERMEDIATE_DIR)/src/mbgl/util/mbgl_version.cpp',
],
'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)/include',

View File

@@ -60,30 +60,3 @@ header_path = os.path.join(output_dir, 'include/mbgl/util/version.hpp')
mkdir_p(os.path.dirname(header_path))
with open(header_path, 'w') as f: f.write(header)
source = """// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
#include <mbgl/util/version.hpp>
namespace mbgl {{
namespace version {{
const int major = {major};
const int minor = {minor};
const int patch = {patch};
const char *revision = "{rev}";
const char *string = "{major}.{minor}.{patch}";
const unsigned int number = 0x{major:02x}{minor:02x}{patch:02x};
}}
}}
""".format(
major = tag[0],
minor = tag[1],
patch = tag[2],
rev = rev
)
# Note: We can't use version.cpp since libuv already has a file named version.c.
# Having another one here would overwrite that file and cause missing symbols errors.
source_path = os.path.join(output_dir, 'src/mbgl/util/mbgl_version.cpp')
mkdir_p(os.path.dirname(source_path))
with open(source_path, 'w') as f: f.write(source)

View File

@@ -0,0 +1,14 @@
#include <mbgl/util/version.hpp>
namespace mbgl {
namespace version {
const int major = MBGL_VERSION_MAJOR;
const int minor = MBGL_VERSION_MINOR;
const int patch = MBGL_VERSION_PATCH;
const char *revision = MBGL_VERSION_REV;
const char *string = MBGL_VERSION_STRING;
const unsigned int number = MBGL_VERSION;
}
}