Skip to content

Commit

Permalink
add parameter buildconfig
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bmiklautz committed Jan 12, 2016
1 parent 6fa3608 commit 7c03db3
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ LICENSE.txt
*ConfigVersion.cmake
include/freerdp/version.h
include/freerdp/build-config.h
buildflags.h

*.a.objlist.cmake
*.a.objlist
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 11 additions & 0 deletions buildflags.h.in
Original file line number Diff line number Diff line change
@@ -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 */
18 changes: 18 additions & 0 deletions client/common/cmdline.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "buildflags.h"

#include <assert.h>

Expand Down Expand Up @@ -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 }
};

Expand All @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 2 additions & 0 deletions winpr/include/winpr/cmdline.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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 */

Expand Down
2 changes: 2 additions & 0 deletions winpr/libwinpr/utils/cmdline.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7c03db3

Please sign in to comment.