cmake: Remove UA_NO_AMALGAMATION and use UA_ENABLE_AMALGAMATION instead

Since default build is without amalgamation, we should assume that and only
ifdefs is amalgamation is enabled
This commit is contained in:
Stefan Profanter 2018-12-18 10:26:50 +01:00
parent e8499689e2
commit 36641ad6a5
No known key found for this signature in database
GPG Key ID: 52787A8E77301854
9 changed files with 48 additions and 22 deletions

View File

@ -819,7 +819,6 @@ if(UA_ENABLE_AMALGAMATION)
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-generator-types
@ -922,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)

View File

@ -9,6 +9,11 @@ set(examples_headers
${PROJECT_SOURCE_DIR}/examples/common.h
)
if(UA_ENABLE_AMALGAMATION)
add_definitions(-DUA_ENABLE_AMALGAMATION)
endif()
#############################
# Compiled binaries folders #
#############################

View File

@ -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 "ua_types.h"
#include "ua_types_generated_handling.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.
*

View File

@ -1,12 +1,12 @@
/* 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>

View File

@ -5,10 +5,15 @@
#define _CRT_SECURE_NO_WARNINGS /* disable fopen deprication warning in msvs */
#endif
#include <ua_server.h>
#include <ua_config_default.h>
#include <ua_log_stdout.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>

View File

@ -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

View File

@ -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

View File

@ -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 + " */")

View File

@ -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 "ua_server.h"
#ifdef UA_ENABLE_AMALGAMATION
# include "open62541.h"
#else
# include "ua_server.h"
#endif
""")
writeh("""
_UA_BEGIN_DECLS