From fde8237cd9c7e0eb503e6c53994c9c9d19cbb4c6 Mon Sep 17 00:00:00 2001 From: Dylan Noblesmith Date: Mon, 13 Feb 2012 18:48:10 +0000 Subject: [PATCH] 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 --- CMakeLists.txt | 9 ++++++--- autoconf/configure.ac | 2 ++ cmake/modules/LLVMConfig.cmake.in | 2 ++ configure | 12 +++++++++++- include/llvm/Config/config.h.cmake | 6 ++++++ include/llvm/Config/config.h.in | 6 ++++++ include/llvm/Config/llvm-config.h.cmake | 6 ++++++ include/llvm/Config/llvm-config.h.in | 6 ++++++ 8 files changed, 45 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 522c91c495f..5313d110d2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 0691f1fd4d1..3a86531a9d9 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -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. diff --git a/cmake/modules/LLVMConfig.cmake.in b/cmake/modules/LLVMConfig.cmake.in index 6b202b2e7e8..443ec415328 100644 --- a/cmake/modules/LLVMConfig.cmake.in +++ b/cmake/modules/LLVMConfig.cmake.in @@ -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@) diff --git a/configure b/configure index 7acea4e63a1..060d1e63291 100755 --- a/configure +++ b/configure @@ -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 <