Explorar el Código

Merge branch '0.2'

Julius Pfrommer hace 6 años
padre
commit
70e47a8419
Se han modificado 3 ficheros con 24 adiciones y 29 borrados
  1. 0 22
      CMakeLists.txt
  2. 21 4
      examples/CMakeLists.txt
  3. 3 3
      tools/amalgamate.py

+ 0 - 22
CMakeLists.txt

@@ -419,23 +419,6 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/open62541.c
 ADD_CUSTOM_TARGET(open62541_amalgamation DEPENDS ${PROJECT_BINARY_DIR}/open62541.h
                                                  ${PROJECT_BINARY_DIR}/open62541.c)
 
-# example information model from nodeset xml
-add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/nodeset.h ${PROJECT_BINARY_DIR}/src_generated/nodeset.c
-                  PRE_BUILD
-                  COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py
-                                                -i ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_Blacklist_FullNS0.txt
-                                                ${PROJECT_SOURCE_DIR}/tools/schema/namespace0/Opc.Ua.NodeSet2.xml
-                                                ${PROJECT_SOURCE_DIR}/examples/server_nodeset.xml
-                                                ${PROJECT_BINARY_DIR}/src_generated/nodeset
-                  DEPENDS ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py
-                          ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/open62541_MacroHelper.py
-                          ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_builtin_types.py
-                          ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_constants.py
-                          ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_namespace.py
-                          ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_node_types.py
-                          ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_Blacklist_FullNS0.txt
-                          ${PROJECT_SOURCE_DIR}/examples/server_nodeset.xml)
-
 #####################
 # Build the Library #
 #####################
@@ -512,11 +495,6 @@ if(UA_BUILD_UNIT_TESTS)
     add_subdirectory(tests)
 endif()
 
-if(UA_BUILD_EXAMPLES_NODESET_COMPILER)
-  add_custom_target(generate_informationmodel ALL
-                    DEPENDS ${PROJECT_BINARY_DIR}/src_generated/nodeset.h ${PROJECT_BINARY_DIR}/src_generated/nodeset.c)
-endif()
-
 ############################
 # Linting run (clang-tidy) #
 ############################

+ 21 - 4
examples/CMakeLists.txt

@@ -65,10 +65,27 @@ add_example(server_repeated_job server_repeated_job.c)
 
 add_example(server_inheritance server_inheritance.c)
 
-if(NOT BUILD_SHARED_LIBS AND UA_BUILD_EXAMPLES_NODESET_COMPILER)
-    # needs internal methods which are not exported in the dynamic lib
-    add_example(server_nodeset "server_nodeset.c ${PROJECT_BINARY_DIR}/src_generated/nodeset.c")
-    target_include_directories(server_nodeset PRIVATE ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/deps) # needs an internal header
+if(NOT BUILD_SHARED_open62541_LIBRARIES AND UA_BUILD_EXAMPLES_NODESET_COMPILER)
+  # example information model from nodeset xml
+  add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/nodeset.h ${PROJECT_BINARY_DIR}/src_generated/nodeset.c
+                    PRE_BUILD
+                    COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py
+                                                 -i ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_Blacklist_FullNS0.txt
+                                                 ${PROJECT_SOURCE_DIR}/tools/schema/namespace0/Opc.Ua.NodeSet2.xml
+                                                 ${PROJECT_SOURCE_DIR}/examples/server_nodeset.xml
+                                                 ${PROJECT_BINARY_DIR}/src_generated/nodeset
+                    DEPENDS ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/generate_open62541CCode.py
+                            ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/open62541_MacroHelper.py
+                            ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_builtin_types.py
+                            ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_constants.py
+                            ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_namespace.py
+                            ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_node_types.py
+                            ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_Blacklist_FullNS0.txt
+                            ${PROJECT_SOURCE_DIR}/examples/server_nodeset.xml)
+
+  # needs internal methods which are not exported in the dynamic lib
+  add_example(server_nodeset server_nodeset.c ${PROJECT_BINARY_DIR}/src_generated/nodeset.c)
+  target_include_directories(server_nodeset PRIVATE ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/deps) # needs an internal header
 endif()
 
 if(UA_BUILD_SELFSIGNED_CERTIFICATE)

+ 3 - 3
tools/amalgamate.py

@@ -4,9 +4,9 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import print_function
-import re
 import argparse
 import os.path
+import re
 import io
 
 parser = argparse.ArgumentParser()
@@ -27,7 +27,7 @@ guard_re = re.compile("^#(?:(?:ifndef|define)\s*[A-Z_]+_H_|endif /\* [A-Z_]+_H_
 
 print ("Starting amalgamating file "+ args.outfile)
 
-file = io.open(args.outfile, 'w')
+file = io.open(args.outfile, 'w', encoding='utf8', errors='replace')
 file.write(u"""/* THIS IS A SINGLE-FILE DISTRIBUTION CONCATENATED FROM THE OPEN62541 SOURCES
  * visit http://open62541.org/ for information about this software
  * Git-Revision: %s
@@ -62,7 +62,7 @@ extern "C" {
 #endif\n''' % (outname.upper() + u"_H_", outname.upper() + u"_H_") )
 
 for fname in args.inputs:
-    with io.open(fname, encoding="utf8") as infile:
+    with io.open(fname, encoding='utf8', errors='replace') as infile:
         file.write(u"\n/*********************************** amalgamated original file \"" + fname + u"\" ***********************************/\n\n")
         print ("Integrating file '" + fname + "'...", end=""),
         for line in infile: