building.rst 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. Building the Library
  2. ====================
  3. Building the Single-File Release
  4. --------------------------------
  5. Using the GCC compiler, the following calls build the library on Linux.
  6. .. code-block:: bash
  7. gcc -std=c99 -fPIC -c open62541.c
  8. gcc -shared open62541.o -o libopen62541.so
  9. Building with CMake on Ubuntu or Debian
  10. ---------------------------------------
  11. .. code-block:: bash
  12. sudo apt-get install git build-essential gcc pkg-config cmake python python-lxml
  13. # enable additional features
  14. sudo apt-get install libexpat1-dev # for XML-encodingi
  15. sudo apt-get install liburcu-dev # for multithreading
  16. sudo apt-get install check # for unit tests
  17. sudo apt-get install graphviz doxygen # for documentation generation
  18. cd open62541
  19. mkdir build
  20. cd build
  21. cmake ..
  22. make
  23. # select additional features
  24. ccmake ..
  25. make
  26. Building with CMake on Windows
  27. ------------------------------
  28. Here we explain the build process for Visual Studio. To build with MinGW, just
  29. replace the compiler selection in the call to CMake.
  30. - Download and install
  31. - Python 2.7.x (Python 3.x should work, too): https://python.org/downloads
  32. - Python lxml: https://pypi.python.org/pypi/lxml
  33. - CMake: http://www.cmake.org/cmake/resources/software.html
  34. - Microsoft Visual Studio 2015 Community Edition: https://www.visualstudio.com/products/visual-studio-community-vs
  35. - Download the open62541 sources (using git or as a zipfile from github)
  36. - Open a command shell (cmd) and run
  37. .. code-block:: bat
  38. cd <path-to>\open62541
  39. mkdir build
  40. cd build
  41. <path-to>\cmake.exe .. -G "Visual Studio 14 2015"
  42. :: You can use use cmake-gui for a graphical user-interface to select single features
  43. - Then open "build\open62541.sln" in Visual Studio 2015 and build as usual
  44. Building on OS X
  45. ----------------
  46. - Download and install
  47. - Xcode: https://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12
  48. - Homebrew: http://brew.sh/
  49. - Pip (a package manager for python, may be preinstalled): ``sudo easy_install pip``
  50. - Run the following in a shell
  51. .. code-block:: bash
  52. brew install cmake
  53. brew install libxml2
  54. pip install lxml
  55. brew install check # for unit tests
  56. brew install userspace-rcu # for multi-threading support
  57. brew install graphviz doxygen # for documentation generation
  58. pip install sphinx # for documentation generation
  59. Follow Ubuntu instructions without the ``apt-get`` commands as these are taken care of by the above packages.
  60. Build Options
  61. -------------
  62. Generic CMake options
  63. ~~~~~~~~~~~~~~~~~~~~~
  64. **CMAKE_BUILD_TYPE**
  65. - RelWithDebInfo: -O2 optimization with debug symbols
  66. - Release: -O2 optimization without debug symbols
  67. - Debug: -O0 optimization with debug symbols
  68. - MinSizeRel: -Os optimization without debug symbols
  69. BUILD_* group
  70. ~~~~~~~~~~~~~
  71. By default only the shared object libopen62541.so or the library open62541.dll
  72. and open62541.dll.a resp. open62541.lib are build. Additional artifacts can be
  73. specified by the following options:
  74. **BUILD_DOCUMENTATION**
  75. Generate documentation with doxygen
  76. **BUILD_EXAMPLECLIENT**
  77. Compile example clients from client.c. There are a static and a dynamic binary client and client_static, respectively
  78. **BUILD_EXAMPLESERVER**
  79. Compile example server from server.c There are a static and a dynamic binary server and server_static, respectively
  80. **BUILD_UNIT_TESTS**
  81. Compile unit tests with Check framework. The tests can be executed with make test
  82. **BUILD_EXAMPLES**
  83. Compile specific examples from https://github.com/acplt/open62541/blob/master/examples/
  84. ENABLE_* group
  85. ~~~~~~~~~~~~~~
  86. This group contains build options related to the supported OPC UA features.
  87. **ENABLE_NODEMANAGEMENT**
  88. Node management services (adding and removing nodes and references) in server and client
  89. **ENABLE_AMALGAMATION**
  90. Compile a single-file release files open62541.c and open62541.h
  91. **ENABLE_COVERAGE**
  92. Measure the coverage of unit tests
  93. **ENABLE_EXTERNAL_NAMESPACES**
  94. Enable external namespaces in server
  95. **ENABLE_GNERATE_NAMESPACE0**
  96. Enable automatic generation of NS0
  97. **GENERATE_NAMESPACE0_FILE**
  98. File for NS0 generation from namespace0 folder. Default value is Opc.Ua.NodeSet2.xml
  99. **ENABLE_METHODCALL**
  100. Enable method calls in server and client
  101. **ENABLE_MULTITHREADING**
  102. Enable multi-threading support (experimental)
  103. **ENABLE_SUBSCRIPTONS**
  104. Enable subscriptions
  105. **GENERATE_SELFSIGNED**
  106. Generate a self-signed certificate for the server (openSSL required)
  107. EXTENSION_* group
  108. ~~~~~~~~~~~~~~~~~
  109. Extensions mark experimental extensions that are not compliant with IEC 62541 or
  110. other OPC UA clients
  111. **EXTENSION_STATELESS**
  112. Stateless service calls
  113. **EXTENSION_UDP**
  114. UDP network layer
  115. UA_* group
  116. ~~~~~~~~~~
  117. **UA_LOGLEVEL**
  118. The level of logging events that are reported
  119. - 600: Fatal and all below
  120. - 500: Error and all below
  121. - 400: Error and all below
  122. - 300: Info and all below
  123. - 200: Debug and all below
  124. - 100: Trace and all below
  125. C precompiler configuration options
  126. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  127. Options that are not inherited from the CMake configuration are defined in
  128. ua_config.h. Usually there is no need to adjust them.
  129. **UA_NON_LITTLEENDIAN_ARCHITECTURE**
  130. Big-endian or mixed endian platform
  131. **UA_MIXED_ENDIAN**
  132. Mixed-endian platform (e.g., ARM7TDMI)
  133. **UA_ALIGNED_MEMORY_ACCESS**
  134. Platform with aligned memory access only (some ARM processors, e.g. Cortex M3/M4 ARM7TDMI etc.)