Commit e3500cbd authored by Stepan Salenikovich's avatar Stepan Salenikovich

gnome: CMakeLists for new client

A simple main.cpp to test the cmake config
and make sure libRingClient starts in a GTK
main loop.

Refs #66150

Change-Id: I85ca9e984f77d0f13d25e3bd9361885cf8eb01d4
parent 5a777584
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
# First, check is the compiler is new enough, most version of Clang are fine
# until problems arise, checking for GCC is enough
IF (CMAKE_COMPILER_IS_GNUCC)
EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
IF (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
MESSAGE(STATUS "Found GCC version >= 4.8: " ${GCC_VERSION})
ELSE()
MESSAGE(FATAL_ERROR "Your version of GCC is too old, please install GCC 4.8 or later")
ENDIF()
ENDIF()
ADD_DEFINITIONS("-std=c++1y")
PROJECT(ring-client-gnome)
SET(LOCAL_CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LOCAL_CMAKE_MODULE_PATH})
# make sure we're using Qt5
SET(ENABLE_QT5 true)
# for now, set debug as default
SET(CMAKE_BUILD_TYPE Debug)
# find packages
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0>=3.10)
FIND_PACKAGE(LibRingClient REQUIRED)
FIND_PACKAGE(Qt5Core REQUIRED)
# include libs
INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${LIB_RING_CLIENT_INCLUDE_DIR})
# link libs
LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS})
# compiler flags
ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER})
# warnings
ADD_DEFINITIONS(
-Wall
-Wextra
-Wno-cpp
-Wmissing-noreturn
-Wpointer-arith
-Wcast-align
-Wwrite-strings
-Wformat-nonliteral
-Wformat-security
-Wswitch-enum
-Winit-self
-Wmissing-include-dirs
-Wundef
-Wmissing-format-attribute
-Wno-reorder
-Wunused
-Wuninitialized
-Woverloaded-virtual
-Wsuggest-attribute=const
-Wunused-value
-Wdouble-promotion
-Wnonnull
-Wsequence-point
-Wunused-but-set-parameter
-Wsizeof-pointer-memaccess
-Wvarargs
)
# more warnings
IF (CMAKE_COMPILER_IS_GNUCC)
IF (GCC_VERSION VERSION_GREATER 4.9 OR GCC_VERSION VERSION_EQUAL 4.9)
ADD_DEFINITIONS(
-Wconditionally-supported
-Wdate-time
-Wdelete-incomplete
-Wfloat-conversion
)
ENDIF()
IF (GCC_VERSION VERSION_GREATER 5.0 OR GCC_VERSION VERSION_EQUAL 5.0)
ADD_DEFINITIONS(
-Wsuggest-override
-Wsuggest-final-types
-Wsuggest-final-methods
-Wbool-compare
-Wformat-signedness
-Wlogical-not-parentheses
-Wnormalized
-Wshift-count-negative
-Wshift-count-overflow
-Wsized-deallocation
-Wsizeof-array-argument
)
ENDIF()
ENDIF()
# source files to compile
SET( SRC_FILES
src/main.cpp
)
# IF(${ENABLE_TEST} MATCHES true)
# ADD_SUBDIRECTORY( src/test)
# ENDIF()
# for translations
# FIND_PACKAGE ( Gettext REQUIRED )
# ADD_SUBDIRECTORY( po )
ADD_EXECUTABLE(ring-client-gnome ${SRC_FILES})
TARGET_LINK_LIBRARIES(ring-client-gnome ${LIB_RING_CLIENT_LIBRARY} ${GTK3_LIBRARIES} Qt5::Core)
ring-client-gnome
*****************
Ring-client-gnome is a Ring client written in GTK+3. It uses libRingClient to
communicate with the Ring daemon and for all of the underlying models and their
logic. Ideally ring-client-gnome should only contain UI related code and any
wrappers necessary for interacting with libRingClient.
Requirements
==================
- Ring daemon
- libRingClient (Qt5 version)
- GTK+3 (3.10 or higher)
- Qt5 Core
Compiling
==================
In the project root dir:
mkdir build
cd build
cmake ..
make
Then simply run ./ring-client-gnome
/*
* Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
* Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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, Boston, MA 02110-1301 USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#include <gtk/gtk.h>
#include <QCoreApplication>
#include <callmodel.h>
int
main(int argc, char *argv[])
{
GtkWidget *window;
gtk_init (&argc, &argv);
// enable debug
g_setenv("G_MESSAGES_DEBUG", "all", TRUE);
g_debug("debug enabled");
QCoreApplication *app = NULL;
try {
app = new QCoreApplication(argc, argv);
CallModel::instance();
} catch (const char * msg) {
g_debug("caught error: %s\n", msg);
return 1;
}
// create an empty window
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Ring");
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show (window);
gtk_main ();
delete app;
return 0;
}
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