add buildinfo to cmake (no win32 support)
authorCampbell Barton <ideasman42@gmail.com>
Thu, 24 Sep 2009 15:36:00 +0000 (15:36 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 24 Sep 2009 15:36:00 +0000 (15:36 +0000)
CMakeLists.txt
source/creator/CMakeLists.txt
source/creator/creator.c

index 504ef5d8dd81cb1378a9fc09b472ce7dc9ea5c46..92c670f572c8274f66cdf970165844e20abe3146 100644 (file)
@@ -76,7 +76,7 @@ OPTION(WITH_FFTW3         "Enable FFTW3 support" OFF)
 OPTION(WITH_JACK          "Enable Jack Support (http://www.jackaudio.org)" OFF)
 OPTION(WITH_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
 OPTION(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation" OFF)
 OPTION(WITH_JACK          "Enable Jack Support (http://www.jackaudio.org)" OFF)
 OPTION(WITH_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
 OPTION(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation" OFF)
-OPTION(WITH_BUILDINFO     "Include extra build details" ON)
+OPTION(WITH_BUILDINFO     "Include extra build details" ON)
 OPTION(WITH_INSTALL       "Install accompanying scripts and language files needed to run blender" ON)
 
 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
 OPTION(WITH_INSTALL       "Install accompanying scripts and language files needed to run blender" ON)
 
 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
@@ -517,15 +517,15 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 
 
 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 
 
-# TODO - buildinfo
-IF(UNIX)
-#   IF(WITH_BUILDINFO)
-#     EXEC_PROGRAM("date \"+%Y-%m-%d\"" OUTPUT_VARIABLE BUILD_DATE)
-#     EXEC_PROGRAM("date \"+%H:%M:%S\"" OUTPUT_VARIABLE BUILD_TIME)  
-#     EXEC_PROGRAM("svnversion ${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE BUILD_REV)
-#     SET(BUILD_TYPE ${CMAKE_BUILD_TYPE})
-#   ENDIF(WITH_BUILDINFO)
-ENDIF(UNIX)
+# buildinfo
+IF(UNIX)
+       IF(WITH_BUILDINFO)
+               EXEC_PROGRAM("date \"+%Y-%m-%d\"" OUTPUT_VARIABLE BUILD_DATE)
+               EXEC_PROGRAM("date \"+%H:%M:%S\"" OUTPUT_VARIABLE BUILD_TIME)  
+               EXEC_PROGRAM("svnversion ${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE BUILD_REV)
+               # BUILD_PLATFORM and BUILD_PLATFORM are taken from CMake
+       ENDIF(WITH_BUILDINFO)
+ENDIF(UNIX)
 
 #-----------------------------------------------------------------------------
 # Common.
 
 #-----------------------------------------------------------------------------
 # Common.
index 410e0808580fe6b57787aea49d0201f4ad92c414..51a52ee68612e616de43fa533b1f8938ff388d3e 100644 (file)
@@ -78,14 +78,26 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
        INCLUDE_DIRECTORIES(${BINRELOC_INC})
 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 
        INCLUDE_DIRECTORIES(${BINRELOC_INC})
 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 
-MESSAGE(STATUS "Configuring blender")
+# Setup the exe sources and buildinfo
+SET(EXESRC creator.c)
 
 IF(WIN32)
 
 IF(WIN32)
-       ADD_EXECUTABLE(blender ${EXETYPE} creator.c ../icons/winblender.rc)
-ELSE(WIN32)
-       ADD_EXECUTABLE(blender ${EXETYPE} creator.c)
+       SET(EXESRC ${EXESRC} ../icons/winblender.rc)
 ENDIF(WIN32)
 
 ENDIF(WIN32)
 
+IF(WITH_BUILDINFO)
+       ADD_DEFINITIONS(-DBUILD_DATE="${BUILD_DATE}")
+       ADD_DEFINITIONS(-DBUILD_TIME="${BUILD_TIME}")
+       ADD_DEFINITIONS(-DBUILD_REV="${BUILD_REV}")
+       ADD_DEFINITIONS(-DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}")
+       ADD_DEFINITIONS(-DBUILD_TYPE="${CMAKE_BUILD_TYPE}")
+       
+       SET(EXESRC ${EXESRC} buildinfo.c)
+ENDIF(WITH_BUILDINFO)
+
+MESSAGE(STATUS "Configuring blender")
+
+ADD_EXECUTABLE(blender ${EXETYPE} ${EXESRC})
 
 # Post build steps for bundling/packaging.
 
 
 # Post build steps for bundling/packaging.
 
index 579825b805a0c25caf2c1edf2ceb70767916ccf9..6f64628b4676a8060c52f3abdde0470b010a9c2d 100644 (file)
 #ifdef BUILD_DATE
 extern char * build_date;
 extern char * build_time;
 #ifdef BUILD_DATE
 extern char * build_date;
 extern char * build_time;
+extern char * build_rev;
 extern char * build_platform;
 extern char * build_type;
 #endif
 extern char * build_platform;
 extern char * build_type;
 #endif