add LLVM_VERSION_MAJOR and _MINOR defines

This is useful for clients that want to maintain compatibility
across multiple releases of LLVM. Currently users like Klee and
Mesa all have to roll their own 'parse llvm-config --version
output and generate defines' solution.

Also reuse the new macros so that version information is less
redundant/likely to fall out of sync again in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150405 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dylan Noblesmith 2012-02-13 18:48:10 +00:00
parent 3ed4dee530
commit fde8237cd9
8 changed files with 45 additions and 4 deletions

View File

@ -10,7 +10,10 @@ set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
)
set(PACKAGE_VERSION "3.1svn")
set(LLVM_VERSION_MAJOR 3)
set(LLVM_VERSION_MINOR 1)
set(PACKAGE_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}svn")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
@ -411,8 +414,8 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
# TODO: make and install documentation.
set(CPACK_PACKAGE_VENDOR "LLVM")
set(CPACK_PACKAGE_VERSION_MAJOR 3)
set(CPACK_PACKAGE_VERSION_MINOR 1)
set(CPACK_PACKAGE_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${LLVM_VERSION_MINOR})
add_version_info_from_vcs(CPACK_PACKAGE_VERSION_PATCH)
include(CPack)

View File

@ -32,6 +32,8 @@ dnl===-----------------------------------------------------------------------===
dnl Initialize autoconf and define the package name, version number and
dnl address for reporting bugs.
AC_INIT([LLVM],[3.1svn],[http://llvm.org/bugs/])
AC_DEFINE([LLVM_VERSION_MAJOR], [3], [Major version of the LLVM API])
AC_DEFINE([LLVM_VERSION_MINOR], [1], [Minor version of the LLVM API])
dnl Provide a copyright substitution and ensure the copyright notice is included
dnl in the output of --version option of the generated configure script.

View File

@ -1,5 +1,7 @@
# This file provides information and services to the final user.
set(LLVM_VERSION_MAJOR @LLVM_VERSION_MAJOR@)
set(LLVM_VERSION_MINOR @LLVM_VERSION_MINOR@)
set(LLVM_PACKAGE_VERSION @PACKAGE_VERSION@)
set(LLVM_COMMON_DEPENDS @LLVM_COMMON_DEPENDS@)

12
configure vendored
View File

@ -1898,6 +1898,16 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
cat >>confdefs.h <<\_ACEOF
#define LLVM_VERSION_MAJOR 3
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define LLVM_VERSION_MINOR 1
_ACEOF
LLVM_COPYRIGHT="Copyright (c) 2003-2012 University of Illinois at Urbana-Champaign."
@ -10453,7 +10463,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 10456 "configure"
#line 10466 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H

View File

@ -617,6 +617,12 @@
/* Installation prefix directory */
#cmakedefine LLVM_PREFIX "${LLVM_PREFIX}"
/* Major version of the LLVM API */
#cmakedefine LLVM_VERSION_MAJOR ${LLVM_VERSION_MAJOR}
/* Minor version of the LLVM API */
#cmakedefine LLVM_VERSION_MINOR ${LLVM_VERSION_MINOR}
/* Define if the OS needs help to load dependent libraries for dlopen(). */
#cmakedefine LTDL_DLOPEN_DEPLIBS ${LTDL_DLOPEN_DEPLIBS}

View File

@ -615,6 +615,12 @@
/* Installation prefix directory */
#undef LLVM_PREFIX
/* Major version of the LLVM API */
#undef LLVM_VERSION_MAJOR
/* Minor version of the LLVM API */
#undef LLVM_VERSION_MINOR
/* Define if the OS needs help to load dependent libraries for dlopen(). */
#undef LTDL_DLOPEN_DEPLIBS

View File

@ -106,4 +106,10 @@
/* Installation prefix directory */
#cmakedefine LLVM_PREFIX "${LLVM_PREFIX}"
/* Major version of the LLVM API */
#cmakedefine LLVM_VERSION_MAJOR ${LLVM_VERSION_MAJOR}
/* Minor version of the LLVM API */
#cmakedefine LLVM_VERSION_MINOR ${LLVM_VERSION_MINOR}
#endif

View File

@ -106,4 +106,10 @@
/* Installation prefix directory */
#undef LLVM_PREFIX
/* Major version of the LLVM API */
#undef LLVM_VERSION_MAJOR
/* Minor version of the LLVM API */
#undef LLVM_VERSION_MINOR
#endif