Quellcode durchsuchen

fixing includes in debug bilds

Stasik0 vor 9 Jahren
Ursprung
Commit
aff138c1c9

+ 2 - 1
CMakeLists.txt

@@ -148,6 +148,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR CMAKE_BUILD_TYPE STREQUAL "Release"
     add_library(open62541-object OBJECT ${PROJECT_BINARY_DIR}/open62541.c)
     add_library(open62541 SHARED $<TARGET_OBJECTS:open62541-object>)
 else()
+    add_definitions(-DNOT_AMALGATED)
     add_library(open62541-object OBJECT ${lib_sources} ${internal_headers} ${exported_headers})
     include_directories(${PROJECT_SOURCE_DIR}/include)
     include_directories(${PROJECT_SOURCE_DIR}/deps)
@@ -214,7 +215,7 @@ option(BUILD_EXAMPLECLIENT "Build a test client" OFF)
 if(BUILD_EXAMPLECLIENT)
 	message(STATUS "Extensions: enabling client")
 	add_definitions( -DBENCHMARK=1 )
-	add_executable(exampleClient ${PROJECT_BINARY_DIR}/open62541.c examples/client.c)
+	add_executable(exampleClient $<TARGET_OBJECTS:open62541-object> examples/client.c)
     target_include_directories(exampleClient PRIVATE ${PROJECT_BINARY_DIR})
     if(ENABLE_MULTITHREADING)
         target_link_libraries(exampleClient urcu-cds urcu urcu-common pthread)

+ 9 - 2
examples/client.c

@@ -10,7 +10,14 @@
 #include <arpa/inet.h> //inet_addr
 #include <unistd.h> // for close
 #include <stdlib.h> // pulls in declaration of malloc, free
-#include "open62541.h"
+
+#ifdef NOT_AMALGATED
+    #include "ua_transport_generated.h"
+    #include "ua_types_encoding_binary.h"
+    #include "ua_util.h"
+#else
+    #include "open62541.h"
+#endif
 
 typedef struct ConnectionInfo {
 	UA_Int32 socket;
@@ -578,4 +585,4 @@ int main(int argc, char *argv[]) {
     UA_free(timeDiffs);
 
 	return 0;
-}
+}

+ 7 - 2
examples/logger_stdout.h

@@ -6,9 +6,14 @@
 #ifndef LOGGER_STDOUT_H_
 #define LOGGER_STDOUT_H_
 
-#include "open62541.h"
+#ifdef NOT_AMALGATED
+    #include "ua_types.h"
+    #include "ua_log.h"
+#else
+    #include "open62541.h"
+#endif
 
 /** Initialises the logger for the current thread. */
 UA_Logger Logger_Stdout_new(void);
 
-#endif /* LOGGER_STDOUT_H_ */
+#endif /* LOGGER_STDOUT_H_ */

+ 6 - 2
examples/networklayer_tcp.h

@@ -10,7 +10,11 @@
 extern "C" {
 #endif
 
-#include "open62541.h"
+#ifdef NOT_AMALGATED
+    #include "ua_server.h"
+#else
+    #include "open62541.h"
+#endif
 
 /** @brief Create the TCP networklayer and listen to the specified port */
 UA_ServerNetworkLayer ServerNetworkLayerTCP_new(UA_ConnectionConfig conf, UA_UInt32 port);
@@ -19,4 +23,4 @@ UA_ServerNetworkLayer ServerNetworkLayerTCP_new(UA_ConnectionConfig conf, UA_UIn
 } // extern "C"
 #endif
 
-#endif /* NETWORKLAYERTCP_H_ */
+#endif /* NETWORKLAYERTCP_H_ */

+ 6 - 2
examples/networklayer_udp.h

@@ -10,7 +10,11 @@
 extern "C" {
 #endif
 
-#include "ua_server.h"
+#ifdef NOT_AMALGATED
+    #include "ua_server.h"
+#else
+    #include "open62541.h"
+#endif
 
 /** @brief Create the UDP networklayer and listen to the specified port */
 UA_ServerNetworkLayer ServerNetworkLayerUDP_new(UA_ConnectionConfig conf, UA_UInt32 port);
@@ -19,4 +23,4 @@ UA_ServerNetworkLayer ServerNetworkLayerUDP_new(UA_ConnectionConfig conf, UA_UIn
 } // extern "C"
 #endif
 
-#endif /* NETWORKLAYERUDP_H_ */
+#endif /* NETWORKLAYERUDP_H_ */

+ 7 - 2
examples/server.c

@@ -8,7 +8,12 @@
 #include <signal.h>
 #include <errno.h> // errno, EINTR
 
-#include "open62541.h"
+#ifdef NOT_AMALGATED
+    #include "ua_types.h"
+    #include "ua_server.h"
+#else
+    #include "open62541.h"
+#endif
 
 // provided by the user, implementations available in the /examples folder
 #include "logger_stdout.h"
@@ -95,4 +100,4 @@ int main(int argc, char** argv) {
 	UA_Server_delete(server);
 
 	return retval;
-}
+}

+ 8 - 3
examples/server_datasource.c

@@ -2,8 +2,6 @@
  * 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 <time.h>
 #include <stdio.h>
 #include <stdlib.h> 
@@ -13,6 +11,13 @@
 #include <pthread.h>
 #endif
 
+#ifdef NOT_AMALGATED
+    #include "ua_types.h"
+    #include "ua_server.h"
+#else
+    #include "open62541.h"
+#endif
+
 // provided by the user, implementations available in the /examples folder
 #include "logger_stdout.h"
 #include "networklayer_tcp.h"
@@ -249,4 +254,4 @@ int main(int argc, char** argv) {
 #endif
 
 	return retval;
-}
+}