Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1,10 +1,12 @@ AC_INIT(ObjFW, 0.91-dev, js@heap.zone) AC_CONFIG_SRCDIR(src) AC_CONFIG_AUX_DIR(build-aux) AC_CONFIG_MACRO_DIR(build-aux/m4) +AC_DEFINE(OBJFW_VERSION_MAJOR, 0, [The major version of ObjFW]) +AC_DEFINE(OBJFW_VERSION_MINOR, 91, [The minor version of ObjFW]) dnl This may only be set to 0.91 once 0.91 is released AC_SUBST(BUNDLE_VERSION, 0.90.9900) AC_SUBST(BUNDLE_SHORT_VERSION, 0.90) for i in configure.ac build-aux/m4/*; do Index: src/OFSystemInfo.h ================================================================== --- src/OFSystemInfo.h +++ src/OFSystemInfo.h @@ -27,10 +27,13 @@ */ @interface OFSystemInfo: OFObject #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, readonly, nonatomic) size_t pageSize; @property (class, readonly, nonatomic) size_t numberOfCPUs; +@property (class, readonly, nonatomic) OFString *ObjFWVersion; +@property (class, readonly, nonatomic) unsigned int ObjFWVersionMajor; +@property (class, readonly, nonatomic) unsigned int ObjFWVersionMinor; @property (class, readonly, nullable, nonatomic) OFString *operatingSystemName; @property (class, readonly, nullable, nonatomic) OFString *operatingSystemVersion; # ifdef OF_HAVE_FILES @property (class, readonly, nullable, nonatomic) OFString *userDataPath; @@ -67,10 +70,31 @@ * * @return The number of CPUs installed in the system */ + (size_t)numberOfCPUs; +/*! + * @brief The version of ObjFW. + * + * @return The version of ObjFW + */ ++ (OFString *)ObjFWVersion; + +/*! + * @brief The major version of ObjFW. + * + * @return The major version of ObjFW + */ ++ (unsigned int)ObjFWVersionMajor; + +/*! + * @brief The minor version of ObjFW. + * + * @return The minor version of ObjFW + */ ++ (unsigned int)ObjFWVersionMinor; + /** * @brief Returns the name of the operating system the application is running * on. * * @return The name of the operating system the application is running on Index: src/OFSystemInfo.m ================================================================== --- src/OFSystemInfo.m +++ src/OFSystemInfo.m @@ -308,10 +308,25 @@ + (size_t)numberOfCPUs { return numberOfCPUs; } + ++ (OFString *)ObjFWVersion +{ + return @PACKAGE_VERSION; +} + ++ (unsigned int)ObjFWVersionMajor +{ + return OBJFW_VERSION_MAJOR; +} + ++ (unsigned int)ObjFWVersionMinor +{ + return OBJFW_VERSION_MINOR; +} + (OFString *)operatingSystemName { #ifdef OF_HAVE_THREADS static of_once_t onceControl = OF_ONCE_INIT; Index: tests/OFSystemInfoTests.m ================================================================== --- tests/OFSystemInfoTests.m +++ tests/OFSystemInfoTests.m @@ -30,10 +30,18 @@ OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; PRINT(GREEN, @"Page size: %zd", [OFSystemInfo pageSize]); PRINT(GREEN, @"Number of CPUs: %zd", [OFSystemInfo numberOfCPUs]); + + PRINT(GREEN, @"ObjFW version: %@", [OFSystemInfo ObjFWVersion]); + + PRINT(GREEN, @"ObjFW version major: %u", + [OFSystemInfo ObjFWVersionMajor]); + + PRINT(GREEN, @"ObjFW version minor: %u", + [OFSystemInfo ObjFWVersionMinor]); PRINT(GREEN, @"Operating system name: %@", [OFSystemInfo operatingSystemName]); PRINT(GREEN, @"Operating system version: %@",