Merge pull request #3092 from akallabeth/get_build_config

Added get_build_config functions.
This commit is contained in:
MartinHaimberger 2016-01-28 15:23:24 +01:00
commit 83b706c4be
7 changed files with 39 additions and 12 deletions

View File

@ -21,7 +21,6 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "buildflags.h"
#include <assert.h>
@ -187,11 +186,7 @@ int freerdp_client_print_version()
int freerdp_client_print_buildconfig()
{
printf("Build configuration: %s\n", BUILD_CONFIG);
printf("Build type: %s\n", BUILD_TYPE);
printf("CFLAGS: %s\n", CFLAGS);
printf("Compiler: %s, %s\n", COMPILER_ID, COMPILER_VERSION);
printf("Target architecture: %s\n", TARGET_ARCH);
printf("%s", freerdp_get_build_config());
return 1;
}

View File

@ -272,6 +272,7 @@ FREERDP_API void freerdp_get_version(int* major, int* minor, int* revision);
FREERDP_API const char* freerdp_get_version_string(void);
FREERDP_API const char* freerdp_get_build_date(void);
FREERDP_API const char* freerdp_get_build_revision(void);
FREERDP_API const char* freerdp_get_build_config(void);
FREERDP_API freerdp* freerdp_new(void);
FREERDP_API void freerdp_free(freerdp* instance);

View File

@ -30,6 +30,7 @@
#include "transport.h"
#include "connection.h"
#include "message.h"
#include "buildflags.h"
#include <assert.h>
@ -439,13 +440,23 @@ const char* freerdp_get_version_string(void)
const char* freerdp_get_build_date(void)
{
static char build_date[64];
sprintf_s(build_date, sizeof(build_date), "%s %s", __DATE__, __TIME__);
static char build_date[] = __DATE__ " " __TIME__;
return build_date;
}
const char* freerdp_get_build_config(void)
{
static const char build_config[] =
"Build configuration: " BUILD_CONFIG "\n"
"Build type: " BUILD_TYPE "\n"
"CFLAGS: " CFLAGS "\n"
"Compiler: " COMPILER_ID ", " COMPILER_VERSION "\n"
"Target architecture: " TARGET_ARCH "\n";
return build_config;
}
const char* freerdp_get_build_revision(void)
{
return GIT_REVISION;

View File

@ -33,6 +33,10 @@ int TestVersion(int argc, char* argv[])
if (!build)
return -1;
build = freerdp_get_build_config();
if (!build)
return -1;
return 0;
}

View File

@ -51,5 +51,6 @@ WINPR_API void winpr_get_version(int* major, int* minor, int* revision);
WINPR_API const char* winpr_get_version_string(void);
WINPR_API const char* winpr_get_build_date(void);
WINPR_API const char* winpr_get_build_revision(void);
WINPR_API const char* winpr_get_build_config(void);
#endif /* WINPR_H */

View File

@ -36,6 +36,10 @@ int TestVersion(int argc, char* argv[])
if (!build)
return -1;
build = winpr_get_build_config();
if (!build)
return -1;
return 0;
}

View File

@ -22,6 +22,8 @@
#include "config.h"
#endif
#include "buildflags.h"
#include <stdlib.h>
#include <stdio.h>
#include <winpr/crt.h>
@ -46,9 +48,7 @@ const char* winpr_get_version_string(void)
const char* winpr_get_build_date(void)
{
static char build_date[64];
sprintf_s(build_date, sizeof(build_date), "%s %s", __DATE__, __TIME__);
static char build_date[] = __DATE__ " " __TIME__;
return build_date;
}
@ -58,3 +58,14 @@ const char* winpr_get_build_revision(void)
return GIT_REVISION;
}
const char* winpr_get_build_config(void)
{
static const char build_config[] =
"Build configuration: " BUILD_CONFIG "\n"
"Build type: " BUILD_TYPE "\n"
"CFLAGS: " CFLAGS "\n"
"Compiler: " COMPILER_ID ", " COMPILER_VERSION "\n"
"Target architecture: " TARGET_ARCH "\n";
return build_config;
}