From 917c0168abcb964d2b7f75ff7bae80e0b5e61c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Tue, 9 Dec 2014 14:14:11 +0100 Subject: [PATCH] don't include the source file in every library --- gyp/version.gypi | 4 +--- scripts/build-version.py | 27 --------------------------- src/mbgl/util/version_info.cpp | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 30 deletions(-) create mode 100644 src/mbgl/util/version_info.cpp diff --git a/gyp/version.gypi b/gyp/version.gypi index ca68f0eb5..341d9d3a2 100644 --- a/gyp/version.gypi +++ b/gyp/version.gypi @@ -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)', ' - -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) diff --git a/src/mbgl/util/version_info.cpp b/src/mbgl/util/version_info.cpp new file mode 100644 index 000000000..1d649d2b6 --- /dev/null +++ b/src/mbgl/util/version_info.cpp @@ -0,0 +1,14 @@ +#include + +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; + +} +} \ No newline at end of file