add parameter buildconfig

Extend winpr and client/common to support a new option "/buildconfig".
When used build the following build specific information is print:
* cmake options
* cflags
* compiler
* target architecture
* cmake build type
This commit is contained in:
Bernhard Miklautz 2016-01-11 16:18:40 +01:00
parent 6fa3608111
commit 7c03db342c
6 changed files with 44 additions and 0 deletions

1
.gitignore vendored
View File

@ -21,6 +21,7 @@ LICENSE.txt
*ConfigVersion.cmake
include/freerdp/version.h
include/freerdp/build-config.h
buildflags.h
*.a.objlist.cmake
*.a.objlist

View File

@ -819,3 +819,13 @@ endif()
#message("VENDOR: ${VENDOR} CLIENT_VENDOR_PATH: ${CLIENT_VENDOR_PATH} CMAKE_CPACK_INCLUDE_FILE: ${CMAKE_CPACK_INCLUDE_FILE}")
include(${CMAKE_CPACK_INCLUDE_FILE})
set(FREERDP_BUILD_CONFIG_LIST "")
GET_CMAKE_PROPERTY(res VARIABLES)
FOREACH(var ${res})
IF (var MATCHES "^WITH_*|^BUILD_TESTING|^STATIC_CHANNELS|^HAVE_*")
LIST(APPEND FREERDP_BUILD_CONFIG_LIST "${var}=${${var}}")
ENDIF()
ENDFOREACH()
string(REPLACE ";" " " FREERDP_BUILD_CONFIG "${FREERDP_BUILD_CONFIG_LIST}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/buildflags.h)

11
buildflags.h.in Normal file
View File

@ -0,0 +1,11 @@
#ifndef _FREERDP_BUILD_FLAGS_H
#define _FREERDP_BUILD_FLAGS_H
#define CFLAGS "${CMAKE_C_FLAGS}"
#define COMPILER_ID "${CMAKE_C_COMPILER_ID}"
#define COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION}"
#define TARGET_ARCH "${TARGET_ARCH}"
#define BUILD_CONFIG "${FREERDP_BUILD_CONFIG}"
#define BUILD_TYPE "${CMAKE_BUILD_TYPE}"
#endif /*_FREERDP_BUILD_FLAGS_H */

View File

@ -21,6 +21,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "buildflags.h"
#include <assert.h>
@ -171,6 +172,7 @@ static COMMAND_LINE_ARGUMENT_A args[] =
{ "assistance", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL, "Remote assistance password" },
{ "encryption-methods", COMMAND_LINE_VALUE_REQUIRED, "<40,56,128,FIPS>", NULL, NULL, -1, NULL, "RDP standard security encryption methods" },
{ "from-stdin", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Read credentials from stdin, do not use defaults." },
{ "buildconfig", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_BUILDCONFIG, NULL, NULL, NULL, -1, NULL, "print the build configuration" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
@ -180,6 +182,16 @@ int freerdp_client_print_version()
return 1;
}
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);
return 1;
}
int freerdp_client_print_command_line_help(int argc, char** argv)
{
char* str;
@ -1352,6 +1364,12 @@ int freerdp_client_settings_command_line_status_print(rdpSettings* settings, int
freerdp_client_print_version();
return COMMAND_LINE_STATUS_PRINT_VERSION;
}
if (status == COMMAND_LINE_STATUS_PRINT_BUILDCONFIG)
{
freerdp_client_print_version();
freerdp_client_print_buildconfig();
return COMMAND_LINE_STATUS_PRINT_BUILDCONFIG;
}
else if (status == COMMAND_LINE_STATUS_PRINT)
{
arg = CommandLineFindArgumentA(args, "kbd-list");

View File

@ -39,6 +39,7 @@
#define COMMAND_LINE_PRINT 0x00000200
#define COMMAND_LINE_PRINT_HELP 0x00000400
#define COMMAND_LINE_PRINT_VERSION 0x00000800
#define COMMAND_LINE_PRINT_BUILDCONFIG 0x00001000
/* Command-Line Argument Output Flags */
@ -78,6 +79,7 @@
#define COMMAND_LINE_STATUS_PRINT -2001
#define COMMAND_LINE_STATUS_PRINT_HELP -2002
#define COMMAND_LINE_STATUS_PRINT_VERSION -2003
#define COMMAND_LINE_STATUS_PRINT_BUILDCONFIG -2004
/* Command-Line Macros */

View File

@ -363,6 +363,8 @@ int CommandLineParseArgumentsA(int argc, LPCSTR* argv, COMMAND_LINE_ARGUMENT_A*
return COMMAND_LINE_STATUS_PRINT_HELP;
else if (options[j].Flags & COMMAND_LINE_PRINT_VERSION)
return COMMAND_LINE_STATUS_PRINT_VERSION;
else if (options[j].Flags & COMMAND_LINE_PRINT_BUILDCONFIG)
return COMMAND_LINE_STATUS_PRINT_BUILDCONFIG;
}
if (!found && (flags & COMMAND_LINE_IGN_UNKNOWN_KEYWORD) == 0)