X-Git-Url: https://vaikene.ee/gitweb/gitweb.cgi?p=evaf;a=blobdiff_plain;f=www%2Fpswgen08.html;fp=www%2Fpswgen08.html;h=761927a94ef4651b252d4238a51039bbbfed7802;hp=0000000000000000000000000000000000000000;hb=0a383af776fe4c1c0ac1059dd3732f32cb6e1c7a;hpb=adefe2aae67c52dc2aa41c45aedb8ad822478ee1 diff --git a/www/pswgen08.html b/www/pswgen08.html new file mode 100644 index 0000000..761927a --- /dev/null +++ b/www/pswgen08.html @@ -0,0 +1,99 @@ + + + + + + eVaf Tutorial - 08 - Building Storage Module + + + + + + + + + +

eVaf Tutorial

+ +

08 - Buiding Storage Module

+ +

CMakeLists.txt

+ +

Copy an existing CMakeLists.txt file from the Generator module:

+ +
evaf/src/apps/PswGen/Storage $ cp ../CMakeLists.txt .
+ +

We only need to modify the TARGET variable and set QT_USE_QTSQL to TRUE:

+ +
# Name of the target
+set(TARGET PswStorage)
+
+# Qt modules
+set(QT_USE_QTSQL TRUE)
+ +

Here is the final CMakeLists.txt file:

+ +
# src/apps/PswGen/Storage/CMakeLists.txt
+
+# Name of the target
+set(TARGET PswStorage)
+
+# Qt modules
+set(QT_USE_QTSQL TRUE)
+set(QT_DONT_USE_QTGUI TRUE)
+include(${QT_USE_FILE})
+
+# Include directories
+include_directories(${eVaf_INCLUDE})
+
+# Required eVaf libraries
+set(eVaf_LIBRARIES CommonLib PluginsLib)
+
+# Source files
+set(SRCS
+    module.cpp
+)
+
+# Header files for the Qt meta-object compiler
+set(MOC_HDRS
+    module.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 Storage + sub-directory:

+ +
# src/apps/PswGen/CMakeLists.txt
+# ...
+add_subdirectory(Storage)
+ +

Building the module

+ +

Go to the previously made build directory and build the module:

+ +
evaf $ cd build
+evaf/build $ make PswStorage
+ +

Check the bin directory, which should now contain a new library:

+ +
evaf/build $ ls bin
+libCommonLib.so*  libPluginsLib.so*  libPswGen.so*  libPswStorage.so*
+evaf/build $
+ +

In the next section 09 - GUI Module we write the Graphical User Interface Module.

+ + +