building.rst 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. **CMAKE_BUILD_TYPE**
  63. - RelWithDebInfo: -O2 optimization with debug symbols
  64. - Release: -O2 optimization without debug symbols
  65. - Debug: -O0 optimization with debug symbols
  66. - MinSizeRel: -Os optimization without debug symbols
  67. **UA_LOGLEVEL**
  68. The level of logging events that are reported
  69. - 600: Fatal and all below
  70. - 500: Error and all below
  71. - 400: Error and all below
  72. - 300: Info and all below
  73. - 200: Debug and all below
  74. - 100: Trace and all below
  75. Further options that are not inherited from the CMake configuration are defined
  76. in ua_config.h. Usually there is no need to adjust them.
  77. **UA_NON_LITTLEENDIAN_ARCHITECTURE**
  78. Big-endian or mixed endian platform
  79. **UA_MIXED_ENDIAN**
  80. Mixed-endian platform (e.g., ARM7TDMI)
  81. UA_BUILD_* group
  82. ~~~~~~~~~~~~~
  83. By default only the shared object libopen62541.so or the library open62541.dll
  84. and open62541.dll.a resp. open62541.lib are build. Additional artifacts can be
  85. specified by the following options:
  86. **UA_BUILD_DOCUMENTATION**
  87. Generate documentation with doxygen
  88. **UA_BUILD_EXAMPLECLIENT**
  89. Compile example clients from client.c. There are a static and a dynamic binary client and client_static, respectively
  90. **UA_BUILD_EXAMPLESERVER**
  91. Compile example server from server.c There are a static and a dynamic binary server and server_static, respectively
  92. **UA_BUILD_UNIT_TESTS**
  93. Compile unit tests with Check framework. The tests can be executed with make test
  94. **UA_BUILD_EXAMPLES**
  95. Compile specific examples from https://github.com/acplt/open62541/blob/master/examples/
  96. **UA_BUILD_SELFIGNED_CERTIFICATE**
  97. Generate a self-signed certificate for the server (openSSL required)
  98. UA_ENABLE_* group
  99. ~~~~~~~~~~~~~~
  100. This group contains build options related to the supported OPC UA features.
  101. **UA_ENABLE_SUBSCRIPTIONS**
  102. Enable subscriptions
  103. **UA_ENABLE_METHODCALLS**
  104. Enable method calls in server and client
  105. **UA_ENABLE_NODEMANAGEMENT**
  106. Node management services (adding and removing nodes and references) at runtime in server and client
  107. **UA_ENABLE_AMALGAMATION**
  108. Compile a single-file release files open62541.c and open62541.h
  109. **UA_ENABLE_MULTITHREADING**
  110. Enable multi-threading support (experimental)
  111. **UA_ENABLE_COVERAGE**
  112. Measure the coverage of unit tests
  113. Some options are marked as advanced. The advanced options need to be toggled to
  114. be visible in the cmake GUIs.
  115. **UA_ENABLE_EXTERNAL_NAMESPACES**
  116. Enable external namespaces in server
  117. **UA_ENABLE_GENERATE_NAMESPACE0**
  118. Enable automatic generation of NS0
  119. **UA_ENABLE_GENERATE_NAMESPACE0_FILE**
  120. File for NS0 generation from namespace0 folder. Default value is Opc.Ua.NodeSet2.xml
  121. **UA_ENABLE_NONSTANDARD_STATELESS**
  122. Stateless service calls
  123. **UA_ENABLE_NONSTANDARD_UDP**
  124. UDP network layer