1#!/usr/bin/env bash 2# Copyright 2016 The TensorFlow Authors. All Rights Reserved. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# ============================================================================== 16 17OUTPUT_FILENAME=$1 18if [[ -z "${OUTPUT_FILENAME}" ]]; then 19 echo "Usage: $0 <filename>" 20 exit 1 21fi 22 23GIT_VERSION=$(git describe --long --tags) 24if [[ $? != 0 ]]; then 25 GIT_VERSION=unknown; 26fi 27 28cat <<EOF > ${OUTPUT_FILENAME} 29#include <string> 30const char* tf_git_version() {return "${GIT_VERSION}";} 31const char* tf_compiler_version() { 32#ifdef _MSC_VER 33#define STRINGIFY(x) #x 34#define TOSTRING(x) STRINGIFY(x) 35 return "MSVC " TOSTRING(_MSC_FULL_VER); 36#else 37 return __VERSION__; 38#endif 39} 40const int tf_cxx11_abi_flag() { 41#ifdef _GLIBCXX_USE_CXX11_ABI 42 return _GLIBCXX_USE_CXX11_ABI; 43#else 44 return 0; 45#endif 46} 47const int tf_monolithic_build() { 48#ifdef TENSORFLOW_MONOLITHIC_BUILD 49 return 1; 50#else 51 return 0; 52#endif 53} 54EOF 55 56