Преглед изворни кода

Merge pull request #2302 from open62541/cmake_install_amalgamation

Use separate header files instead of open62541.h amalgamation
Stefan Profanter пре 5 година
родитељ
комит
60fb4fc123
56 измењених фајлова са 456 додато и 248 уклоњено
  1. 44 36
      CMakeLists.txt
  2. 3 21
      appveyor.yml
  3. 1 0
      arch/posix/ua_architecture.h
  4. 4 4
      arch/ua_network_tcp.c
  5. 4 22
      doc/building.rst
  6. 75 0
      doc/installing.rst
  7. 1 0
      doc/toc.rst
  8. 30 1
      examples/CMakeLists.txt
  9. 3 1
      examples/access_control/client_access_control.c
  10. 5 1
      examples/access_control/server_access_control.c
  11. 4 1
      examples/client.c
  12. 4 13
      examples/client_async.c
  13. 5 1
      examples/client_connect_loop.c
  14. 4 1
      examples/client_connectivitycheck_loop.c
  15. 4 1
      examples/client_subscription_loop.c
  16. 7 1
      examples/common.h
  17. 2 1
      examples/custom_datatype/client_types_custom.c
  18. 4 1
      examples/custom_datatype/server_types_custom.c
  19. 3 1
      examples/discovery/client_find_servers.c
  20. 3 1
      examples/discovery/server_lds.c
  21. 7 2
      examples/discovery/server_multicast.c
  22. 3 1
      examples/discovery/server_register.c
  23. 7 1
      examples/encryption/client_basic128rsa15.c
  24. 7 1
      examples/encryption/client_basic256sha256.c
  25. 6 1
      examples/encryption/server_basic128rsa15.c
  26. 6 1
      examples/encryption/server_basic256sha256.c
  27. 4 1
      examples/nodeset/server_nodeset.c
  28. 4 3
      examples/nodeset/server_nodeset_plcopen.c
  29. 5 1
      examples/pubsub/tutorial_pubsub_connection.c
  30. 5 2
      examples/pubsub/tutorial_pubsub_publish.c
  31. 4 1
      examples/server_certificate.c
  32. 10 2
      examples/server_ctt.c
  33. 4 1
      examples/server_inheritance.c
  34. 4 1
      examples/server_instantiation.c
  35. 4 1
      examples/server_mainloop.c
  36. 4 1
      examples/server_repeated_job.c
  37. 5 1
      examples/tutorial_client_events.c
  38. 3 1
      examples/tutorial_client_firststeps.c
  39. 4 1
      examples/tutorial_datatypes.c
  40. 4 1
      examples/tutorial_server_datasource.c
  41. 4 1
      examples/tutorial_server_events.c
  42. 4 1
      examples/tutorial_server_firststeps.c
  43. 4 1
      examples/tutorial_server_method.c
  44. 5 1
      examples/tutorial_server_monitoreditems.c
  45. 4 1
      examples/tutorial_server_object.c
  46. 5 1
      examples/tutorial_server_variable.c
  47. 4 1
      examples/tutorial_server_variabletype.c
  48. 3 0
      include/ua_config.h.in
  49. 1 1
      plugins/ua_config_default.c
  50. 1 1
      src/server/ua_server_discovery_mdns.c
  51. 0 1
      tests/fuzz/CMakeLists.txt
  52. 42 62
      tools/appveyor/build.ps1
  53. 11 5
      tools/generate_datatypes.py
  54. 9 5
      tools/nodeset_compiler/backend_open62541.py
  55. 44 27
      tools/travis/travis_linux_script.sh
  56. 5 6
      tools/travis/travis_osx_script.sh

+ 44 - 36
CMakeLists.txt

@@ -742,29 +742,31 @@ add_custom_target(open62541-generator-statuscode DEPENDS
         ${PROJECT_BINARY_DIR}/src_generated/ua_statuscodes.h
         ${PROJECT_BINARY_DIR}/src_generated/ua_statuscodes.c)
 
-# single-file release
-add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/open62541.h
-                   PRE_BUILD
-                   COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py
-                           ${OPEN62541_VER_COMMIT} ${CMAKE_CURRENT_BINARY_DIR}/open62541.h
-                           ${exported_headers} ${default_plugin_headers} ${ua_architecture_headers}
-                   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py
-                           ${exported_headers} ${default_plugin_headers} ${ua_architecture_headers})
-
-add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/open62541.c
-                   PRE_BUILD
-                   COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py
-                           ${OPEN62541_VER_COMMIT} ${CMAKE_CURRENT_BINARY_DIR}/open62541.c
-                           ${internal_headers} ${lib_sources} ${default_plugin_sources} ${ua_architecture_sources}
-                   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py ${internal_headers}
-                           ${lib_sources} ${default_plugin_sources} ${ua_architecture_sources} )
-
-add_custom_target(open62541-amalgamation-source DEPENDS ${PROJECT_BINARY_DIR}/open62541.c)
-add_custom_target(open62541-amalgamation-header DEPENDS ${PROJECT_BINARY_DIR}/open62541.h)
-
-add_dependencies(open62541-amalgamation-header open62541-generator-types)
-add_dependencies(open62541-amalgamation-source open62541-generator-types
-                 open62541-generator-transport open62541-generator-statuscode)
+if (UA_ENABLE_AMALGAMATION)
+    # single-file release
+    add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/open62541.h
+                       PRE_BUILD
+                       COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py
+                               ${OPEN62541_VER_COMMIT} ${CMAKE_CURRENT_BINARY_DIR}/open62541.h
+                               ${exported_headers} ${default_plugin_headers} ${ua_architecture_headers}
+                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py
+                               ${exported_headers} ${default_plugin_headers} ${ua_architecture_headers})
+
+    add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/open62541.c
+                       PRE_BUILD
+                       COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py
+                               ${OPEN62541_VER_COMMIT} ${CMAKE_CURRENT_BINARY_DIR}/open62541.c
+                               ${internal_headers} ${lib_sources} ${default_plugin_sources} ${ua_architecture_sources}
+                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py ${internal_headers}
+                               ${lib_sources} ${default_plugin_sources} ${ua_architecture_sources} )
+
+    add_custom_target(open62541-amalgamation-source DEPENDS ${PROJECT_BINARY_DIR}/open62541.c)
+    add_custom_target(open62541-amalgamation-header DEPENDS ${PROJECT_BINARY_DIR}/open62541.h)
+
+    add_dependencies(open62541-amalgamation-header open62541-generator-types)
+    add_dependencies(open62541-amalgamation-source open62541-generator-types
+                     open62541-generator-transport open62541-generator-statuscode)
+endif()
 
 if(NOT UA_NODESET_ENCODE_BINARY_SIZE)
     set(UA_NODESET_ENCODE_BINARY_SIZE 32000)
@@ -779,9 +781,9 @@ ua_generate_nodeset(
     DEPENDS_TARGET "open62541-generator-types"
 )
 
-# stack protector needs to be disabled for the huge ns0 file, otherwise it may take many minutes to compile the file.
+# stack protector and optimization needs to be disabled for the huge ns0 file, otherwise it may take many minutes to compile the file.
 if(NOT MSVC)
-    set_source_files_properties(${PROJECT_BINARY_DIR}/src_generated/ua_namespace0.c PROPERTIES COMPILE_FLAGS -fno-stack-protector)
+    set_source_files_properties(${PROJECT_BINARY_DIR}/src_generated/ua_namespace0.c PROPERTIES COMPILE_FLAGS "-fno-stack-protector -O0")
 endif()
 
 #####################
@@ -813,14 +815,17 @@ if(UA_ENABLE_AMALGAMATION)
     if(UA_COMPILE_AS_CXX)
         set_source_files_properties(${PROJECT_BINARY_DIR}/open62541.c PROPERTIES LANGUAGE CXX)
     endif()
+
+    add_dependencies(open62541-amalgamation-source open62541-generator-namespace)
+    add_dependencies(open62541-amalgamation-header open62541-generator-namespace)
 else()
-    add_definitions(-DUA_NO_AMALGAMATION)
     add_library(open62541-object OBJECT ${lib_sources} ${internal_headers} ${exported_headers})
     add_dependencies(open62541-object
-                     open62541-amalgamation-header
                      open62541-generator-types
                      open62541-generator-transport
-                     open62541-generator-statuscode)
+                     open62541-generator-statuscode
+                     open62541-generator-namespace
+                     )
     target_include_directories(open62541-object PRIVATE ${PROJECT_SOURCE_DIR}/src)
 
     add_library(open62541-plugins OBJECT ${default_plugin_sources} ${ua_architecture_sources} ${exported_headers})
@@ -836,12 +841,7 @@ else()
         set_source_files_properties(${lib_sources} PROPERTIES LANGUAGE CXX)
         set_source_files_properties(${default_plugin_sources} ${ua_architecture_sources} PROPERTIES LANGUAGE CXX)
     endif()
-endif()
 
-add_dependencies(open62541-amalgamation-source open62541-generator-namespace)
-add_dependencies(open62541-amalgamation-header open62541-generator-namespace)
-if(NOT UA_ENABLE_AMALGAMATION)
-    add_dependencies(open62541-object open62541-generator-namespace)
 endif()
 
 # Export Symbols
@@ -883,6 +883,10 @@ target_link_libraries(open62541 ${open62541_LIBRARIES})
 add_subdirectory(doc)
 
 if(UA_BUILD_EXAMPLES)
+    if(UA_ENABLE_AMALGAMATION)
+        # Cannot compile tests with amalgamation. Not prepared for single header include
+        message(FATAL_ERROR "Examples cannot be built with source amalgamation enabled")
+    endif()
     add_subdirectory(examples)
 endif()
 
@@ -917,7 +921,6 @@ add_custom_target(lint ${CLANG_TIDY_PROGRAM}
                   -I${PROJECT_SOURCE_DIR}/src/server
                   -I${PROJECT_SOURCE_DIR}/src/client
                   -I${PROJECT_BINARY_DIR}/src_generated
-                  -DUA_NO_AMALGAMATION
                   DEPENDS ${lib_sources}
                   COMMENT "Run clang-tidy on the library")
 add_dependencies(lint open62541)
@@ -1005,6 +1008,9 @@ install(TARGETS open62541
         ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
         RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}
         INCLUDES DESTINATION include)
+# Our default way of installation is the non-amalgamated version.
+# See also https://github.com/open62541/open62541/pull/2292#discussion_r241106424
+install(CODE "MESSAGE(WARNING \"Installation with UA_ENABLE_AMALGAMATION=ON is not recommended.\")")
 endif()
 
 include(CMakePackageConfigHelpers)
@@ -1081,8 +1087,10 @@ set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "_CmakePredifinedTargets"
 set_target_properties(open62541 PROPERTIES FOLDER "open62541/lib")
 set_target_properties(open62541-object PROPERTIES FOLDER "open62541/lib")
 set_target_properties(lint PROPERTIES FOLDER "CodeAnalysis")
-set_target_properties(open62541-amalgamation-header PROPERTIES FOLDER "open62541/lib")
-set_target_properties(open62541-amalgamation-source PROPERTIES FOLDER "open62541/lib")
+if (UA_ENABLE_AMALGAMATION)
+    set_target_properties(open62541-amalgamation-header PROPERTIES FOLDER "open62541/lib")
+    set_target_properties(open62541-amalgamation-source PROPERTIES FOLDER "open62541/lib")
+endif()
 
 set_target_properties(open62541-generator-namespace PROPERTIES FOLDER "open62541/generators")
 set_target_properties(open62541-generator-statuscode PROPERTIES FOLDER "open62541/generators")

+ 3 - 21
appveyor.yml

@@ -7,8 +7,8 @@ clone_depth: 20
 skip_branch_with_pr: true
 
 # Fast finish (stop other builds if one fails) to speed up appveyor builds
-matrix:
-  fast_finish: true
+# matrix:
+#  fast_finish: true
 
 environment:
     global:
@@ -18,43 +18,24 @@ environment:
         - CC_NAME: MinGW Makefiles
           CC_SHORTNAME: mingw
           GENERATOR: MinGW Makefiles
-          # We need to redirect stderr to stdout otherwise powershell will fail if there is an output during amalgamation.
-          # Only use one thread, otherwise appveyor runs out of memory
-          MAKE: mingw32-make -j1 2>&1
           FORCE_CXX: OFF
-          OUT_DIR_LIB: bin
-          OUT_DIR_EXAMPLES: bin\examples
         - CC_NAME: Visual Studio 9 2008
           CC_SHORTNAME: vs2008
           GENERATOR: Visual Studio 9 2008
-          MAKE: msbuild /p:ContinueOnError=false /p:StopOnFirstFailure=true open62541.sln
           FORCE_CXX: ON
-          OUT_DIR_LIB: bin\Debug
-          OUT_DIR_EXAMPLES: bin\examples\Debug
         - CC_NAME: Visual Studio 12 2013
           CC_SHORTNAME: vs2013
           GENERATOR: Visual Studio 12 2013
-          MAKE: msbuild /p:ContinueOnError=false /p:StopOnFirstFailure=true open62541.sln
           FORCE_CXX: OFF
-          OUT_DIR_LIB: bin\Debug
-          OUT_DIR_EXAMPLES: bin\examples\Debug
         - CC_NAME: Visual Studio 15 2017
           CC_SHORTNAME: vs2017
           APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
           GENERATOR: Visual Studio 15 2017
-          MAKE: msbuild /p:ContinueOnError=false /p:StopOnFirstFailure=true open62541.sln
           FORCE_CXX: OFF
-          OUT_DIR_LIB: bin\Debug
-          OUT_DIR_EXAMPLES: bin\examples\Debug
         - CC_NAME: Clang
           CC_SHORTNAME: clang-mingw
           GENERATOR: MinGW Makefiles
-          # We need to redirect stderr to stdout otherwise powershell will fail if there is an output during amalgamation.
-          # Only use one thread, otherwise appveyor runs out of memory
-          MAKE: mingw32-make -j1 2>&1
           FORCE_CXX: OFF
-          OUT_DIR_LIB: bin
-          OUT_DIR_EXAMPLES: bin\examples
 
 cache:
   - C:\ProgramData\chocolatey\bin -> tools/appveyor/install.ps1
@@ -79,5 +60,6 @@ build_script:
 - ps: '& "./tools/appveyor/build.ps1"'
 
 after_build:
+  # Only push artifact if make install is defined
   - appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\open62541-%CC_SHORTNAME%-static.zip
   - appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\open62541-%CC_SHORTNAME%-dynamic.zip

+ 1 - 0
arch/posix/ua_architecture.h

@@ -34,6 +34,7 @@
 #include <sys/types.h>
 #include <net/if.h>
 #ifndef UA_sleep_ms
+# include <unistd.h>
 # define UA_sleep_ms(X) usleep(X * 1000)
 #endif
 

+ 4 - 4
arch/ua_network_tcp.c

@@ -91,7 +91,7 @@ connection_recv(UA_Connection *connection, UA_ByteString *response,
         UA_fd_set(connection->sockfd, &fdset);
         UA_UInt32 timeout_usec = timeout * 1000;
         struct timeval tmptv = {(long int)(timeout_usec / 1000000),
-                                (long int)(timeout_usec % 1000000)};
+                                (int)(timeout_usec % 1000000)};
         int resultsize = UA_select(connection->sockfd+1, &fdset, NULL,
                                 NULL, &tmptv);
 
@@ -681,7 +681,7 @@ UA_StatusCode UA_ClientConnectionTCP_poll(UA_Client *client, void *data) {
         UA_UInt32 timeout_usec = (tcpConnection->timeout - timeSinceStart)
                         * 1000;
         struct timeval tmptv = { (long int) (timeout_usec / 1000000),
-                        (long int) (timeout_usec % 1000000) };
+                        (int) (timeout_usec % 1000000) };
 
         int resultsize = UA_select((UA_Int32) (clientsockfd + 1), NULL, &fdset,
         NULL, &tmptv);
@@ -729,7 +729,7 @@ UA_StatusCode UA_ClientConnectionTCP_poll(UA_Client *client, void *data) {
     int sso_result = setsockopt(connection->sockfd, SOL_SOCKET,
                     SO_NOSIGPIPE, (void*)&val, sizeof(val));
     if(sso_result < 0)
-    UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK,
+    UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_NETWORK,
                     "Couldn't set SO_NOSIGPIPE");
 #endif
 
@@ -934,7 +934,7 @@ UA_ClientConnectionTCP(UA_ConnectionConfig config, const char *endpointUrl,
             UA_fd_set(clientsockfd, &fdset);
             UA_DateTime timeout_usec = (dtTimeout - timeSinceStart) / UA_DATETIME_USEC;
             struct timeval tmptv = {(long int) (timeout_usec / 1000000),
-                                    (long int) (timeout_usec % 1000000)};
+                                    (int) (timeout_usec % 1000000)};
 
             int resultsize = UA_select((UA_Int32)(clientsockfd + 1), NULL, &fdset, NULL, &tmptv);
 #endif

+ 4 - 22
doc/building.rst

@@ -119,6 +119,9 @@ The procedure below works on OpenBSD 5.8 with gcc version 4.8.4, cmake version 3
    cmake ..
    make
 
+
+.. _build_options:
+
 Build Options
 -------------
 
@@ -183,7 +186,7 @@ Detailed SDK Features
    Enable dynamic addition and removal of nodes at runtime
 
 **UA_ENABLE_AMALGAMATION**
-   Compile a single-file release into the files :file:`open62541.c` and :file:`open62541.h`
+   Compile a single-file release into the files :file:`open62541.c` and :file:`open62541.h`. Not receommended for installation.
 
 **UA_ENABLE_MULTITHREADING (EXPERIMENTAL)**
    Enable multi-threading support. Work is distributed to a number of worker threads.
@@ -286,24 +289,3 @@ The RAM requirements of a server are mostly due to the following settings:
 - The size of the information model
 - The number of connected clients
 - The configured maximum message size that is preallocated
-
-
-Installation and packaging
-^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-You can install open62541 using the well known `make install` command.
-This allows you to use pre-built libraries and headers for your own project.
-
-To override the default installation directory use ``cmake -DCMAKE_INSTALL_PREFIX=/some/path``.
-Based on the SDK Features you selected, as described above, these features will also
-be included in the installation. Thus we recommend to enable as many features as possible
-for the installed binary.
-
-In your own CMake project you can then include the open62541 library using:
-
-
-.. code-block:: cmake
-
-   find_package(open62541 0.4.0 REQUIRED COMPONENTS Events DiscoveryMulticast)
-   add_executable(main main.cpp )
-   target_link_libraries(main open62541)

+ 75 - 0
doc/installing.rst

@@ -0,0 +1,75 @@
+.. _installing:
+
+Installing open62541
+====================
+
+Manual installation
+-------------------
+
+You can install open62541 using the well known `make install` command.
+This allows you to use pre-built libraries and headers for your own project.
+
+To override the default installation directory use ``cmake -DCMAKE_INSTALL_PREFIX=/some/path``.
+Based on the SDK Features you selected, as described in :ref:`build_options`, these features will also
+be included in the installation. Thus we recommend to enable as many non-experimental features as possible
+for the installed binary.
+
+The recommended cmake options for a default installation are:
+
+.. code-block:: bash
+
+   git submodule update --init --recursive
+   mkdir build && cd build
+   cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_ENABLE_FULL_NS0=ON ..
+   make
+   sudo make install
+
+This will enable the following features in 0.3:
+
+ * Discovery
+ * FullNamespace
+ * Methods
+ * Subscriptions
+
+The following features are not enabled and can be optionally enabled using the build options as described in :ref:`build_options`:
+
+ * Amalgamation
+ * DiscoveryMulticast
+ * Encryption
+ * Multithreading
+ * Subscriptions
+
+.. important::
+   We strongly recommend to not use ``UA_ENABLE_AMALGAMATION=ON`` for your installation. This will only generate a single ``open62541.h`` header file instead of the single header files.
+   We encourage our users to use the non-amalgamated version to reduce the header size and simplify dependency management.
+
+
+In your own CMake project you can then include the open62541 library using:
+
+.. code-block:: cmake
+
+   find_package(open62541 0.3.0 REQUIRED COMPONENTS FullNamespace DiscoveryMulticast)
+   add_executable(main main.cpp)
+   target_link_libraries(main open62541)
+
+
+A full list of enabled features during build time is stored in the CMake Variable ``open62541_COMPONENTS_ALL``
+
+
+Prebuilt packages
+-----------------
+
+
+Prebuild binaries
+^^^^^^^^^^^^^^^^^
+
+You can always find prebuild binaries for every release on our `Github Release Page <https://github.com/open62541/open62541/releases>`_.
+
+
+Nightly single file releases for Linux and Windows of the last 50 commits can be found here: https://open62541.org/releases/
+
+
+OS Specific packages
+^^^^^^^^^^^^^^^^^^^^
+
+This is currently work in progress and we will provide prebuilt .deb packages soon.

+ 1 - 0
doc/toc.rst

@@ -5,6 +5,7 @@ open62541 Documentation
 
    index
    building
+   installing
    tutorials
    protocol
    types

+ 30 - 1
examples/CMakeLists.txt

@@ -9,17 +9,26 @@ set(examples_headers
     ${PROJECT_SOURCE_DIR}/examples/common.h
     )
 
+
+if(UA_ENABLE_AMALGAMATION)
+    add_definitions(-DUA_ENABLE_AMALGAMATION)
+endif()
+
 #############################
 # Compiled binaries folders #
 #############################
 
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/examples)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin/examples)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin/examples)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/bin/examples)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_BINARY_DIR}/bin/examples)
 
 macro(add_example EXAMPLE_NAME EXAMPLE_SOURCE)
   add_executable(${EXAMPLE_NAME} ${STATIC_OBJECTS} ${EXAMPLE_SOURCE} ${ARGN} ${examples_headers})
   target_link_libraries(${EXAMPLE_NAME} open62541 ${open62541_LIBRARIES})
   assign_source_group(${EXAMPLE_SOURCE})
-  add_dependencies(${EXAMPLE_NAME} open62541-amalgamation-header open62541-amalgamation-source)
+  add_dependencies(${EXAMPLE_NAME} open62541-object)
   set_target_properties(${EXAMPLE_NAME} PROPERTIES FOLDER "open62541/examples")
   set_target_properties(${EXAMPLE_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
   if(UA_COMPILE_AS_CXX)
@@ -65,12 +74,32 @@ endif()
 
 add_example(server_ctt server_ctt.c)
 
+if (WIN32)
+    install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/server_ctt.exe
+            DESTINATION bin
+            RENAME ua_server_ctt.exe)
+else()
+    install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/server_ctt
+            DESTINATION bin
+            RENAME ua_server_ctt)
+endif()
+
 ##################
 # Example Client #
 ##################
 
 add_example(client client.c)
 
+if (WIN32)
+    install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/client.exe
+            DESTINATION bin
+            RENAME ua_client.exe)
+else()
+    install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/client
+            DESTINATION bin
+            RENAME ua_client)
+endif()
+
 add_example(client_async client_async.c)
 
 add_example(client_connect_loop client_connect_loop.c)

+ 3 - 1
examples/access_control/client_access_control.c

@@ -5,7 +5,9 @@
  * Using access_control_server
  */
 
-#include "open62541.h"
+#include <ua_client.h>
+#include <ua_config_default.h>
+#include <ua_client_highlevel.h>
 
 int main(void) {
     UA_Client *client = UA_Client_new(UA_ClientConfig_default);

+ 5 - 1
examples/access_control/server_access_control.c

@@ -1,7 +1,11 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_plugin_access_control.h>
+#include <ua_log_stdout.h>
+
 #include <signal.h>
 
 static UA_Boolean

+ 4 - 1
examples/client.c

@@ -1,7 +1,10 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+#include <ua_client_subscriptions.h>
+#include <ua_client_highlevel.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
 
 #ifdef UA_ENABLE_SUBSCRIPTIONS
 static void

+ 4 - 13
examples/client_async.c

@@ -1,19 +1,10 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#ifndef _XOPEN_SOURCE
-# define _XOPEN_SOURCE 600
-#endif
-#ifndef _DEFAULT_SOURCE
-# define _DEFAULT_SOURCE
-#endif
-/* On older systems we need to define _BSD_SOURCE.
- * _DEFAULT_SOURCE is an alias for that. */
-#ifndef _BSD_SOURCE
-# define _BSD_SOURCE
-#endif
-
-#include "open62541.h"
+#include <ua_config_default.h>
+#include <ua_client_subscriptions.h>
+#include <ua_log_stdout.h>
+#include <ua_client_highlevel_async.h>
 
 #define NODES_EXIST
 /* async connection callback, it only gets called after the completion of the whole

+ 5 - 1
examples/client_connect_loop.c

@@ -10,7 +10,11 @@
  *
  * This example is very similar to the tutorial_client_firststeps.c. */
 
-#include "open62541.h"
+
+#include <ua_client_highlevel.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+
 #include <signal.h>
 
 UA_Boolean running = true;

+ 4 - 1
examples/client_connectivitycheck_loop.c

@@ -1,7 +1,10 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+#include <ua_client.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+
 #include <signal.h>
 
 UA_Boolean running = true;

+ 4 - 1
examples/client_subscription_loop.c

@@ -10,7 +10,10 @@
  *
  * This example is very similar to the tutorial_client_firststeps.c. */
 
-#include "open62541.h"
+#include <ua_config_default.h>
+#include <ua_client_subscriptions.h>
+#include <ua_log_stdout.h>
+
 #include <signal.h>
 
 UA_Boolean running = true;

+ 7 - 1
examples/common.h

@@ -1,7 +1,13 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+
+#ifdef UA_ENABLE_AMALGAMATION
+# include <open62541.h>
+#else
+# include "ua_types.h"
+# include "ua_types_generated_handling.h"
+#endif
 
 /* loadFile parses the certificate file.
  *

+ 2 - 1
examples/custom_datatype/client_types_custom.c

@@ -1,7 +1,8 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+#include <ua_client_highlevel.h>
+#include <ua_config_default.h>
 #include "custom_datatype.h"
 
 int main(void) {

+ 4 - 1
examples/custom_datatype/server_types_custom.c

@@ -1,8 +1,11 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_log_stdout.h>
+#include <ua_config_default.h>
 #include "custom_datatype.h"
+
 #include <signal.h>
 
 UA_Boolean running = true;

+ 3 - 1
examples/discovery/client_find_servers.c

@@ -5,7 +5,9 @@
  * and then calls GetEndpoints on the returned list of servers.
  */
 
-#include "open62541.h"
+#include <ua_client.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
 
 #define DISCOVERY_SERVER_ENDPOINT "opc.tcp://localhost:4840"
 

+ 3 - 1
examples/discovery/server_lds.c

@@ -6,7 +6,9 @@
  * find servers service to get all registered servers (see client_find_servers.c).
  */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+
 #include <signal.h>
 
 UA_Boolean running = true;

+ 7 - 2
examples/discovery/server_multicast.c

@@ -7,7 +7,12 @@
  * (i.e., LDS-ME).
  */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_types.h>
+#include <ua_log_stdout.h>
+#include <ua_securitypolicies.h>
+
 #include <signal.h>
 
 UA_Boolean running = true;
@@ -111,7 +116,7 @@ UA_EndpointDescription *getRegisterEndpointFromServer(const char *discoveryServe
         return NULL;
     }
 
-    UA_LOG_DEBUG(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "Server has %zu endpoints", endpointArraySize);
+    UA_LOG_DEBUG(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "Server has %lu endpoints", (unsigned long)endpointArraySize);
     UA_EndpointDescription *foundEndpoint = NULL;
     for (size_t i = 0; i < endpointArraySize; i++) {
         UA_LOG_DEBUG(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "\tURL = %.*s, SecurityMode = %s",

+ 3 - 1
examples/discovery/server_register.c

@@ -5,8 +5,10 @@
  * Before shutdown it has to unregister itself.
  */
 
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
 
-#include "open62541.h"
 #include <signal.h>
 
 #define DISCOVERY_SERVER_ENDPOINT "opc.tcp://localhost:4840"

+ 7 - 1
examples/encryption/client_basic128rsa15.c

@@ -1,9 +1,15 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+#include <ua_securitypolicies.h>
+#include <ua_client_highlevel.h>
 #include "common.h"
 
+#include <signal.h>
+
 #define MIN_ARGS           3
 #define FAILURE            1
 #define CONNECTION_STRING  "opc.tcp://localhost:4840"

+ 7 - 1
examples/encryption/client_basic256sha256.c

@@ -1,9 +1,15 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+#include <ua_securitypolicies.h>
+#include <ua_client_highlevel.h>
 #include "common.h"
 
+#include <signal.h>
+
 #define MIN_ARGS           3
 #define FAILURE            1
 #define CONNECTION_STRING  "opc.tcp://localhost:4840"

+ 6 - 1
examples/encryption/server_basic128rsa15.c

@@ -1,8 +1,13 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+#include <ua_securitypolicies.h>
+#include <ua_client_highlevel.h>
 #include "common.h"
+
 #include <signal.h>
 
 UA_Boolean running = true;

+ 6 - 1
examples/encryption/server_basic256sha256.c

@@ -1,8 +1,13 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+#include <ua_securitypolicies.h>
+#include <ua_client_highlevel.h>
 #include "common.h"
+
 #include <signal.h>
 
 UA_Boolean running = true;

+ 4 - 1
examples/nodeset/server_nodeset.c

@@ -1,7 +1,10 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+
 #include <signal.h>
 
 /* Files example_namespace.h and example_namespace.c are created from server_nodeset.xml in the

+ 4 - 3
examples/nodeset/server_nodeset_plcopen.c

@@ -1,13 +1,14 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#ifdef UA_NO_AMALGAMATION
+#ifdef UA_ENABLE_AMALGAMATION
+#include "open62541.h"
+#else
 #include "ua_server.h"
 #include "ua_log_stdout.h"
 #include "ua_config_default.h"
-#else
-#include "open62541.h"
 #endif
+
 #include <signal.h>
 
 /* Files example_namespace.h and example_namespace.c are created from server_nodeset.xml in the

+ 5 - 1
examples/pubsub/tutorial_pubsub_connection.c

@@ -2,7 +2,11 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+#include <ua_network_pubsub_udp.h>
+
 #include <signal.h>
 
 UA_Boolean running = true;

+ 5 - 2
examples/pubsub/tutorial_pubsub_publish.c

@@ -24,9 +24,12 @@
  * ``tutorial_pubsub_connection.c``.
  */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+#include <ua_network_pubsub_udp.h>
+
 #include <signal.h>
-#include <stdio.h>
 
 UA_NodeId connectionIdent, publishedDataSetIdent, writerGroupIdent;
 

+ 4 - 1
examples/server_certificate.c

@@ -5,7 +5,10 @@
 #define _CRT_SECURE_NO_WARNINGS //disable fopen deprication warning in msvs
 #endif
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+
 #include "common.h"
 #include <signal.h>
 

+ 10 - 2
examples/server_ctt.c

@@ -5,8 +5,16 @@
 #define _CRT_SECURE_NO_WARNINGS /* disable fopen deprication warning in msvs */
 #endif
 
-#include "open62541.h"
-#include "common.h"
+#ifdef UA_ENABLE_AMALGAMATION
+# include <open62541.h>
+#else
+# include <ua_server.h>
+# include <ua_config_default.h>
+# include <ua_log_stdout.h>
+#endif
+
+# include "common.h"
+
 #include <signal.h>
 
 /* This server is configured to the Compliance Testing Tools (CTT) against. The

+ 4 - 1
examples/server_inheritance.c

@@ -1,7 +1,10 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+
 #include <signal.h>
 
 UA_Boolean running = true;

+ 4 - 1
examples/server_instantiation.c

@@ -1,7 +1,10 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+
 #include <signal.h>
 
 UA_Boolean running = true;

+ 4 - 1
examples/server_mainloop.c

@@ -3,7 +3,10 @@
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information.
  */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+
 #include <signal.h>
 
 UA_Boolean running = true;

+ 4 - 1
examples/server_repeated_job.c

@@ -1,7 +1,10 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+
 #include <signal.h>
 
 static void

+ 5 - 1
examples/tutorial_client_events.c

@@ -1,7 +1,11 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+#include <ua_client_highlevel.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+#include <ua_client_subscriptions.h>
+
 #include <signal.h>
 
 #ifdef _MSC_VER

+ 3 - 1
examples/tutorial_client_firststeps.c

@@ -8,7 +8,9 @@
  * provides both a server- and clientside API, so creating a client is as easy as
  * creating a server. Copy the following into a file `myClient.c`: */
 
-#include "open62541.h"
+#include <ua_client_highlevel.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
 
 int main(void) {
     UA_Client *client = UA_Client_new(UA_ClientConfig_default);

+ 4 - 1
examples/tutorial_datatypes.c

@@ -16,7 +16,10 @@
  * This section shows the basic interaction patterns for data types. Make
  * sure to compare with the type definitions in ``ua_types.h``. */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+
 
 static void
 variables_basic(void) {

+ 4 - 1
examples/tutorial_server_datasource.c

@@ -25,7 +25,10 @@
  * new value arrives from the underlying process, we can just write into the
  * variable. */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+
 #include <signal.h>
 
 static void

+ 4 - 1
examples/tutorial_server_events.c

@@ -1,7 +1,10 @@
 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+
 #include <signal.h>
 
 /**

+ 4 - 1
examples/tutorial_server_firststeps.c

@@ -20,7 +20,10 @@
  * you have the ``open62541.c/.h`` files in the current folder. Now create a new
  * C source-file called ``myServer.c`` with the following content: */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+
 #include <signal.h>
 
 UA_Boolean running = true;

+ 4 - 1
examples/tutorial_server_method.c

@@ -30,7 +30,10 @@
  * prepended. The type and length of the input arguments is checked internally
  * by the SDK, so that we don't have to verify the arguments in the callback. */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+
 #include <signal.h>
 
 static UA_StatusCode

+ 5 - 1
examples/tutorial_server_monitoreditems.c

@@ -19,7 +19,11 @@
  * context pointer.
  */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+#include <ua_client_subscriptions.h>
+
 #include <signal.h>
 
 static void

+ 4 - 1
examples/tutorial_server_object.c

@@ -55,7 +55,10 @@
  * setting constraints on the variable values as this is not the focus of this
  * tutorial and was already covered. */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+
 #include <signal.h>
 
 static void

+ 5 - 1
examples/tutorial_server_variable.c

@@ -14,9 +14,13 @@
  * read only. See below for making the variable writable.
  */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+
 #include <signal.h>
 
+
 static void
 addVariable(UA_Server *server) {
     /* Define the attribute of the myInteger variable node */

+ 4 - 1
examples/tutorial_server_variabletype.c

@@ -18,7 +18,10 @@
  * VariableTypeNode to the hierarchy of variable types.
  */
 
-#include "open62541.h"
+#include <ua_server.h>
+#include <ua_config_default.h>
+#include <ua_log_stdout.h>
+
 #include <signal.h>
 
 static UA_NodeId pointTypeId;

+ 3 - 0
include/ua_config.h.in

@@ -20,6 +20,9 @@
  * Changing the feature options has no effect on a pre-compiled library. */
 
 #define UA_LOGLEVEL ${UA_LOGLEVEL}
+#ifndef UA_ENABLE_AMALGAMATION
+#cmakedefine UA_ENABLE_AMALGAMATION
+#endif
 #cmakedefine UA_ENABLE_METHODCALLS
 #cmakedefine UA_ENABLE_NODEMANAGEMENT
 #cmakedefine UA_ENABLE_SUBSCRIPTIONS

+ 1 - 1
plugins/ua_config_default.c

@@ -10,7 +10,6 @@
  *    Copyright 2018 (c) Fabian Arndt, Root-Core
  */
 
-#include "ua_plugin_securitypolicy.h"
 #include "ua_config_default.h"
 #include "ua_client_config.h"
 #include "ua_log_stdout.h"
@@ -19,6 +18,7 @@
 #include "ua_pki_certificate.h"
 #include "ua_nodestore_default.h"
 #include "ua_securitypolicies.h"
+#include "ua_plugin_securitypolicy.h"
 
 /* Struct initialization works across ANSI C/C99/C++ if it is done when the
  * variable is first declared. Assigning values to existing structs is

+ 1 - 1
src/server/ua_server_discovery_mdns.c

@@ -11,7 +11,7 @@
 
 #ifdef UA_ENABLE_DISCOVERY_MULTICAST
 
-#ifdef UA_NO_AMALGAMATION
+#ifndef UA_ENABLE_AMALGAMATION
 #include "mdnsd/libmdnsd/xht.h"
 #include "mdnsd/libmdnsd/sdtxt.h"
 #endif

+ 0 - 1
tests/fuzz/CMakeLists.txt

@@ -19,7 +19,6 @@ if (UA_BUILD_FUZZING_CORPUS)
     add_executable(corpus_generator ua_debug_dump_pkgs_file.c corpus_generator.c)
     target_link_libraries(corpus_generator open62541 ${open62541_LIBRARIES})
     assign_source_group(corpus_generator)
-    add_dependencies(corpus_generator open62541-amalgamation-header)
     set_target_properties(corpus_generator PROPERTIES FOLDER "open62541/corpus_generator")
     set_target_properties(corpus_generator PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
     return()

+ 42 - 62
tools/appveyor/build.ps1

@@ -28,8 +28,6 @@ try {
         New-Item -Force -ItemType directory -Path "C:\Tools\vcpkg\installed\x86-windows-static"
     }
 
-    $make_cmd = "& $env:MAKE"
-
     # Collect files for .zip packing
     New-Item -ItemType directory -Path pack
     Copy-Item LICENSE pack
@@ -37,12 +35,13 @@ try {
     Copy-Item README.md pack
 
     Write-Host -ForegroundColor Green "`n###################################################################"
-    Write-Host -ForegroundColor Green "`n##### Testing $env:CC_NAME #####`n"
+    Write-Host -ForegroundColor Green "`n##### Testing $env:CC_NAME with amalgamation #####`n"
     New-Item -ItemType directory -Path "build"
     cd build
-    & cmake  $vcpkg_toolchain $vcpkg_triplet -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_COMPILE_AS_CXX:BOOL=$env:FORCE_CXX `
-        -DUA_ENABLE_ENCRYPTION:BOOL=$build_encryption -G"$env:GENERATOR" ..
-    Invoke-Expression $make_cmd
+    & cmake  $vcpkg_toolchain $vcpkg_triplet -DUA_BUILD_EXAMPLES:BOOL=OFF -DUA_ENABLE_AMALGAMATION:BOOL=ON `
+        -DUA_COMPILE_AS_CXX:BOOL=$env:FORCE_CXX `
+        -DUA_ENABLE_ENCRYPTION:BOOL=$build_encryption -DCMAKE_BUILD_TYPE=RelWithDebInfo -G"$env:GENERATOR" ..
+    & cmake --build . --config RelWithDebInfo
     if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
         Write-Host -ForegroundColor Red "`n`n*** Make failed. Exiting ... ***"
         exit $LASTEXITCODE
@@ -54,8 +53,10 @@ try {
     Write-Host -ForegroundColor Green "`n##### Testing $env:CC_NAME with full NS0 #####`n"
     New-Item -ItemType directory -Path "build"
     cd build
-    & cmake -DUA_ENABLE_SUBSCRIPTIONS_EVENTS:BOOL=ON -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_NAMESPACE_ZERO:STRING=FULL -DUA_COMPILE_AS_CXX:BOOL=$env:FORCE_CXX -G"$env:GENERATOR"  ..
-    Invoke-Expression $make_cmd
+    & cmake -DUA_ENABLE_SUBSCRIPTIONS_EVENTS:BOOL=ON -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_NAMESPACE_ZERO:STRING=FULL `
+            -DUA_ENABLE_PUBSUB:BOOL=ON -DUA_ENABLE_PUBSUB_INFORMATIONMODEL:BOOL=ON -DUA_ENABLE_PUBSUB_DELTAFRAMES:BOOL=ON `
+            -DUA_COMPILE_AS_CXX:BOOL=$env:FORCE_CXX -DCMAKE_BUILD_TYPE=RelWithDebInfo -G"$env:GENERATOR"  ..
+    & cmake --build . --config RelWithDebInfo
     if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
         Write-Host -ForegroundColor Red "`n`n*** Make failed. Exiting ... ***"
         exit $LASTEXITCODE
@@ -64,71 +65,49 @@ try {
     Remove-Item -Path build -Recurse -Force
 
     Write-Host -ForegroundColor Green "`n###################################################################"
-    Write-Host -ForegroundColor Green "`n##### Testing $env:CC_NAME with PubSub #####`n"
+    Write-Host -ForegroundColor Green "`n##### Testing $env:CC_NAME without amalgamation #####`n"
     New-Item -ItemType directory -Path "build"
     cd build
-    & cmake -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_ENABLE_PUBSUB:BOOL=ON -DUA_ENABLE_PUBSUB_INFORMATIONMODEL:BOOL=ON `
-    -DUA_ENABLE_PUBSUB_DELTAFRAMES:BOOL=ON  -DUA_COMPILE_AS_CXX:BOOL=$env:FORCE_CXX -G"$env:GENERATOR"  ..
-    Invoke-Expression $make_cmd
-    if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
-        Write-Host -ForegroundColor Red "`n`n*** Make failed. Exiting ... ***"
+    & cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_ENABLE_AMALGAMATION:BOOL=OFF `
+            -DUA_COMPILE_AS_CXX:BOOL=$env:FORCE_CXX -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo `
+            -G"$env:GENERATOR" `
+            -DCMAKE_INSTALL_PREFIX="$env:APPVEYOR_BUILD_FOLDER-$env:CC_SHORTNAME-static" ..
+    & cmake --build . --target install --config RelWithDebInfo
+    if ($LASTEXITCODE -and $LASTEXITCODE -ne 0)
+    {
+        Write-Host -ForegroundColor Red "`n`n*** Make install failed. Exiting ... ***"
         exit $LASTEXITCODE
     }
     cd ..
-    Remove-Item -Path build -Recurse -Force
-
-    Write-Host -ForegroundColor Green "`n###################################################################"
-    Write-Host -ForegroundColor Green "`n##### Testing $env:CC_NAME with amalgamation #####`n"
-    New-Item -ItemType directory -Path "build"
-    cd build
-    & cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_ENABLE_AMALGAMATION:BOOL=ON `
-     -DUA_COMPILE_AS_CXX:BOOL=$env:FORCE_CXX -DBUILD_SHARED_LIBS:BOOL=OFF -G"$env:GENERATOR" ..
-    Invoke-Expression $make_cmd
-    if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
-        Write-Host -ForegroundColor Red "`n`n*** Make failed. Exiting ... ***"
+    & 7z a -tzip open62541-$env:CC_SHORTNAME-static.zip "$env:APPVEYOR_BUILD_FOLDER\pack\*" "$env:APPVEYOR_BUILD_FOLDER-$env:CC_SHORTNAME-static\*"
+    if ($LASTEXITCODE -and $LASTEXITCODE -ne 0)
+    {
+        Write-Host -ForegroundColor Red "`n`n*** Zipping failed. Exiting ... ***"
         exit $LASTEXITCODE
     }
-    cd ..
-    New-Item -ItemType directory -Path pack_tmp
-    Move-Item -Path "build\open62541.c" -Destination pack_tmp\
-    Move-Item -Path "build\open62541.h" -Destination pack_tmp\
-    Move-Item -Path "build\$env:OUT_DIR_EXAMPLES\server_ctt.exe" -Destination pack_tmp\
-    Move-Item -Path "build\$env:OUT_DIR_EXAMPLES\client.exe" -Destination pack_tmp\
-    if ($env:CC_SHORTNAME -eq "mingw" -or $env:CC_SHORTNAME -eq "clang-mingw") {
-        Move-Item -Path "build\$env:OUT_DIR_LIB\libopen62541.a" -Destination pack_tmp\
-    } else {
-        Move-Item -Path "build\$env:OUT_DIR_LIB\open62541.lib" -Destination pack_tmp\
-    }
-    & 7z a -tzip open62541-$env:CC_SHORTNAME-static.zip "$env:APPVEYOR_BUILD_FOLDER\pack\*" "$env:APPVEYOR_BUILD_FOLDER\pack_tmp\*"
-    Remove-Item -Path pack_tmp -Recurse -Force
     Remove-Item -Path build -Recurse -Force
 
     Write-Host -ForegroundColor Green "`n###################################################################"
-    Write-Host -ForegroundColor Green "`n##### Testing $env:CC_NAME with amalgamation and .dll #####`n"
+    Write-Host -ForegroundColor Green "`n##### Testing $env:CC_NAME (.dll) #####`n"
     New-Item -ItemType directory -Path "build"
     cd build
-    & cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_ENABLE_AMALGAMATION:BOOL=ON `
-        -DUA_COMPILE_AS_CXX:BOOL=$env:FORCE_CXX -DBUILD_SHARED_LIBS:BOOL=ON -G"$env:GENERATOR" ..
-    Invoke-Expression $make_cmd
-    if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
-        Write-Host -ForegroundColor Red "`n`n*** Make failed. Exiting ... ***"
+    & cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_ENABLE_AMALGAMATION:BOOL=OFF `
+        -DUA_COMPILE_AS_CXX:BOOL=$env:FORCE_CXX -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo `
+        -G"$env:GENERATOR" `
+        -DCMAKE_INSTALL_PREFIX="$env:APPVEYOR_BUILD_FOLDER-$env:CC_SHORTNAME-dynamic" ..
+    & cmake --build . --target install --config RelWithDebInfo
+    if ($LASTEXITCODE -and $LASTEXITCODE -ne 0)
+    {
+        Write-Host -ForegroundColor Red "`n`n*** Make install failed. Exiting ... ***"
         exit $LASTEXITCODE
     }
     cd ..
-    New-Item -ItemType directory -Path pack_tmp
-    Move-Item -Path "build\open62541.c" -Destination pack_tmp\
-    Move-Item -Path "build\open62541.h" -Destination pack_tmp\
-    Move-Item -Path "build\$env:OUT_DIR_EXAMPLES\server_ctt.exe" -Destination pack_tmp\
-    Move-Item -Path "build\$env:OUT_DIR_EXAMPLES\client.exe" -Destination pack_tmp\
-    if ($env:CC_SHORTNAME -eq "mingw" -or $env:CC_SHORTNAME -eq "clang-mingw") {
-        Move-Item -Path "build\$env:OUT_DIR_LIB\libopen62541.dll" -Destination pack_tmp\
-        Move-Item -Path "build\$env:OUT_DIR_LIB\libopen62541.dll.a" -Destination pack_tmp\
-    } else {
-        Move-Item -Path "build\$env:OUT_DIR_LIB\open62541.dll" -Destination pack_tmp\
-        Move-Item -Path "build\$env:OUT_DIR_LIB\open62541.pdb" -Destination pack_tmp\
+    & 7z a -tzip open62541-$env:CC_SHORTNAME-dynamic.zip "$env:APPVEYOR_BUILD_FOLDER\pack\*" "$env:APPVEYOR_BUILD_FOLDER-$env:CC_SHORTNAME-static\*"
+    if ($LASTEXITCODE -and $LASTEXITCODE -ne 0)
+    {
+        Write-Host -ForegroundColor Red "`n`n*** Zipping failed. Exiting ... ***"
+        exit $LASTEXITCODE
     }
-    & 7z a -tzip open62541-$env:CC_SHORTNAME-dynamic.zip "$env:APPVEYOR_BUILD_FOLDER\pack\*" "$env:APPVEYOR_BUILD_FOLDER\pack_tmp\*"
-    Remove-Item -Path pack_tmp -Recurse -Force
     Remove-Item -Path build -Recurse -Force
 
     # Only execute unit tests on vs2017 to save compilation time
@@ -137,11 +116,12 @@ try {
         Write-Host -ForegroundColor Green "`n##### Testing $env:CC_NAME with unit tests #####`n"
         New-Item -ItemType directory -Path "build"
         cd build
-        & cmake $vcpkg_toolchain $vcpkg_triplet -DCMAKE_BUILD_TYPE=Debug -DUA_BUILD_EXAMPLES=OFF -DUA_ENABLE_DISCOVERY=ON `
-            -DUA_ENABLE_DISCOVERY_MULTICAST=ON -DUA_ENABLE_ENCRYPTION:BOOL=$build_encryption -DUA_BUILD_UNIT_TESTS=ON `
-             -DUA_ENABLE_PUBSUB:BOOL=ON -DUA_ENABLE_PUBSUB_INFORMATIONMODEL:BOOL=ON -DUA_ENABLE_PUBSUB_DELTAFRAMES:BOOL=ON `
-            -DUA_ENABLE_UNIT_TESTS_MEMCHECK=ON -DCHECK_PREFIX=c:\check -DUA_COMPILE_AS_CXX:BOOL=$env:FORCE_CXX -G"$env:CC_NAME" ..
-        Invoke-Expression $make_cmd
+        & cmake $vcpkg_toolchain $vcpkg_triplet -DUA_BUILD_EXAMPLES=OFF -DUA_ENABLE_DISCOVERY=ON `
+               -DUA_ENABLE_DISCOVERY_MULTICAST=ON -DUA_ENABLE_ENCRYPTION:BOOL=$build_encryption -DUA_BUILD_UNIT_TESTS=ON `
+               -DUA_ENABLE_PUBSUB:BOOL=ON -DUA_ENABLE_PUBSUB_INFORMATIONMODEL:BOOL=ON -DUA_ENABLE_PUBSUB_DELTAFRAMES:BOOL=ON `
+               -DUA_ENABLE_UNIT_TESTS_MEMCHECK=ON -DCHECK_PREFIX=c:\check -DUA_COMPILE_AS_CXX:BOOL=$env:FORCE_CXX `
+               -DCMAKE_BUILD_TYPE=Debug -G"$env:CC_NAME" ..
+        & cmake --build . --config Debug
         if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
             Write-Host -ForegroundColor Red "`n`n*** Make failed. Exiting ... ***"
             exit $LASTEXITCODE

+ 11 - 5
tools/generate_datatypes.py

@@ -540,11 +540,11 @@ printh('''/* Generated from ''' + inname + ''' with script ''' + sys.argv[0] + '
 #ifndef ''' + outname.upper() + '''_GENERATED_H_
 #define ''' + outname.upper() + '''_GENERATED_H_
 
-#ifdef UA_NO_AMALGAMATION
+#ifdef UA_ENABLE_AMALGAMATION
+#include "open62541.h"
+#else
 #include "ua_types.h"
 ''' + ('#include "ua_types_generated.h"\n' if outname != "ua_types" else '') + '''
-#else
-#include "open62541.h"
 #endif
 
 _UA_BEGIN_DECLS
@@ -644,8 +644,14 @@ printe('''/* Generated from ''' + inname + ''' with script ''' + sys.argv[0] + '
  * on host ''' + platform.uname()[1] + ''' by user ''' + getpass.getuser() + \
        ''' at ''' + time.strftime("%Y-%m-%d %I:%M:%S") + ''' */
 
-#include "ua_types_encoding_binary.h"
-#include "''' + outname + '''_generated.h"''')
+#ifdef UA_ENABLE_AMALGAMATION
+# include "open62541.h"
+#else
+# include "ua_types_encoding_binary.h"
+# include "''' + outname + '''_generated.h"
+#endif
+
+''')
 
 for t in filtered_types:
     printe("\n/* " + t.name + " */")

+ 9 - 5
tools/nodeset_compiler/backend_open62541.py

@@ -158,10 +158,7 @@ def generateOpen62541Code(nodeset, outfilename, generate_ns0=False, internal_hea
 """ % (outfilebase.upper(), outfilebase.upper()))
     if internal_headers:
         writeh("""
-#ifdef UA_NO_AMALGAMATION
-# include "ua_server.h"
-# include "ua_types_encoding_binary.h"
-#else
+#ifdef UA_ENABLE_AMALGAMATION
 # include "open62541.h"
 
 /* The following declarations are in the open62541.c file so here's needed when compiling nodesets externally */
@@ -190,13 +187,20 @@ UA_findDataTypeByBinary(const UA_NodeId *typeId);
 
 # endif // UA_Nodestore_remove
 
+#else // UA_ENABLE_AMALGAMATION
+# include "ua_server.h"
+# include "ua_types_encoding_binary.h"
 #endif
 
 %s
 """ % (additionalHeaders))
     else:
         writeh("""
-#include "open62541.h"
+#ifdef UA_ENABLE_AMALGAMATION
+# include "open62541.h"
+#else
+# include "ua_server.h"
+#endif
 """)
     writeh("""
 _UA_BEGIN_DECLS

+ 44 - 27
tools/travis/travis_linux_script.sh

@@ -77,7 +77,7 @@ if [ $ANALYZE = "true" ]; then
 
         mkdir -p build
         cd build
-        scan-build-6.0 cmake -DUA_ENABLE_AMALGAMATION=ON ..
+        scan-build-6.0 cmake -DUA_ENABLE_AMALGAMATION=OFF ..
         scan-build-6.0 -enable-checker security.FloatLoopCounter \
           -enable-checker security.insecureAPI.UncheckedReturn \
           --status-bugs -v \
@@ -130,64 +130,73 @@ else
     if ! [ -z ${MINGW+x} ]; then
         echo -e "\r\n== Cross compile release build for MinGW 32 bit =="  && echo -en 'travis_fold:start:script.build.cross_mingw32\\r'
         mkdir -p build && cd build
-        cmake -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-mingw32.cmake -DUA_ENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DUA_BUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=ON ..
+        cmake -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-win32 -DUA_ENABLE_AMALGAMATION=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_BUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=ON ..
         make -j
         if [ $? -ne 0 ] ; then exit 1 ; fi
-        cp ../LICENSE ../AUTHORS ../README.md .
-        zip -r open62541-win32.zip ../../doc_latex/open62541.pdf LICENSE AUTHORS README.md ./bin/examples/server_ctt.exe ./bin/examples/client.exe ./bin/libopen62541.* open62541.h open62541.c
-        cp open62541-win32.zip ..
-        cd .. && rm build -rf
+        make install
+        if [ $? -ne 0 ] ; then exit 1 ; fi
+        cd ..
+        zip -r open62541-win32.zip ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-win32/*
+        rm build -rf
         echo -en 'travis_fold:end:script.build.cross_mingw32\\r'
 
         echo -e "\r\n== Cross compile release build for MinGW 64 bit =="  && echo -en 'travis_fold:start:script.build.cross_mingw64\\r'
         mkdir -p build && cd build
-        cmake -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-mingw64.cmake -DUA_ENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DUA_BUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=ON ..
+        cmake -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-mingw64.cmake -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-win64 -DUA_ENABLE_AMALGAMATION=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_BUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=ON ..
         make -j
         if [ $? -ne 0 ] ; then exit 1 ; fi
-        cp ../LICENSE ../AUTHORS ../README.md .
-        zip -r open62541-win64.zip ../../doc_latex/open62541.pdf LICENSE AUTHORS README.md ./bin/examples/server_ctt.exe ./bin/examples/client.exe ./bin/libopen62541.* open62541.h open62541.c
-        cp open62541-win64.zip ..
-        cd .. && rm build -rf
+        make install
+        if [ $? -ne 0 ] ; then exit 1 ; fi
+        cd ..
+        zip -r open62541-win64.zip ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-win64/*
+        rm build -rf
         echo -en 'travis_fold:end:script.build.cross_mingw64\\r'
 
         echo -e "\r\n== Cross compile release build for 32-bit linux =="  && echo -en 'travis_fold:start:script.build.cross_linux\\r'
         mkdir -p build && cd build
-        cmake -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-gcc-m32.cmake -DUA_ENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DUA_BUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=ON ..
+        cmake -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-gcc-m32.cmake -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-linux32 -DUA_ENABLE_AMALGAMATION=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_BUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=ON ..
         make -j
         if [ $? -ne 0 ] ; then exit 1 ; fi
-        tar -pczf open62541-linux32.tar.gz ../../doc_latex/open62541.pdf ../LICENSE ../AUTHORS ../README.md bin/examples/server_ctt bin/examples/client bin/libopen62541.* open62541.h open62541.c
-        cp open62541-linux32.tar.gz ..
-        cd .. && rm build -rf
+        make install
+        if [ $? -ne 0 ] ; then exit 1 ; fi
+        cd ..
+        tar -pczf open62541-linux32.tar.gz ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-linux32/*
+        rm build -rf
         echo -en 'travis_fold:end:script.build.cross_linux\\r'
 
         echo -e "\r\n== Cross compile release build for RaspberryPi =="  && echo -en 'travis_fold:start:script.build.cross_raspi\\r'
         mkdir -p build && cd build
         git clone https://github.com/raspberrypi/tools
         export PATH=$PATH:./tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/
-        cmake -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-rpi64.cmake -DUA_ENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DUA_BUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=ON ..
+        cmake -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-rpi64.cmake -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-raspberrypi -DUA_ENABLE_AMALGAMATION=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_BUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=ON ..
         make -j
         if [ $? -ne 0 ] ; then exit 1 ; fi
-        tar -pczf open62541-raspberrypi.tar.gz ../../doc_latex/open62541.pdf ../LICENSE ../AUTHORS ../README.md bin/examples/server_ctt bin/examples/client bin/libopen62541.* open62541.h open62541.c
-        cp open62541-raspberrypi.tar.gz ..
-        cd .. && rm build -rf
+        make install
+        if [ $? -ne 0 ] ; then exit 1 ; fi
+        cd ..
+        tar -pczf open62541-raspberrypi.tar.gz ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-raspberrypi/*
+        rm build -rf
         echo -en 'travis_fold:end:script.build.cross_raspi\\r'
     fi
 
     echo -e "\r\n== Compile release build for 64-bit linux =="  && echo -en 'travis_fold:start:script.build.linux_64\\r'
     mkdir -p build && cd build
-    cmake -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON -DCMAKE_BUILD_TYPE=Release -DUA_ENABLE_AMALGAMATION=ON -DUA_BUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=ON ..
+    cmake -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-linux64 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_ENABLE_AMALGAMATION=OFF -DUA_BUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=ON ..
     make -j
     if [ $? -ne 0 ] ; then exit 1 ; fi
-    tar -pczf open62541-linux64.tar.gz ../../doc_latex/open62541.pdf ../LICENSE ../AUTHORS ../README.md bin/examples/server_ctt bin/examples/client bin/libopen62541.* open62541.h open62541.c
-    cp open62541-linux64.tar.gz ..
-    cp open62541.h ../.. # copy single file-release
-    cp open62541.c ../.. # copy single file-release
-    cd .. && rm build -rf
+    make install
+    if [ $? -ne 0 ] ; then exit 1 ; fi
+    cd ..
+    tar -pczf open62541-linux64.tar.gz ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-linux64/*
+    rm build -rf
     echo -en 'travis_fold:end:script.build.linux_64\\r'
 
     echo -e "\r\n== Building the C++ example =="  && echo -en 'travis_fold:start:script.build.example\\r'
     mkdir -p build && cd build
-    cp ../../open62541.* .
+    cmake -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-linux64 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_ENABLE_AMALGAMATION=ON -DUA_BUILD_EXAMPLES=OFF -DBUILD_SHARED_LIBS=ON ..
+    make -j
+    cp open62541.h ../.. # copy single file-release
+    cp open62541.c ../.. # copy single file-release
     gcc -std=c99 -c open62541.c
     g++ ../examples/server.cpp -I./ open62541.o -lrt -o cpp-server
     if [ $? -ne 0 ] ; then exit 1 ; fi
@@ -196,12 +205,20 @@ else
 
     echo "Compile as shared lib version" && echo -en 'travis_fold:start:script.build.shared_libs\\r'
     mkdir -p build && cd build
-    cmake -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON -DBUILD_SHARED_LIBS=ON -DUA_ENABLE_AMALGAMATION=ON -DUA_BUILD_EXAMPLES=ON ..
+    cmake -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON -DBUILD_SHARED_LIBS=ON -DUA_ENABLE_AMALGAMATION=OFF -DUA_BUILD_EXAMPLES=ON ..
     make -j
     if [ $? -ne 0 ] ; then exit 1 ; fi
     cd .. && rm build -rf
     echo -en 'travis_fold:end:script.build.shared_libs\\r'
 
+    echo "Compile as shared lib version with amalgamation" && echo -en 'travis_fold:start:script.build.shared_libs_amalgamate\\r'
+    mkdir -p build && cd build
+    cmake -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON -DBUILD_SHARED_LIBS=ON -DUA_ENABLE_AMALGAMATION=ON -DUA_BUILD_EXAMPLES=OFF ..
+    make -j
+    if [ $? -ne 0 ] ; then exit 1 ; fi
+    cd .. && rm build -rf
+    echo -en 'travis_fold:end:script.build.shared_libs_amalgamate\\r'
+
     if [ "$CC" != "tcc" ]; then
         echo -e "\r\n==Compile multithreaded version==" && echo -en 'travis_fold:start:script.build.multithread\\r'
         mkdir -p build && cd build

+ 5 - 6
tools/travis/travis_osx_script.sh

@@ -24,13 +24,12 @@ echo -en 'travis_fold:end:script.build.ns0\\r'
 
 echo "Compile release build for OS X" && echo -en 'travis_fold:start:script.build.osx\\r'
 mkdir -p build && cd build
-cmake -DCMAKE_BUILD_TYPE=Release -DUA_ENABLE_AMALGAMATION=ON -DUA_BUILD_EXAMPLES=ON ..
+cmake -DCMAKE_BUILD_TYPE=Release -DUA_ENABLE_AMALGAMATION=OFF -DUA_BUILD_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-osx ..
 make -j
-tar -pczf open62541-osx.tar.gz ../LICENSE ../AUTHORS ../README.md ./bin/examples/server_ctt ./bin/examples/client ./bin/libopen62541.a open62541.h open62541.c
-cp open62541-osx.tar.gz ..
-cp open62541.h .. #copy single file-release
-cp open62541.c .. #copy single file-release
-cd .. && rm -rf build
+make install
+cd ..
+tar -pczf open62541-osx.tar.gz LICENSE AUTHORS README.md ${TRAVIS_BUILD_DIR}/open62541-osx/*
+rm -rf build
 echo -en 'travis_fold:end:script.build.osx\\r'
 
 echo "Compile multithreaded version" && echo -en 'travis_fold:start:script.build.multithread\\r'