add Version Options

This commit is contained in:
intelligide 2015-07-03 17:56:19 +02:00
parent f02395ab65
commit ae1763a3e4
5 changed files with 75 additions and 2 deletions

9
doc/manual/libraries.rst Normal file
View File

@ -0,0 +1,9 @@
Libraries
=============================================
Contents:
.. toctree::
:maxdepth: 2
libraries/math

View File

@ -0,0 +1,35 @@
mkg1m
*****
Synopsis
========
::
mkg1m input [-o output][-Ldir][-l cLib]
Description
===========
Convert text file to Casio G1M File
Options
=======
``-o input``
Write output to file. You must use -o
to specify the output file.
``-llibrary``
``-l library``
Search the library named library.
``-Ldir``
``-L dir``
add all the libraries in the folder *dir*.
``-h``
Print usage information.
``-v``
Print version information.

View File

@ -10,4 +10,10 @@ add_executable(
)
install (TARGETS mkg1m
DESTINATION ${INSTALL_RUNTIME_DIR})
DESTINATION ${INSTALL_RUNTIME_DIR})
set(Mkg1m_VERSION 1.0.0)
set(Mkg1m_VERSION 1)
configure_file(version.h.in version.h @ONLY)
include_directories(${CMAKE_BINARY_DIR}/src/mkg1m/)

View File

@ -6,9 +6,22 @@
#include <unistd.h>
#include <cstdlib>
#include "assemble.hpp"
#include "version.h"
using namespace std;
string getVersionString(){
string str;
str += "g1m-assembler-mkg1m version ";
str += MKG1M_VERSION;
str += " release ";
str += MKG1M_RELEASE;
return str;
}
vector<string> check_cLibraries(vector<string> clibList, vector<string> clibDirList){
vector<string> clib;
for(int i=0; i<clibList.size();i++){
@ -40,7 +53,7 @@ int main(int argc,char *argv[])
int c;
opterr = 0; // disable getopt error
while ((c = getopt (argc, argv, "o:i:l:L:")) != -1){
while ((c = getopt (argc, argv, "o:i:l:L:vh")) != -1){
switch (c){
case 'o':
outputFiles.push_back(optarg); //get output files
@ -54,6 +67,9 @@ int main(int argc,char *argv[])
case 'L':
CLibraryDir.push_back(optarg); //get input files
break;
case 'v':
cout << getVersionString();
return 0;
case '?':
if (optopt == 'o')
fprintf (stderr, "Option -%c requires an argument.\n", optopt);

7
src/mkg1m/version.h.in Normal file
View File

@ -0,0 +1,7 @@
#ifndef MKG1M_VERSION_H
#define MKG1M_VERSION_H
#define MKG1M_VERSION "@Mkg1m_VERSION@"
#define MKG1M_RELEASE "@Mkg1m_RELEASE@"
#endif