Ver código fonte

use check with cmake

Julius Pfrommer 9 anos atrás
pai
commit
82af62d740

+ 35 - 44
.travis.yml

@@ -8,50 +8,41 @@ env:
    # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
    - secure: "ehswgymGXPM3UINhOOnfSByMnrRNTixeT2vEV+z3kXy3WHew/O1yt9GxaYGrUhJPg4+5chAQgjYmezO1x3/CUKFgeHQUmVTFWEzfy1kL1JVjO+ufYyJDnbY+x3OmyNmMYcef2J5MAuUS2C1KFvIxtLsljVK+gpe4LcylkCIF/3Y="
 addons:
-  coverity_scan:
-    project:
-      name: acplt/open62541
-      description: Open-source OPC UA
-    notification_email: null@plt.rwth-aachen.de
-    build_command_prepend: ./autogen.sh && ./configure
-    build_command: make
-    branch_pattern: coverity_scan
+#  coverity_scan:
+#    project:
+#      name: acplt/open62541
+#      description: Open-source OPC UA
+#    notification_email: null@plt.rwth-aachen.de
+#    build_command_prepend: ./autogen.sh && ./configure
+#    build_command: make
+#    branch_pattern: coverity_scan
 before_install:
-- sudo add-apt-repository ppa:libreoffice/ppa -y
-- sudo apt-get update -qq
-- sudo apt-get install -qq build-essential subversion git autoconf libtool texinfo
-  python-lxml graphviz doxygen
-- svn checkout https://svn.code.sf.net/p/check/code/trunk check-code
-- cd check-code
-- autoreconf --install
-- ./configure
-- make
-- sudo make install
-- sudo ldconfig
-- cd ..
-- rm -rf check-code
-- sudo pip install cpp-coveralls
+   - sudo apt-get update -qq
+   - sudo apt-get install -qq build-essential cmake python-lxml graphviz doxygen check
+   - sudo pip install cpp-coveralls
 script: 
-   - ./autogen.sh 
-   - ./configure 
-   - echo "Production build + checks"
-   - make && make check && make clean
-   - echo "Extended debug build + checks + coverage + doxygen"
-   - ./configure --enable-debug --enable-coverage --enable-doxygen
-   - make all && make check
+   - mkdir build
+   - cd build
+   - cmake .. 
+   - make
+#   - echo "Production build + checks"
+#   - make && make check && make clean
+#   - echo "Extended debug build + checks + coverage + doxygen"
+#   - ./configure --enable-debug --enable-coverage --enable-doxygen
+#   - make all && make check
 after_success:
-   - git clone --depth=50 -b gh-pages https://$GITAUTH@github.com/acplt/open62541
-   - rm -rf open62541/doxygen
-   - cp -r doc/html open62541/doxygen
-   - cd open62541/doxygen
-   - git config --global user.email "open62541-travis-ci@users.noreply.github.com"
-   - git config --global user.name "Open62541 travis-ci"
-   - git config --global push.default simple
-   - git add *
-   - git commit -am "doxygen updated by travis-ci"
-   - git push https://$GITAUTH@github.com/acplt/open62541
-   - cd ..
-   - cd ..
-   - rm -rf open62541
-   - ./tools/.coverity.sh
-   - coveralls -b src --exclude doc --exclude examples --exclude tests --exclude wrappers --exclude src/.libs --exclude src/util/.libs -E '.*\.h' 
+#   - git clone --depth=50 -b gh-pages https://$GITAUTH@github.com/acplt/open62541
+#   - rm -rf open62541/doxygen
+#   - cp -r doc/html open62541/doxygen
+#   - cd open62541/doxygen
+#   - git config --global user.email "open62541-travis-ci@users.noreply.github.com"
+#   - git config --global user.name "Open62541 travis-ci"
+#   - git config --global push.default simple
+#   - git add *
+#   - git commit -am "doxygen updated by travis-ci"
+#   - git push https://$GITAUTH@github.com/acplt/open62541
+#   - cd ..
+#   - cd ..
+#   - rm -rf open62541
+#   - ./tools/.coverity.sh
+#   - coveralls -b src --exclude doc --exclude examples --exclude tests --exclude wrappers --exclude src/.libs --exclude src/util/.libs -E '.*\.h' 

+ 3 - 3
CMakeLists.txt

@@ -5,7 +5,7 @@ project(open62541)
 set(open62541_VERSION_MAJOR 0)
 set(open62541_VERSION_MINOR 1)
 
-# set(CMAKE_VERBOSE_MAKEFILE on )
+set(CMAKE_VERBOSE_MAKEFILE on )
 
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules")
 
@@ -138,8 +138,8 @@ if(WIN32)
 endif(WIN32)
 
 # build example implementations
-add_executable(exampleServer examples/src/opcuaServer.c
-                              examples/src/networklayer.c)
+add_executable(exampleServer examples/opcuaServer.c
+                             examples/networklayer.c)
 target_link_libraries(exampleServer open62541) 
 
 # generate documentation

+ 52 - 93
README.md

@@ -11,110 +11,69 @@ An open-source communication stack implementation of OPC UA (OPC Unified Archite
 ### Documentation
 Documentation is generated from Doxygen annotations in the source code. The current version can be accessed at [http://open62541.org/doxygen/](http://open62541.org/doxygen/).
 
-## Getting dependencies
+## Build Procedure
 ### Ubuntu
-##### Getting gcc toolchain:
 ```bash
-sudo apt-get install build-essential subversion git autoconf libtool pkg-config texinfo
+sudo apt-get install git build-essential gcc cmake python python-lxml # install build infrastructure
+
+git clone https://github.com/acplt/open62541.git
+cd open62541
+mkdir build
+cmake .. # generate the build scripts
+make # creates executables in the build directory
+
+# enable additional features
+sudo apt-get install libexpat1-dev # for XML-encoding
+sudo apt-get install liburcu-dev # for multithreading
+sudo apt-get install check # for unit tests
+sudo apt-get install graphviz doxygen # for documentation generation
+
+ccmake .. # to select features for compilation. Use "cmake-gui .." for more eye-candy
+make
 ```
-##### Getting python toolchain for the 62541 structures code generator:
-```bash
-sudo apt-get install python python-lxml 
-```
-##### Getting additional libraries:
-```bash
-sudo apt-get install expat libexpat1-dev liburcu-dev
-```
-##### Getting and installing *check* as unit test framework (http://check.sourceforge.net/):
-```bash
-$ svn checkout https://svn.code.sf.net/p/check/code/trunk check-code
-$ cd check-code
-$ autoreconf --install
-$ ./configure
-$ make
-$ sudo make install
-$ sudo ldconfig
-```
-##### Getting and using Doxygen
-* install the needed packages
-```bash
-sudo apt-get install graphviz doxygen
-```
-* configure autotools, clean and build:
+
+### Windows (Visual Studio)
+* Get and install Python and CMake: https://python.org/downloads, http://www.cmake.org/cmake/resources/software.html
+* Get and install Visual Studio 2013 (Express): http://www.microsoft.com/en-US/download/details.aspx?id=40787
+* Download the open62541 sources (using git or as a zipfile from github)
+* Add the folder with the python executable to the Windows PATH (System Settings)
+* Download https://bootstrap.pypa.io/get-pip.py
+* Open a command shell (cmd) and run
 ```bash
-$ ./configure --enable-doxygen
-$ make clean
-$ make all
+python <path-to>\get-pip.py
+python -m pip install lxml
+cd <path-to>\open62541
+mkdir build
+cd build
+<path-to>\cmake.exe .. -G "Visual Studio 12 2013"
+open "build\open62541.sln" in Visual Studio 2013 and build as usual
 ```
-* the output is generated in doc/html/index.htm
-* configure the output of Doxygen with doc/Doxygen.in file
-
-### Windows
-##### Getting MinGW and MSYS:
-* Get the latest MinGW installer: http://sourceforge.net/projects/mingw/files/latest/download?source=files
-* Select following packages: mingw-developer-toolkit, mingw32-base, msys-base
-* After install, run MinGW\msys\1.0\postinstall\pi.bat
-
-##### Get Gtk+ bundle (just for m4 marcros and pkg-config):
-* Download http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip and extract it
-* Copy gtk+/share/aclocal/*.m4 files to MinGW/share/aclocal
-* Merge grk+ folder and MinGW\msys\1.0\ folder
 
-##### Get expat
-* start MinGW Installation Manager
-* choose all Packages, mark mingw32-expat and install
-* Open MinGW\msys\1.0\msys.bat
+### Windows (MinGW)
+* Execute the same steps as in the Visual Studio case. But instead of installing Visual Studio, get and install MinGW:
+   * Get the latest MinGW installer: http://sourceforge.net/projects/mingw/files/latest/download?source=files
+   * Select following packages: mingw-developer-toolkit, mingw32-base, msys-base
+   * After install, run MinGW\msys\1.0\postinstall\pi.bat
+* The cmake command changes to
 ```bash
-$ mingw-get install libexpat
+<path-to>\cmake.exe .. -G "MinGW Makefiles"
 ```
-
-##### Get Python and lxml:
-* download Python (Windows x86 MSI Installer) at https://python.org/downloads (necessary version: 2.7.x)
-* install the executable
-* add the install directory (e. g. "c:\python27") to your windows path variable [Selectable in the setup-options]
-* restart mingw console
-* install lxml by either downloading and installing http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml (choose the version which fits    to your python installation (x86 version)) or by following the instructions
-  given here: http://lxml.de/installation.html 
-* add ("C:\Python27\Tools\Scripts") to your windows path variable
-
-
-##### Get git (IMPORTANT: get 1.8.4, since 1.8.5.2 has a bug):
-* http://code.google.com/p/msysgit/downloads/detail?name=Git-1.8.4-preview20130916.exe&can=2&q=
-
-##### SVN:
-* download: http://tortoisesvn.net/downloads.html
-* install svn @ c:\MinGW\
-
-##### Getting and installing *check* as unit testing framework (http://check.sourceforge.net/):
-* Open MinGW\msys\1.0\msys.bat
-
+* Then run (still in the build folder)
 ```bash
-$ svn checkout svn://svn.code.sf.net/p/check/code/trunk check-code
-$ cd check-code
-$ autoreconf --install
-$ ./configure
-$ make
-$ make install
+<path-to>/mingw32-make.exe
 ```
 
-##### Adjusting MinGW
-* open the file c:\MinGW\include\io.h and replace every off64_t with _off64_t (4x should off64_t appear)
-* open the file c:\MinGW\include\unistd.h and replace every off_t with _off_t (2x should off_t appear)
-* download the queue.h header @ http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys/queue.h and copy it to c:\MinGW\include\sys
+#### Get expat
+* Start MinGW Installation Manager ```mingw-get.exe```
+* Choose all Packages, mark mingw32-expat and install
 
-## Building 
-* use autogen.sh only first time and whenever aclocal.m4 or configure.ac were modified
+#### Get the *check* unit testing framework
+* Download check from http://check.sourceforge.net/
+* Open MinGW\msys\1.0\msys.bat
 ```bash
-$ cd open62541
-$ ./autogen.sh
-$ ./configure --enable-debug=yes
-$ make
-$ make check
+cd check-code
+autoreconf --install
+./configure
+make
+make install
 ```
-
-### Configure Options 
-
-* --enable-debug=(yes|no|verbose) - omit/include debug code
-* --enable-multithreading - enable pthreads (for examples/src/opcuaServerMT)
-* --enable-doxygen - make documentation as well
-* --enable-coverage - profiling with gcov,lcov, make check will generate reports in tests/coverage 

examples/src/generateSam.c → examples/generateSam.c


examples/src/networklayer.c → examples/networklayer.c


examples/src/networklayer.h → examples/networklayer.h


examples/src/opcuaServer.c → examples/opcuaServer.c


examples/src/opcuaServerACPLT.c → examples/opcuaServerACPLT.c


examples/src/opcuaServerMT.c → examples/opcuaServerMT.c


examples/src/opcuaServerMini.c → examples/opcuaServerMini.c


+ 0 - 37
examples/src/Makefile.am

@@ -1,37 +0,0 @@
-bin_PROGRAMS =
-
-if UA_ENCODING_XML
-bin_PROGRAMS += $(top_builddir)/bin/xml2ns0 
-__top_builddir__bin_xml2ns0_SOURCES = xml2ns0.c
-__top_builddir__bin_xml2ns0_CFLAGS = -I$(top_builddir)/src -I$(top_builddir)/include $(GLOBAL_AM_CFLAGS)
-__top_builddir__bin_xml2ns0_LDADD = $(top_builddir)/lib/libopen62541.a $(GLOBAL_AM_LDADD)
-__top_builddir__bin_xml2ns0_LDFLAGS = -lexpat
-
-bin_PROGRAMS += $(top_builddir)/bin/generateSam 
-__top_builddir__bin_generateSam_SOURCES = generateSam.c
-__top_builddir__bin_generateSam_CFLAGS = -I$(top_builddir)/src -I$(top_builddir)/include $(GLOBAL_AM_CFLAGS)
-__top_builddir__bin_generateSam_LDADD = $(top_builddir)/lib/libopen62541.a $(GLOBAL_AM_LDADD)
-__top_builddir__bin_generateSam_LDFLAGS = -lexpat
-endif
-
-if MULTITHREADING
-bin_PROGRAMS += $(top_builddir)/bin/exampleServerMT 
-__top_builddir__bin_exampleServerMT_CFLAGS = -I$(top_builddir)/src -I$(top_builddir)/include $(GLOBAL_AM_CFLAGS)
-__top_builddir__bin_exampleServerMT_SOURCES = opcuaServerMT.c networklayer.c
-__top_builddir__bin_exampleServerMT_LDADD= $(top_builddir)/lib/libopen62541.a $(GLOBAL_AM_LDADD)
-else
-#bin_PROGRAMS += $(top_builddir)/bin/exampleServer $(top_builddir)/bin/exampleServerACPLT $(top_builddir)/bin/exampleServerMini
-bin_PROGRAMS += $(top_builddir)/bin/exampleServer $(top_builddir)/bin/exampleServerACPLT
-__top_builddir__bin_exampleServer_CFLAGS = -I$(top_builddir)/src -I$(top_builddir)/include $(GLOBAL_AM_CFLAGS)
-__top_builddir__bin_exampleServer_SOURCES = opcuaServer.c networklayer.c
-__top_builddir__bin_exampleServer_LDADD= $(top_builddir)/lib/libopen62541.a $(GLOBAL_AM_LDADD)
-
-__top_builddir__bin_exampleServerACPLT_CFLAGS = -I$(top_builddir)/src -I$(top_builddir)/include $(GLOBAL_AM_CFLAGS)
-__top_builddir__bin_exampleServerACPLT_SOURCES = opcuaServerACPLT.c networklayer.c
-__top_builddir__bin_exampleServerACPLT_LDADD= $(top_builddir)/lib/libopen62541.a $(GLOBAL_AM_LDADD)
-
-#__top_builddir__bin_exampleServerMini_CFLAGS = -I$(top_builddir)/src -I$(top_builddir)/include $(GLOBAL_AM_CFLAGS)
-#__top_builddir__bin_exampleServerMini_SOURCES = opcuaServerMini.c 
-#__top_builddir__bin_exampleServerMini_LDADD= $(GLOBAL_AM_LDADD)
-
-endif

examples/src/xml2ns0.c → examples/xml2ns0.c


+ 11 - 8
tests/CMakeLists.txt

@@ -1,33 +1,36 @@
 find_package(Check REQUIRED)
+find_package(Threads REQUIRED)
+
+set(LIBS open62541 check m rt pthread)
 
 add_executable(check_builtin check_builtin.c)
-target_link_libraries(check_builtin open62541 check)
+target_link_libraries(check_builtin ${LIBS})
 add_test(builtin ${CMAKE_CURRENT_BINARY_DIR}/check_builtin)
 
 add_executable(check_memory check_memory.c)
-target_link_libraries(check_memory open62541 check)
+target_link_libraries(check_memory ${LIBS})
 add_test(memory ${CMAKE_CURRENT_BINARY_DIR}/check_memory)
 
 add_executable(check_stack check_stack.c)
-target_link_libraries(check_stack open62541 check)
+target_link_libraries(check_stack ${LIBS})
 add_test(stack ${CMAKE_CURRENT_BINARY_DIR}/check_stack)
 
 add_executable(check_list check_list.c)
-target_link_libraries(check_list open62541 check)
+target_link_libraries(check_list ${LIBS})
 add_test(list ${CMAKE_CURRENT_BINARY_DIR}/check_list)
 
 add_executable(check_indexedList check_indexedList.c)
-target_link_libraries(check_indexedList open62541 check)
+target_link_libraries(check_indexedList ${LIBS})
 add_test(indexedList ${CMAKE_CURRENT_BINARY_DIR}/check_indexedList)
 
 add_executable(check_base64 check_base64.c)
-target_link_libraries(check_base64 open62541 check)
+target_link_libraries(check_base64 ${LIBS})
 add_test(base64 ${CMAKE_CURRENT_BINARY_DIR}/check_base64)
 
 add_executable(check_services_view check_services_view.c)
-target_link_libraries(check_services_view open62541 check)
+target_link_libraries(check_services_view ${LIBS})
 add_test(services_view ${CMAKE_CURRENT_BINARY_DIR}/check_services_view)
 
 add_executable(check_namespace check_namespace.c)
-target_link_libraries(check_namespace open62541 check)
+target_link_libraries(check_namespace ${LIBS})
 add_test(namespace ${CMAKE_CURRENT_BINARY_DIR}/check_namespace)