[CMAKE]
[reactos.git] / reactos / include / reactos / version.cmake
1 macro(inttohex INTVALUE OUTPUT_VARIABLE)
2 list(APPEND HEXLIST 0 1 2 3 4 5 6 7 8 9 a b c d e f)
3 list(GET HEXLIST ${INTVALUE} ${OUTPUT_VARIABLE})
4 endmacro()
5
6 macro(converttohex INTVALUE OUTPUT_VARIABLE)
7 set(${OUTPUT_VARIABLE} "")
8 set(REMAINING ${INTVALUE})
9 while(REMAINING)
10 math(EXPR REMAINDER "${REMAINING}%16")
11 inttohex(${REMAINDER} HEXCHAR)
12 math(EXPR REMAINING "${REMAINING}/16")
13 set(${OUTPUT_VARIABLE} "${HEXCHAR}${${OUTPUT_VARIABLE}}")
14 endwhile()
15 endmacro()
16
17 string(TIMESTAMP KERNEL_VERSION_BUILD %Y%m%d UTC)
18
19 set(KERNEL_VERSION_MAJOR "0")
20 set(KERNEL_VERSION_MINOR "4")
21 set(KERNEL_VERSION_PATCH_LEVEL "0")
22 set(COPYRIGHT_YEAR "2015")
23 # KERNEL_VERSION_BUILD_TYPE is "SVN", "RC1", "RC2" or "" (for the release)
24 set(KERNEL_VERSION_BUILD_TYPE "SVN")
25
26
27 set(KERNEL_VERSION "${KERNEL_VERSION_MAJOR}.${KERNEL_VERSION_MINOR}")
28 if(KERNEL_VERSION_PATCH_LEVEL)
29 set(KERNEL_VERSION "${KERNEL_VERSION}.${KERNEL_VERSION_PATCH_LEVEL}-${KERNEL_VERSION_BUILD_TYPE}")
30 else()
31 set(KERNEL_VERSION "${KERNEL_VERSION}-${KERNEL_VERSION_BUILD_TYPE}")
32 endif()
33
34 math(EXPR REACTOS_DLL_VERSION_MAJOR "${KERNEL_VERSION_MAJOR}+42")
35 set(DLL_VERSION_STR "${REACTOS_DLL_VERSION_MAJOR}.${KERNEL_VERSION_MINOR}-${KERNEL_VERSION_BUILD_TYPE}")
36
37 # get svn revision number
38 set(REVISION "rUNKNOWN")
39 set(KERNEL_VERSION_BUILD_HEX "0")
40 if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn")
41 find_package(Subversion)
42 if(Subversion_FOUND)
43 subversion_wc_info(${CMAKE_CURRENT_SOURCE_DIR} SVNINFO)
44 if(SVNINFO_WC_REVISION)
45 set(REVISION "r${SVNINFO_WC_REVISION}")
46 converttohex(${SVNINFO_WC_REVISION} KERNEL_VERSION_BUILD_HEX)
47 endif()
48 endif()
49 endif()
50
51 configure_file(include/reactos/version.h.cmake ${REACTOS_BINARY_DIR}/include/reactos/version.h)
52 configure_file(include/reactos/buildno.h.cmake ${REACTOS_BINARY_DIR}/include/reactos/buildno.h)
53 configure_file(include/reactos/builddir.h.cmake ${REACTOS_BINARY_DIR}/include/reactos/builddir.h)