Commit d52707c0 authored by Antenore Gatta's avatar Antenore Gatta

Printing builds flags with remmina --full-version command option.

parent 853ba675
......@@ -27,6 +27,7 @@ _configs.sed
aclocal.m4
autom4te.cache
build
buildflags.h
/build-ubuntu
cmake_install.cmake
cmake_uninstall.cmake
......@@ -42,6 +43,7 @@ install_manifest.txt
libtool
ltmain.sh
missing
release
rfbint.h
stamp-h1
tags
......
......@@ -39,10 +39,11 @@ set(CMAKE_COLOR_MAKEFILE ON)
project(Remmina C)
include(CheckCCompilerFlag)
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CheckSymbolExists)
include(FindPkgConfig)
include(CheckCCompilerFlag)
include(GNUInstallDirs)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
......@@ -59,14 +60,125 @@ if(NOT BUILD_SHARED_LIBS)
endif()
if(CMAKE_COMPILER_IS_GNUCC)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686")
CHECK_SYMBOL_EXISTS(__x86_64__ "" IS_X86_64)
if(IS_X86_64)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686")
endif()
else()
if(CMAKE_POSITION_INDEPENDENT_CODE)
if(${CMAKE_VERSION} VERSION_LESS 2.8.9)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
endif()
endif()
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
if(WITH_SSE2)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2")
endif()
check_c_compiler_flag(-Wno-unused-function Wno-unused-function)
if(Wno-unused-function)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DDEBUG)
CHECK_C_COMPILER_FLAG (-Wunused-result Wunused-result)
if(Wunused-result)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-result")
endif()
CHECK_C_COMPILER_FLAG (-Wunused-but-set-variable Wunused-but-set-variable)
if(Wunused-but-set-variable)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-but-set-variable")
endif()
CHECK_C_COMPILER_FLAG(-Wdeprecated-declarations Wdeprecated-declarations)
if(Wdeprecated-declarations)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wdeprecated-declarations")
endif()
CHECK_C_COMPILER_FLAG (-Wimplicit-function-declaration Wimplicit-function-declaration)
if(Wimplicit-function-declaration)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wimplicit-function-declaration")
endif()
if (NOT OPENBSD)
CHECK_C_COMPILER_FLAG (-Wredundant-decls Wredundant-decls)
if(Wredundant-decls)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wredundant-decls")
endif()
endif()
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
add_definitions(-DNDEBUG)
CHECK_C_COMPILER_FLAG (-Wno-unused-result Wno-unused-result)
if(Wno-unused-result)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-result")
endif()
CHECK_C_COMPILER_FLAG (-Wno-unused-but-set-variable Wno-unused-but-set-variable)
if(Wno-unused-but-set-variable)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-but-set-variable")
endif()
CHECK_C_COMPILER_FLAG(-Wno-deprecated-declarations Wno-deprecated-declarations)
if(Wno-deprecated-declarations)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
endif()
CHECK_C_COMPILER_FLAG (-Wimplicit-function-declaration Wimplicit-function-declaration)
if(Wimplicit-function-declaration)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wimplicit-function-declaration")
endif()
if (NOT OPENBSD)
CHECK_C_COMPILER_FLAG (-Wredundant-decls Wredundant-decls)
if(Wredundant-decls)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wredundant-decls")
endif()
endif()
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
endif()
endif()
if((TARGET_ARCH MATCHES "x86|x64") AND (NOT DEFINED WITH_SSE2))
option(WITH_SSE2 "Enable SSE2 optimization." ON)
else()
option(WITH_SSE2 "Enable SSE2 optimization." OFF)
endif()
if(TARGET_ARCH MATCHES "ARM")
if (NOT DEFINED WITH_NEON)
option(WITH_NEON "Enable NEON optimization." ON)
else()
option(WITH_NEON "Enable NEON optimization." OFF)
endif()
else()
if(NOT APPLE)
option(WITH_IPP "Use Intel Performance Primitives." OFF)
endif()
endif()
if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
if(CMAKE_BUILD_TYPE STREQUAL "Release")
add_definitions(-DNDEBUG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros -Wno-padded")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-c11-extensions -Wno-gnu")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-command-line-argument")
CHECK_C_COMPILER_FLAG(-Wno-deprecated-declarations Wno-deprecated-declarations)
if(Wno-deprecated-declarations)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
endif()
else()
add_definitions(-DDEBUG)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-parameter")
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-macros -Wpadded")
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wc11-extensions -Wgnu")
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-command-line-argument")
CHECK_C_COMPILER_FLAG(-Wdeprecated-declarations Wdeprecated-declarations)
if(Wdeprecated-declarations)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wdeprecated-declarations")
endif()
endif()
endif()
......@@ -252,3 +364,14 @@ endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_SOURCE_DIR}/config.h)
set(REMMINA_BUILD_CONFIG_LIST "")
GET_CMAKE_PROPERTY(res VARIABLES)
FOREACH(var ${res})
IF (var MATCHES "^WITH_*|^HAVE_*")
LIST(APPEND REMMINA_BUILD_CONFIG_LIST "${var}=${${var}}")
ENDIF()
ENDFOREACH()
string(REPLACE ";" " " REMMINA_BUILD_CONFIG "${REMMINA_BUILD_CONFIG_LIST}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/buildflags.h.in
${CMAKE_CURRENT_SOURCE_DIR}/buildflags.h)
#ifndef REMMINA_BUILD_FLAGS_H
#define REMMINA_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 "${REMMINA_BUILD_CONFIG}"
#define BUILD_TYPE "${CMAKE_BUILD_TYPE}"
#endif /* REMMINA_BUILD_FLAGS_H */
......@@ -14,8 +14,20 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
if((CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|x86|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 4))
set(TARGET_ARCH "x86")
elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
set(TARGET_ARCH "x64")
elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "i386") AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (APPLE))
# Mac is weird like that.
set(TARGET_ARCH "x64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm*")
set(TARGET_ARCH "ARM")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
set(TARGET_ARCH "sparc")
endif()
option(WITH_TRANSLATIONS "Generate translations." ON)
......@@ -35,6 +35,7 @@
*/
#include "config.h"
#include "buildflags.h"
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <stdlib.h>
......@@ -69,6 +70,17 @@ static gboolean cb_closewidget(GtkWidget *widget, gpointer data)
return TRUE;
}
const gchar* remmina_exec_get_build_config(void)
{
static const gchar 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;
}
void remmina_exec_exitremmina()
{
TRACE_CALL(__func__);
......@@ -213,9 +225,10 @@ void remmina_exec_command(RemminaCommandType command, const gchar* data)
/* Show th widget with the list of plugins and versions */
remmina_plugin_manager_show(mainwindow);
}else {
g_print("%s %s %s (git %s)\n", g_get_application_name(), ISSNAP, VERSION, REMMINA_GIT_REVISION);
g_print("\n%s %s %s (git %s)\n\n", g_get_application_name(), ISSNAP, VERSION, REMMINA_GIT_REVISION);
remmina_plugin_manager_show_stdout();
g_print("\n%s\n", remmina_exec_get_build_config());
remmina_exec_command(REMMINA_COMMAND_EXIT, NULL);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment