added simple CMake project file
This commit is contained in:
parent
b08a4cf600
commit
cf23e11c93
|
@ -0,0 +1,42 @@
|
|||
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
||||
|
||||
# meta data
|
||||
set(META_PROJECT_NAME geocoordinatecalculator)
|
||||
set(META_APP_NAME "geocoordinatecalculator")
|
||||
set(META_APP_AUTHOR "Martchus")
|
||||
set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
||||
set(META APP_DESCRIPTION "Command line tool for basic calculations with geo coordinates such as format conversions and calculation of distance, bearing, mid point, destination and more.")
|
||||
set(META_VERSION_MAJOR 1)
|
||||
set(META_VERSION_MINOR 0)
|
||||
set(META_VERSION_PATCH 1)
|
||||
|
||||
# define project
|
||||
project(${META_PROJECT_NAME})
|
||||
|
||||
# stringification of meta data
|
||||
set(META_PROJECT_NAME_STR "\"${META_PROJECT_NAME}\"")
|
||||
set(META_APP_NAME_STR "\"${META_APP_NAME}\"")
|
||||
set(META_APP_AUTHOR_STR "\"${META_APP_AUTHOR}\"")
|
||||
set(META_APP_URL_STR "\"${META_APP_URL}\"")
|
||||
set(APP_DESCRIPTION_STR "\"${APP_DESCRIPTION}\"")
|
||||
set(META_APP_VERSION_STR "\"${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}\"")
|
||||
|
||||
# add configuration header
|
||||
configure_file (
|
||||
"${PROJECT_SOURCE_DIR}/config.h.in"
|
||||
"${PROJECT_BINARY_DIR}/config.h"
|
||||
)
|
||||
include_directories("${PROJECT_BINARY_DIR}")
|
||||
|
||||
# add source and header files
|
||||
file(GLOB PROJ_FILES "*.h" "*.cpp" "*.c")
|
||||
|
||||
# executable and linking
|
||||
add_executable(${META_PROJECT_NAME} ${PROJ_FILES})
|
||||
target_link_libraries(${META_PROJECT_NAME} c++utilities)
|
||||
|
||||
# enable C++11
|
||||
set_property(TARGET ${META_PROJECT_NAME} PROPERTY CXX_STANDARD 11)
|
||||
|
||||
# add install target
|
||||
install(TARGETS ${META_PROJECT_NAME} DESTINATION bin)
|
|
@ -1,5 +1,5 @@
|
|||
#include "utils.h"
|
||||
#include "angle.h"
|
||||
#include "./utils.h"
|
||||
#include "./angle.h"
|
||||
|
||||
#include <c++utilities/application/failure.h>
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef APP_METADATA_AVAIL
|
||||
#define APP_METADATA_AVAIL
|
||||
#define PROJECT_NAME @META_PROJECT_NAME_STR@
|
||||
#define APP_NAME @META_APP_NAME_STR@
|
||||
#define APP_VERSION @META_APP_VERSION_STR@
|
||||
#define APP_AUTHOR @META_APP_AUTHOR_STR@
|
||||
#define APP_URL @META_APP_URL_STR@
|
||||
#define APP_DESCRIPTION @META_APP_DESCRIPTION_STR@
|
||||
#endif // APP_METADATA_AVAIL
|
|
@ -1,5 +1,4 @@
|
|||
#dirs
|
||||
UI_DIR = ./gui
|
||||
MOC_DIR = ./moc
|
||||
OBJECTS_DIR = ./obj
|
||||
RCC_DIR = ./res
|
||||
|
@ -18,6 +17,7 @@ CONFIG(debug, debug|release) {
|
|||
TARGET = $${targetprefix}$${projectname}
|
||||
}
|
||||
# add defines
|
||||
DEFINES += "APP_METADATA_AVAIL"
|
||||
DEFINES += "'PROJECT_NAME=\"$${projectname}\"'"
|
||||
DEFINES += "'APP_NAME=\"$${appname}\"'"
|
||||
DEFINES += "'APP_AUTHOR=\"$${appauthor}\"'"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "location.h"
|
||||
#include "utils.h"
|
||||
#include "./location.h"
|
||||
#include "./utils.h"
|
||||
|
||||
#include <c++utilities/application/failure.h>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef LOCATION_H
|
||||
#define LOCATION_H
|
||||
|
||||
#include "angle.h"
|
||||
#include "./angle.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
|
15
main.cpp
15
main.cpp
|
@ -1,6 +1,11 @@
|
|||
#include "main.h"
|
||||
#include "location.h"
|
||||
#include "utils.h"
|
||||
#include "./main.h"
|
||||
#include "./location.h"
|
||||
#include "./utils.h"
|
||||
|
||||
// include configuration from separate header file when building with CMake
|
||||
#ifndef APP_METADATA_AVAIL
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <c++utilities/application/argumentparser.h>
|
||||
#include <c++utilities/application/failure.h>
|
||||
|
@ -21,6 +26,8 @@ SystemForLocations outputSystemForLocations = SystemForLocations::LatitudeLongit
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
try {
|
||||
SET_APPLICATION_INFO;
|
||||
|
||||
ArgumentParser argparser;
|
||||
|
||||
Argument convert("convert", "c", "Converts the given coordinate or location to the specified output form.");
|
||||
|
@ -144,7 +151,7 @@ int main(int argc, char *argv[])
|
|||
cout << endl;
|
||||
printAngleFormatInfo(cout);
|
||||
} else if(version.isPresent()) {
|
||||
cout << "1.0.0";
|
||||
cout << APP_VERSION;
|
||||
} else if(convert.isPresent()) {
|
||||
printConversion(convert.value(0));
|
||||
} else if(distance.isPresent()) {
|
||||
|
|
4
main.h
4
main.h
|
@ -1,8 +1,8 @@
|
|||
#ifndef MAIN_H_INCLUDED
|
||||
#define MAIN_H_INCLUDED
|
||||
|
||||
#include "angle.h"
|
||||
#include "location.h"
|
||||
#include "./angle.h"
|
||||
#include "./location.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
|
Loading…
Reference in New Issue