Browse Source

no compiler flag required to compile amalgamated server

Julius Pfrommer 9 years ago
parent
commit
0b9b7095ca
5 changed files with 12 additions and 15 deletions
  1. 1 1
      CMakeLists.txt
  2. 5 5
      examples/client.c
  3. 3 3
      examples/server.c
  4. 3 3
      examples/server_simple.c
  5. 0 3
      tools/amalgamate.py

+ 1 - 1
CMakeLists.txt

@@ -216,11 +216,11 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/open62541.c
                DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py ${internal_headers} ${PROJECT_SOURCE_DIR}/src/server/ua_nodestore_hash.inc ${lib_sources})
 
 if(ENABLE_AMALGAMATION)
-    add_definitions(-DUA_AMALGAMATE)
     add_custom_target(amalgamation ALL DEPENDS ${PROJECT_BINARY_DIR}/open62541.h ${PROJECT_BINARY_DIR}/open62541.c)
     add_library(open62541-object OBJECT ${PROJECT_BINARY_DIR}/open62541.c ${PROJECT_BINARY_DIR}/open62541.h)
     include_directories(${PROJECT_BINARY_DIR})
 else()
+    add_definitions(-DUA_NO_AMALGAMATION)
     add_library(open62541-object OBJECT ${lib_sources} ${internal_headers} ${exported_headers})
     include_directories(${PROJECT_SOURCE_DIR}/include)
     include_directories(${PROJECT_SOURCE_DIR}/deps)

+ 5 - 5
examples/client.c

@@ -1,14 +1,14 @@
-#ifdef UA_AMALGAMATE
-# include "open62541.h"
-# include <string.h>
-# include <stdlib.h>
-#else
+#ifdef UA_NO_AMALGAMATION
 # include "ua_types.h"
 # include "ua_client.h"
 # include "ua_nodeids.h"
 # include "networklayer_tcp.h"
 # include "logger_stdout.h"
 # include "ua_types_encoding_binary.h"
+#else
+# include "open62541.h"
+# include <string.h>
+# include <stdlib.h>
 #endif
 
 #include <stdio.h>

+ 3 - 3
examples/server.c

@@ -3,14 +3,14 @@
  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information.
  */
 
-#ifdef UA_AMALGAMATE
-# include "open62541.h"
-#else
+#ifdef UA_NO_AMALGAMATION
 # include <time.h>
 # include "ua_types.h"
 # include "ua_server.h"
 # include "logger_stdout.h"
 # include "networklayer_tcp.h"
+#else
+# include "open62541.h"
 #endif
 
 #include <signal.h>

+ 3 - 3
examples/server_simple.c

@@ -9,13 +9,13 @@
 #include <errno.h> // errno, EINTR
 #include <string.h>
 
-#ifdef UA_AMALGAMATE
-# include "open62541.h"
-#else
+#ifdef UA_NO_AMALGAMATION
 # include "ua_types.h"
 # include "ua_server.h"
 # include "logger_stdout.h"
 # include "networklayer_tcp.h"
+#else
+# include "open62541.h"
 #endif
 
 UA_Boolean running = 1;

+ 0 - 3
tools/amalgamate.py

@@ -55,9 +55,6 @@ extern "C" {
 if not is_c:
     for inc in includes:
         file.write(u"#include " + inc + "\n")
-    file.write(u'''#ifndef UA_AMALGAMATE
-# define UA_AMALGAMATE
-#endif\n\n''')
 else:
     file.write(u'''#ifndef UA_DYNAMIC_LINKING
 # define UA_DYNAMIC_LINKING