create project tree

This commit is contained in:
arcan1s
2014-07-27 12:48:42 +04:00
parent f5e0691cab
commit d7e08d4fd6
10 changed files with 250 additions and 0 deletions

53
sources/CMakeLists.txt Normal file
View File

@ -0,0 +1,53 @@
cmake_minimum_required (VERSION 2.8)
cmake_policy (SET CMP0003 OLD)
cmake_policy (SET CMP0002 OLD)
cmake_policy (SET CMP0011 NEW)
cmake_policy (SET CMP0015 NEW)
project (reportabug)
set (SUBPROJECT reportabug)
set (PROJECT_AUTHOR "Evgeniy Alekseev")
set (PROJECT_CONTACT "esalexeev@gmail.com")
set (PROJECT_LICENSE "GPLv3")
set (PROJECT_VERSION_MAJOR 1)
set (PROJECT_VERSION_MINOR 0)
set (PROJECT_VERSION_PATCH 0)
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
string (TIMESTAMP CURRENT_DATE "%Y-%m-%d %H:%M" UTC)
string (TIMESTAMP CURRENT_YEAR "%Y")
message (STATUS "Subproject: ${SUBPROJECT}")
message (STATUS "Version: ${PROJECT_VERSION}")
message (STATUS "Build date: ${CURRENT_DATE}")
# install options
option (USE_QT5 "Use Qt5 instead of Qt4" ON)
# flags
if (CMAKE_COMPILER_IS_GNUCXX)
set (ADD_CXX_FLAGS "-Wall")
set (CMAKE_CXX_FLAGS "-O0 ${ADD_CXX_FLAGS}")
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
else ()
message (STATUS "Unknown compiler")
endif ()
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
# build
# set directories
set (SUBPROJECT_BINARY_DIR bin)
set (SUBPROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
# executable path
set (EXECUTABLE_OUTPUT_PATH ${SUBPROJECT_BINARY_DIR})
# additional targets
set (TARGETS "")
set (HEADERS "")
add_subdirectory (${SUBPROJECT_SOURCE_DIR})
install (FILES ${SUBPROJECT}.desktop DESTINATION share/applications/)

View File

@ -0,0 +1,10 @@
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Report a bug
Comment=A simple Qt application which allows users to create an issue for GitHub projects
Exec=reportabug
Icon=tools-report-bug
Terminal=false
Encoding=UTF-8
Type=Application
Categories=system

View File

@ -0,0 +1,43 @@
# set files
file (GLOB SOURCES *.cpp)
file (GLOB HEADERS *.h)
file (GLOB FORMS *.ui)
# include_path
include_directories (${CMAKE_CURRENT_BINARY_DIR}/../
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR})
if (USE_QT5)
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
add_definitions(${Qt5Core_DEFINITIONS})
add_definitions(${Qt5Widgets_DEFINITIONS})
add_definitions(${Qt5LinguistTools_DEFINITIONS})
qt5_wrap_cpp (MOC_SOURCES ${HEADERS})
qt5_wrap_ui (UI_HEADERS ${FORMS})
source_group ("Header Files" FILES ${HEADERS})
source_group ("Source Files" FILES ${SOURCES})
source_group ("Generated Files" FILES ${MOC_SOURCES})
include_directories (${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
add_executable (${SUBPROJECT} ${UI_HEADERS} ${HEADERS} ${SOURCES} ${MOC_SOURCES})
target_link_libraries (${SUBPROJECT} ${Qt5Widgets_LIBRARIES} ${Qt5Core_LIBRARIES})
else ()
find_package (Qt4 REQUIRED)
include (${QT_USE_FILE})
qt4_wrap_cpp (MOC_SOURCES ${HEADERS})
qt4_wrap_ui (UI_HEADERS ${FORMS})
source_group ("Header Files" FILES ${HEADERS})
source_group ("Source Files" FILES ${SOURCES})
source_group ("Generated Files" FILES ${MOC_SOURCES})
add_executable (${SUBPROJECT} ${UI_HEADERS} ${HEADERS} ${SOURCES} ${MOC_SOURCES})
target_link_libraries (${SUBPROJECT} ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
endif()
# install properties
install (TARGETS ${SUBPROJECT} DESTINATION bin)

32
sources/src/main.cpp Normal file
View File

@ -0,0 +1,32 @@
/***************************************************************************
* This file is part of reportabug *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 3.0 of the License, or (at your option) any later version. *
* *
* This library 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 *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library. *
***************************************************************************/
#include <QApplication>
#include "mainwindow.h"
#include "version.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}

21
sources/version.h.in Normal file
View File

@ -0,0 +1,21 @@
#ifndef VERSION_H
#define VERSION_H
#define NAME "Report a Bug"
#define VERSION "@PROJECT_VERSION@"
#define AUTHOR "@PROJECT_AUTHOR@"
#define EMAIL "@PROJECT_CONTACT@"
#define LICENSE "@PROJECT_LICENSE@"
#define HOMEPAGE "https://github.com/arcan1s/reportabug"
#define REPOSITORY "https://github.com/arcan1s/reportabug"
#define BUGTRACKER "https://github.com/arcan1s/reportabug/issues"
#define BUILD_DATE "@CURRENT_DATE@"
#define DATE "2014-@CURRENT_YEAR@"
#define CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@"
#define CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
#define PROJECT_USE_QT5 "@USE_QT5@"
#endif /* VERSION_H */