Browse Source

Various compilation fixes

Stefan Profanter 6 years ago
parent
commit
737ab1f1e0
5 changed files with 42 additions and 32 deletions
  1. 0 1
      CMakeLists.txt
  2. 3 2
      appveyor.yml
  3. 16 10
      arch/eCos/CMakeLists.txt
  4. 20 16
      arch/posix/CMakeLists.txt
  5. 3 3
      arch/win32/CMakeLists.txt

+ 0 - 1
CMakeLists.txt

@@ -40,7 +40,6 @@ if(NOT OPEN62541_VER_COMMIT OR OPEN62541_VER_COMMIT STREQUAL "")
     set(OPEN62541_VER_COMMIT "undefined")
 endif()
 
-
 #################
 # Build Options #
 #################

+ 3 - 2
appveyor.yml

@@ -13,8 +13,9 @@ environment:
     matrix:
         - CC_NAME: MinGW Makefiles
           CC_SHORTNAME: mingw
-          # We need to redirect stderr to stdout otherwise powershell will fail if there is an output during amalgamation
-          MAKE: mingw32-make -j 2>&1
+          # 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

+ 16 - 10
arch/eCos/CMakeLists.txt

@@ -2,19 +2,25 @@ SET(SOURCE_GROUP ${SOURCE_GROUP}\\eCos)
 
 ua_add_architecture("eCos")
 
-if("${UA_ARCHITECTURE}" STREQUAL "eCos")
 
-ua_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-ua_add_architecture_file(${CMAKE_CURRENT_SOURCE_DIR}/ua_clock.c)
-ua_add_architecture_file(${CMAKE_CURRENT_SOURCE_DIR}/ua_architecture_functions.c)
+list (FIND UA_AMALGAMATION_ARCHITECUTRES "eCos" _index)
+if (${_index} GREATER -1 OR "${UA_ARCHITECTURE}" STREQUAL "eCos")
 
-ua_architecture_remove_definitions(-Wpedantic -Wno-static-in-inline -Wc++-compat)
-ua_architecture_add_definitions(-Wno-sign-conversion -fdata-sections -fno-exceptions -ffunction-sections -DSYSTEM_BUS_WIDTH=32  -mhw-mul -mno-hw-mulx -mhw-div -Wa,-relax-all -W -Wall -Wextra -D_KERNEL -D__ECOS -nostdlib -Wl,--gc-sections -Wl,-static)
+    ua_add_architecture_file(${CMAKE_CURRENT_SOURCE_DIR}/ua_clock.c)
+    ua_add_architecture_file(${CMAKE_CURRENT_SOURCE_DIR}/ua_architecture_functions.c)
 
-ua_architecture_append_to_library("-L${UA_ECOS_INCLUDES}/lib -Wl,-T,${UA_ECOS_INCLUDES}/lib/target.ld -nostartfiles") #for examples
+    if("${UA_ARCHITECTURE}" STREQUAL "eCos")
 
-SET(UA_ECOS_INCLUDES "" CACHE STRING "Folders to include from the eCos OS")
+        ua_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 
-ua_include_directories(${UA_ECOS_INCLUDES}/include)
+        ua_architecture_remove_definitions(-Wpedantic -Wno-static-in-inline -Wc++-compat)
+        ua_architecture_add_definitions(-Wno-sign-conversion -fdata-sections -fno-exceptions -ffunction-sections -DSYSTEM_BUS_WIDTH=32  -mhw-mul -mno-hw-mulx -mhw-div -Wa,-relax-all -W -Wall -Wextra -D_KERNEL -D__ECOS -nostdlib -Wl,--gc-sections -Wl,-static)
 
-endif()
+        ua_architecture_append_to_library("-L${UA_ECOS_INCLUDES}/lib -Wl,-T,${UA_ECOS_INCLUDES}/lib/target.ld -nostartfiles") #for examples
+
+        SET(UA_ECOS_INCLUDES "" CACHE STRING "Folders to include from the eCos OS")
+
+        ua_include_directories(${UA_ECOS_INCLUDES}/include)
+    endif()
+
+endif()

+ 20 - 16
arch/posix/CMakeLists.txt

@@ -7,23 +7,27 @@ if (${_index} GREATER -1 OR "${UA_ARCHITECTURE}" STREQUAL "posix")
 
     ua_add_architecture_file(${CMAKE_CURRENT_SOURCE_DIR}/ua_clock.c)
     ua_add_architecture_file(${CMAKE_CURRENT_SOURCE_DIR}/ua_architecture_functions.c)
-    
-    if(NOT CYGWIN AND NOT QNXNTO AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD"))
-        add_definitions(-Wshadow -Wconversion -fvisibility=hidden -fPIC)
-    endif()
-    
-    if(QNXNTO)
-      ua_architecture_append_to_library(socket c stdc++)
-    else()
-      ua_architecture_append_to_library(m)
-      if(UA_ENABLE_MULTITHREADING OR UA_BUILD_UNIT_TESTS)
-        ua_architecture_append_to_library(pthread)
-      endif()
-      if(NOT APPLE AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD"))
-        ua_architecture_append_to_library(rt)
-      endif()
+
+
+    if("${UA_ARCHITECTURE}" STREQUAL "posix")
+        if(NOT CYGWIN AND NOT QNXNTO AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD"))
+            ua_architecture_add_definitions(-Wshadow -Wconversion -fvisibility=hidden -fPIC)
+        endif()
+
+        if(QNXNTO)
+          ua_architecture_append_to_library(socket c stdc++)
+        else()
+          ua_architecture_append_to_library(m)
+          if(UA_ENABLE_MULTITHREADING OR UA_BUILD_UNIT_TESTS)
+            ua_architecture_append_to_library(pthread)
+          endif()
+          if(NOT APPLE AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD"))
+            ua_architecture_append_to_library(rt)
+          endif()
+        endif()
+
+        ua_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
     endif()
 
-    ua_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 
 endif()

+ 3 - 3
arch/win32/CMakeLists.txt

@@ -10,10 +10,10 @@ if (${_index} GREATER -1 OR "${UA_ARCHITECTURE}" STREQUAL "win32")
 
     if("${UA_ARCHITECTURE}" STREQUAL "win32")
         ua_architecture_append_to_library(ws2_32)
-    endif()
 
-    if(UA_ENABLE_DISCOVERY_MULTICAST OR UA_ENABLE_PUBSUB)
-        ua_architecture_append_to_library(APPEND open62541_LIBRARIES iphlpapi)
+        if(UA_ENABLE_DISCOVERY_MULTICAST OR UA_ENABLE_PUBSUB)
+            ua_architecture_append_to_library(iphlpapi)
+        endif()
     endif()
 
     ua_include_directories(${CMAKE_CURRENT_SOURCE_DIR})