diff options
Diffstat (limited to 'build_files')
-rw-r--r-- | build_files/cmake/macros.cmake | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index aec86f7467a..84e6b788dc0 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -198,3 +198,36 @@ MACRO(TEST_SSE_SUPPORT) SUPPORT_SSE_BUILD) ENDMACRO(TEST_SSE_SUPPORT) +MACRO(GET_BLENDER_VERSION) + FILE(READ ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender.h CONTENT) + STRING(REGEX REPLACE "\n" ";" CONTENT "${CONTENT}") + STRING(REGEX REPLACE "\t" ";" CONTENT "${CONTENT}") + STRING(REGEX REPLACE " " ";" CONTENT "${CONTENT}") + + FOREACH(ITEM ${CONTENT}) + IF(LASTITEM MATCHES "BLENDER_VERSION") + MATH(EXPR BLENDER_VERSION_MAJOR "${ITEM} / 100") + MATH(EXPR BLENDER_VERSION_MINOR "${ITEM} % 100") + SET(BLENDER_VERSION "${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}") + ENDIF(LASTITEM MATCHES "BLENDER_VERSION") + + IF(LASTITEM MATCHES "BLENDER_SUBVERSION") + SET(BLENDER_SUBVERSION ${ITEM}) + ENDIF(LASTITEM MATCHES "BLENDER_SUBVERSION") + + IF(LASTITEM MATCHES "BLENDER_MINVERSION") + MATH(EXPR BLENDER_MINVERSION_MAJOR "${ITEM} / 100") + MATH(EXPR BLENDER_MINVERSION_MINOR "${ITEM} % 100") + SET(BLENDER_MINVERSION "${BLENDER_MINVERSION_MAJOR}.${BLENDER_MINVERSION_MINOR}") + ENDIF(LASTITEM MATCHES "BLENDER_MINVERSION") + + IF(LASTITEM MATCHES "BLENDER_MINSUBVERSION") + SET(BLENDER_MINSUBVERSION ${ITEM}) + ENDIF(LASTITEM MATCHES "BLENDER_MINSUBVERSION") + + SET(LASTITEM ${ITEM}) + ENDFOREACH(ITEM ${CONTENT}) + + MESSAGE(STATUS "Version major: ${BLENDER_VERSION_MAJOR}, Version minor: ${BLENDER_VERSION_MINOR}, Subversion: ${BLENDER_SUBVERSION}, Version: ${BLENDER_VERSION}") + MESSAGE(STATUS "Minversion major: ${BLENDER_MINVERSION_MAJOR}, Minversion minor: ${BLENDER_MINVERSION_MINOR}, MinSubversion: ${BLENDER_MINSUBVERSION}, Minversion: ${BLENDER_MINVERSION}") +ENDMACRO(GET_BLENDER_VERSION) |