Pārlūkot izejas kodu

amalgated source will be generated for Release and MinSizeRel build types, for other types, exclusive files will be compiled and used

Stasik0 9 gadi atpakaļ
vecāks
revīzija
f54522be6a
2 mainītis faili ar 18 papildinājumiem un 12 dzēšanām
  1. 3 2
      .travis.yml
  2. 15 10
      CMakeLists.txt

+ 3 - 2
.travis.yml

@@ -35,7 +35,8 @@ script:
 - echo "Cross compile release build for MinGW"
 - cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw32.cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLESERVER=ON ..
 - make -j
-- zip open62541-win32.zip ../README.md exampleServer_datasource.exe libopen62541.dll open62541.h open62541.c
+- cp ../README.md .
+- zip open62541-win32.zip README.md exampleServer_datasource.exe libopen62541.dll libopen62541.dll.a open62541.h open62541.c
 - cp open62541-win32.zip ..
 - cd .. && rm build -rf && mkdir -p build && cd build
 - echo "Cross compile release build for 32-bit linux"
@@ -97,4 +98,4 @@ deploy:
     - open62541-raspberrypi.tar.gz
   skip_cleanup: true
   on:
-    tags: true
+    tags: true

+ 15 - 10
CMakeLists.txt

@@ -135,8 +135,9 @@ if(BUILD_DEMO_NODESET)
 	add_definitions(-DDEMO_NODESET)
 endif()
 
-## build amalgamated source files
-add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/open62541.h ${PROJECT_BINARY_DIR}/open62541.c
+if(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR CMAKE_BUILD_TYPE STREQUAL "Release")
+    ## build amalgamated source files
+    add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/open62541.h ${PROJECT_BINARY_DIR}/open62541.c
                    PRE_BUILD
                    COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py ${CMAKE_CURRENT_BINARY_DIR}/open62541.h ${exported_headers}
                    COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py ${CMAKE_CURRENT_BINARY_DIR}/open62541.c
@@ -144,13 +145,17 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/open62541.h ${PROJECT_BINARY_DIR
                    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/amalgamate.py ${exported_headers} ${internal_headers}
                            ${PROJECT_BINARY_DIR}/src_generated/ua_config.h ${PROJECT_SOURCE_DIR}/src/server/ua_nodestore_hash.inc ${lib_sources})
 
-# add_library(open62541-object OBJECT ${lib_sources})
-# include_directories(${PROJECT_SOURCE_DIR}/include)
-# include_directories(${PROJECT_SOURCE_DIR}/deps)
-# include_directories(${PROJECT_SOURCE_DIR}/src)
-# include_directories(${PROJECT_BINARY_DIR}/src_generated)
-add_library(open62541-object OBJECT ${PROJECT_BINARY_DIR}/open62541.c)
-add_library(open62541 SHARED $<TARGET_OBJECTS:open62541-object>)
+    add_library(open62541-object OBJECT ${PROJECT_BINARY_DIR}/open62541.c)
+    add_library(open62541 SHARED $<TARGET_OBJECTS:open62541-object>)
+else()
+    ##compile from individual c files
+    add_library(open62541-object OBJECT ${lib_sources})
+    include_directories(${PROJECT_SOURCE_DIR}/include)
+    include_directories(${PROJECT_SOURCE_DIR}/deps)
+    include_directories(${PROJECT_SOURCE_DIR}/src)
+    include_directories(${PROJECT_BINARY_DIR}/src_generated)
+endif()
+
 
 # build language bindings for the library
 option(ENABLE_BINDING_LUA "Build Lua bindings" OFF)
@@ -249,4 +254,4 @@ if(BUILD_DOCUMENTATION)
                       ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
                       WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
                       COMMENT "Generating API documentation with Doxygen")
-endif()
+endif()