X-Git-Url: https://vaikene.ee/gitweb/gitweb.cgi?p=evaf;a=blobdiff_plain;f=www%2Fpswgen11.html;fp=www%2Fpswgen11.html;h=7fb3f324ac4a4871ad3268759b07405194a9e5ab;hp=0000000000000000000000000000000000000000;hb=30c0930d760d6338dba3982e01125b10f84c47b2;hpb=9ff1850fa199fa072e51a2c8ef6de45d256721f0 diff --git a/www/pswgen11.html b/www/pswgen11.html new file mode 100644 index 0000000..7fb3f32 --- /dev/null +++ b/www/pswgen11.html @@ -0,0 +1,198 @@ + + + +
+ +Copy an existing CMakeLists.txt file from the Storage module:
+ +evaf/src/apps/PswGen/GUI $ cp ../Storage/CMakeLists.txt .
+
+ We need to modify the TARGET variable and remove QT_USE_QTSQL and QT_DONT_USE_QTGUI variables. + This module needs QtGui and does not need QtSql. Als add SdiWindow to the list of eVaf libraries + as the module that implements the main window.
+ +# Name of the target +set(TARGET PswGui) + +# Qt modules +include(${QT_USE_FILE}) + +# Required eVaf libraries +set(eVaf_LIBRARIES CommonLib PluginsLib SdiWindow)+ +
Here is the final CMakeLists.txt file:
+ +# src/apps/PswGen/GUI/CMakeLists.txt + +# Name of the target +set(TARGET PswGui) + +# Qt modules +include(${QT_USE_FILE}) + +# Include directories +include_directories(${eVaf_INCLUDE}) + +# Required eVaf libraries +set(eVaf_LIBRARIES CommonLib PluginsLib SdiWindow) + +# Source files +set(SRCS + gui.cpp +) + +# Header files for the Qt meta-object compiler +set(MOC_HDRS + gui.h +) + +# Version info resource file for Windows builds +if(WIN32) + set(SRCS ${SRCS} version.rc) +endif(WIN32) + +# Run the Qt meta-object compiler +qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS}) + +# Compile the module +add_library(${TARGET} SHARED ${SRCS} ${MOC_SRCS}) + +# Link the module +target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})+ +
Open the CMakeLists.txt file in the parent directory and add the command to include the GUI + sub-directory:
+ +# src/apps/PswGen/CMakeLists.txt +# ... +add_subdirectory(GUI)+ +
Go to the previously made build directory and build the module:
+ +evaf $+ +cd build
+evaf/build $make PswGui
Check the bin directory, which should now contain two new libraries:
+ +evaf/build $ ls bin
+libCommonLib.so* libPluginsLib.so* libPswGen.so* libPswGui.so* libPswStorage.so* libSdiWindow.so*
+evaf/build $
+
+ The libSdiWindow.so library was built because it is a dependency of the GUI module.
+ +In the same build directory, create few more sub-directories needed by any eVaf applications:
+ + evaf/build $ mkdir {etc,log}
+
+ Create the PswGen.xml file in the build/etc directory. The PswGen.xml file defines the + application by specifying all the modules that the application needs to load.
+ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE eVaf> +<eVaf version="1.0"> + <plugins> + <plugin name="SdiWindow" filename="SdiWindow" /> + <plugin name="Generator" filename="PswGen" /> + <plugin name="Storage" filename="PswStorage" /> + <plugin name="GUI" filename="PswGui" /> + </plugins> +</eVaf>+ +
Modules are loaded and initialized in the order how they are specified in the xml file. We have to make sure that + SdiWindow, Generator and Storage modules are loaded before the GUI module. Otherwise + their interfaces wouldn't be available when the GUI module is initialized.
+ +The name attribute here is optional and will be replaced with the name reported by the actual module.
+ +The filename attribute specifies the name of the library file without prefixes and suffixes meaning that + libPswGen.so shall be specified as PswGen. This makes sure that the same xml file can be also used + on Windows, where the library would be called PswGen.dll.
+ +There is no executable file yet that we can run. Build it with the following command:
+ +evaf/build $ make eVafGUI
+
+ This command builds the GUI executable and stores it in the evaf/build/bin directory. The bin directory should look now the following:
+ +evaf/build $ ls bin
+eVafGUI* libCommonLib.so* libPluginsLib.so* libPswGen.so* libPswGui.so* libPswStorage.so* libSdiWindow.so*
+evaf/build $
+
+ Now we can run the PswGen application. Change --dataroot=${HOME}/evaf/build to your actual build directory name:
+ +evaf/build $ bin/eVafGUI --application=PswGen --dataroot=${HOME}/evaf/build --verbose=INFO
+
+ The --application=PswGen command line option specifies the name of the application and also means that the xml file + should be called PswGen.xml. Different applications can be run in the same build directories by changing the name + of the application. The default application is called eVaf and if no name is given, then the xml file should be called + eVaf.xml.
+ +The --dataroot=${HOME}/evaf/build command line option specifies the location of data files for the application. The + application assumes that etc and spool directories are sub-directories in the data root directory. The default + data root directory is ${HOME}/.local/share/data on + Linux.
+ +Finally, the --verbose=INFO command line option makes the application to be verbose and output all the info + messages to the console.
+ +Now the application is written and tested. We are ready to make a release build and ship it.
+ +Clean the build directory:
+ +evaf/build $ make clean && rm CMakeCache.txt
+
+ Prepare for a release build and build the application:
+ +evaf/build $+ +cmake -DCMAKE_BUILD_TYPE=Release ..
+evaf/build $make eVafGUI SdiWindow PswGen PswStorage PswGui
Packaging and shipping the application is out of the scope of this tutorial and involves more than just copying files that + we built. As a minimum, we have to make sure that the target system has Qt libraries installed. In this tutorial, we simply copy the + released application into the {$HOME}/bin/evaf directory. Qt libraries are already installed and we do not need to + worry about them.
+ +Create the ${HOME}/bin/evaf directory:
+ +evaf/build $ mkdir -p ${HOME}/bin/evaf
+
+ Copy the content of bin and etc directories
+ +evaf/build $ cp -R bin etc ${HOME}/bin/evaf/
+
+ Create the bash script PswGen in the ${HOME}/bin directory:
+ +#!/bin/bash +EVAF_DIR=${HOME}/bin/evaf +${EVAF_DIR}/bin/eVafGUI --rootdir=${EVAF_DIR} --dataroot=${EVAF_DIR} --application=PswGen ++ +
Don't forget to make it runnable:
+ + bin $ chmod a+x PswGen
+
+ Now we can run the application by simply running the bash script PswGen in the ${HOME}/bin directory. + + +