mirror of
https://github.com/reactos/reactos.git
synced 2024-08-19 09:59:44 +00:00
[CMAKE]
Use cmake subversion capabilities to generate buildno.h and version.h. svn path=/branches/cmake-bringup/; revision=50454
This commit is contained in:
parent
1da8f22b84
commit
5f1a2314f2
|
@ -2,6 +2,9 @@
|
|||
cmake_minimum_required(VERSION 2.6)
|
||||
project(REACTOS)
|
||||
|
||||
#versioning
|
||||
include(include/reactos/version.cmake)
|
||||
|
||||
# Don't escape preprocessor definition values added via add_definitions
|
||||
cmake_policy(SET CMP0005 OLD)
|
||||
|
||||
|
@ -44,9 +47,9 @@ if(NOT CMAKE_CROSSCOMPILING)
|
|||
add_subdirectory(lib)
|
||||
|
||||
if(NOT MSVC)
|
||||
export(TARGETS widl nci buildno gendib cabman cdmake mkhive spec2def geninc FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
|
||||
export(TARGETS widl nci gendib cabman cdmake mkhive spec2def geninc FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
|
||||
else()
|
||||
export(TARGETS nci buildno gendib cabman cdmake mkhive spec2def geninc FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
|
||||
export(TARGETS nci gendib cabman cdmake mkhive spec2def geninc FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
|
||||
endif()
|
||||
|
||||
else()
|
||||
|
@ -221,11 +224,6 @@ if(CMAKE_CROSSCOMPILING)
|
|||
|
||||
file(MAKE_DIRECTORY ${REACTOS_BINARY_DIR}/include/reactos)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${REACTOS_BINARY_DIR}/include/reactos/buildno.h
|
||||
COMMAND native-buildno ${REACTOS_BINARY_DIR}/include/reactos/buildno.h
|
||||
DEPENDS ${REACTOS_SOURCE_DIR}/include/reactos/version.h)
|
||||
|
||||
add_custom_target(buildno_header ALL DEPENDS ${REACTOS_BINARY_DIR}/include/reactos/buildno.h)
|
||||
|
||||
file(MAKE_DIRECTORY ${REACTOS_BINARY_DIR}/subsystems/win32/win32k/dib)
|
||||
|
|
18
include/reactos/buildno.h.cmake
Normal file
18
include/reactos/buildno.h.cmake
Normal file
|
@ -0,0 +1,18 @@
|
|||
/* Do not edit - Machine generated */
|
||||
#ifndef _INC_REACTOS_BUILDNO
|
||||
#define _INC_REACTOS_BUILDNO
|
||||
#define KERNEL_VERSION_BUILD @KERNEL_VERSION_BUILD@
|
||||
#define KERNEL_VERSION_BUILD_HEX 0x@KERNEL_VERSION_BUILD_HEX@
|
||||
#define KERNEL_VERSION_BUILD_STR "@KERNEL_VERSION_BUILD@@REVISION@"
|
||||
#define KERNEL_VERSION_BUILD_RC "@KERNEL_VERSION_BUILD@@REVISION@\0"
|
||||
#define KERNEL_RELEASE_RC "@KERNEL_VERSION@\0"
|
||||
#define KERNEL_RELEASE_STR "@KERNEL_VERSION@"
|
||||
#define KERNEL_VERSION_RC "@KERNEL_VERSION@\0"
|
||||
#define KERNEL_VERSION_STR "@KERNEL_VERSION@"
|
||||
#define REACTOS_DLL_VERSION_MAJOR @REACTOS_DLL_VERSION_MAJOR@
|
||||
#define REACTOS_DLL_RELEASE_RC "@DLL_VERSION_STR@\0"
|
||||
#define REACTOS_DLL_RELEASE_STR "@DLL_VERSION_STR@"
|
||||
#define REACTOS_DLL_VERSION_RC "@DLL_VERSION_STR@\0"
|
||||
#define REACTOS_DLL_VERSION_STR "@DLL_VERSION_STR@"
|
||||
#endif
|
||||
/* EOF */
|
64
include/reactos/version.cmake
Normal file
64
include/reactos/version.cmake
Normal file
|
@ -0,0 +1,64 @@
|
|||
macro(today RESULT)
|
||||
if (WIN32)
|
||||
#execute_process(COMMAND "cmd" "/c" "date" "/T" OUTPUT_VARIABLE ${RESULT})
|
||||
#string(REGEX REPLACE "(..)/(..)/(....).*" "\\3\\2\\1" ${RESULT} ${${RESULT}})
|
||||
execute_process(COMMAND "${REACTOS_SOURCE_DIR}/tools/getdate.cmd" OUTPUT_VARIABLE ${RESULT})
|
||||
string(STRIP ${${RESULT}} ${RESULT})
|
||||
elseif(UNIX)
|
||||
execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE ${${RESULT}})
|
||||
else (WIN32)
|
||||
message(SEND_ERROR "date not implemented")
|
||||
set(${RESULT} 00000000)
|
||||
endif (WIN32)
|
||||
endmacro(today)
|
||||
|
||||
macro(inttohex INTVALUE OUTPUT_VARIABLE)
|
||||
list(APPEND HEXLIST 0 1 2 3 4 5 6 7 8 9 a b c d e f)
|
||||
list(GET HEXLIST ${INTVALUE} ${OUTPUT_VARIABLE})
|
||||
endmacro()
|
||||
|
||||
macro(converttohex INTVALUE OUTPUT_VARIABLE)
|
||||
set(REMAINING ${INTVALUE})
|
||||
while(REMAINING)
|
||||
math(EXPR REMAINDER "${REMAINING}%16")
|
||||
inttohex(${REMAINDER} HEXCHAR)
|
||||
math(EXPR REMAINING "${REMAINING}/16")
|
||||
set(${OUTPUT_VARIABLE} "${HEXCHAR}${${OUTPUT_VARIABLE}}")
|
||||
endwhile()
|
||||
endmacro()
|
||||
|
||||
today(KERNEL_VERSION_BUILD)
|
||||
|
||||
set(KERNEL_VERSION_MAJOR "0")
|
||||
set(KERNEL_VERSION_MINOR "4")
|
||||
set(KERNEL_VERSION_PATCH_LEVEL "0")
|
||||
set(COPYRIGHT_YEAR "2011")
|
||||
# KERNEL_VERSION_BUILD_TYPE is "SVN", "RC1", "RC2" or "" (for the release)
|
||||
set(KERNEL_VERSION_BUILD_TYPE "SVN")
|
||||
|
||||
|
||||
set(KERNEL_VERSION "${KERNEL_VERSION_MAJOR}.${KERNEL_VERSION_MINOR}")
|
||||
if(KERNEL_VERSION_PATCH_LEVEL)
|
||||
set(KERNEL_VERSION "${KERNEL_VERSION}.${KERNEL_VERSION_PATCH_LEVEL}-${KERNEL_VERSION_BUILD_TYPE}")
|
||||
else()
|
||||
set(KERNEL_VERSION "${KERNEL_VERSION}-${KERNEL_VERSION_BUILD_TYPE}")
|
||||
endif()
|
||||
|
||||
math(EXPR REACTOS_DLL_VERSION_MAJOR "${KERNEL_VERSION_MAJOR}+42")
|
||||
set(DLL_VERSION_STR "${REACTOS_DLL_VERSION_MAJOR}.${KERNEL_VERSION_MINOR}-${KERNEL_VERSION_BUILD_TYPE}")
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn")
|
||||
find_package(Subversion)
|
||||
if(Subversion_FOUND)
|
||||
subversion_wc_info(${CMAKE_CURRENT_SOURCE_DIR} SVNINFO)
|
||||
if(SVNINFO_WC_REVISION)
|
||||
set(REVISION "-r${SVNINFO_WC_REVISION}")
|
||||
converttohex(${SVNINFO_WC_REVISION} KERNEL_VERSION_BUILD_HEX)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set(REVISION "-rUNKNOWN")
|
||||
set(HEXREVISION "0x0")
|
||||
endif()
|
||||
|
||||
configure_file(include/reactos/version.h.cmake ${REACTOS_BINARY_DIR}/include/reactos/version.h)
|
||||
configure_file(include/reactos/buildno.h.cmake ${REACTOS_BINARY_DIR}/include/reactos/buildno.h)
|
31
include/reactos/version.h.cmake
Normal file
31
include/reactos/version.h.cmake
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: include/internal/version.h
|
||||
* PURPOSE: Defines the current version
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* REVISIONS:
|
||||
* 1999-11-06 (ea)
|
||||
* Moved from include/internal in include/reactos
|
||||
* to be used by buildno.
|
||||
* 2002-01-17 (ea)
|
||||
* KERNEL_VERSION removed. Use
|
||||
* reactos/buildno.h:KERNEL_VERSION_STR instead.
|
||||
*/
|
||||
|
||||
#ifndef __VERSION_H
|
||||
#define __VERSION_H
|
||||
|
||||
#define KERNEL_VERSION_MAJOR @KERNEL_VERSION_MAJOR@
|
||||
#define KERNEL_VERSION_MINOR @KERNEL_VERSION_MINOR@
|
||||
#define KERNEL_VERSION_PATCH_LEVEL @KERNEL_VERSION_PATCH_LEVEL@
|
||||
|
||||
#define COPYRIGHT_YEAR "@COPYRIGHT_YEAR@"
|
||||
|
||||
/* KERNEL_VERSION_BUILD_TYPE is L"SVN", L"RC1", L"RC2" or L"" (for the release) */
|
||||
#define KERNEL_VERSION_BUILD_TYPE "@KERNEL_VERSION_BUILD_TYPE@"
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* EOF */
|
Loading…
Reference in a new issue