Browse Source

infrastructure: simplify appveyor; add visual studio 2008 but do not
activate

Julius Pfrommer 8 years ago
parent
commit
b374768f2f
2 changed files with 47 additions and 59 deletions
  1. 17 1
      CMakeLists.txt
  2. 30 58
      appveyor.yml

+ 17 - 1
CMakeLists.txt

@@ -1,5 +1,5 @@
 cmake_minimum_required(VERSION 2.8.11)
-project(open62541 C)
+project(open62541)
 set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/cmake")
 # set(CMAKE_VERBOSE_MAKEFILE ON)
 
@@ -89,6 +89,7 @@ option(UA_BUILD_EXAMPLES_NODESET_COMPILER "Generate an OPC UA information model
 
 # Advanced Build Targets
 option(UA_BUILD_SELFSIGNED_CERTIFICATE "Generate self-signed certificate" OFF)
+mark_as_advanced(UA_BUILD_SELFSIGNED_CERTIFICATE)
 
 # Building shared libs (dll, so). This option is written into ua_config.h.
 set(UA_DYNAMIC_LINKING OFF)
@@ -96,6 +97,10 @@ if(BUILD_SHARED_LIBS)
   set(UA_DYNAMIC_LINKING ON)
 endif()
 
+# Force compilation with as C++
+option(UA_COMPILE_AS_CXX "Force compilation with a C++ compiler" OFF)
+mark_as_advanced(UA_COMPILE_AS_CXX)
+
 #####################
 # Compiler Settings #
 #####################
@@ -356,6 +361,10 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/nodeset.h ${PROJEC
                           ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/ua_node_types.py
                           ${PROJECT_SOURCE_DIR}/tools/pyUANamespace/NodeID_Blacklist_FullNS0.txt
                           ${PROJECT_SOURCE_DIR}/examples/server_nodeset.xml)
+                          
+##########################################################
+# Set Language to C++ (manually / for certain compilers) #
+##########################################################
 
 #####################
 # Build the Library #
@@ -364,11 +373,18 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/nodeset.h ${PROJEC
 if(UA_ENABLE_AMALGAMATION)
     add_library(open62541-object OBJECT ${PROJECT_BINARY_DIR}/open62541.c ${PROJECT_BINARY_DIR}/open62541.h)
     target_include_directories(open62541-object PRIVATE ${PROJECT_BINARY_DIR})
+    if(UA_COMPILE_AS_CXX)
+        set_source_files_properties(${PROJECT_BINARY_DIR}/open62541.c PROPERTIES LANGUAGE CXX)
+    endif()
 else()
     add_definitions(-DUA_NO_AMALGAMATION)
     add_library(open62541-object OBJECT ${lib_sources} ${internal_headers} ${exported_headers})
     target_include_directories(open62541-object PRIVATE ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/src
                                                         ${PROJECT_SOURCE_DIR}/plugins ${PROJECT_SOURCE_DIR}/deps)
+
+    if(UA_COMPILE_AS_CXX)
+        set_source_files_properties(${lib_sources} PROPERTIES LANGUAGE CXX)
+    endif()
 endif()
 add_library(open62541 $<TARGET_OBJECTS:open62541-object>)
 target_link_libraries(open62541 ${open62541_LIBRARIES})

+ 30 - 58
appveyor.yml

@@ -1,7 +1,5 @@
 version: '{build}'
 
-os: Visual Studio 2015 RC
-
 clone_folder: c:\projects\open62541
 clone_depth: 20
 
@@ -14,29 +12,39 @@ environment:
         CYG_CACHE: C:\cygwin\var\cache\setup
         CYG_BASH: C:/cygwin/bin/bash
 
+    matrix:
+        - CC_NAME: MinGW Makefiles
+          CC_SHORTNAME: mingw
+          MAKE: mingw32-make
+          FORCE_CXX: OFF
+        # - CC_NAME: Visual Studio 9 2008
+        #   CC_SHORTNAME: vs2008
+        #   MAKE: msbuild open62541.sln /m
+        #   FORCE_CXX: ON
+        - CC_NAME: Visual Studio 12 2013
+          CC_SHORTNAME: vs2013
+          MAKE: msbuild open62541.sln /m
+          FORCE_CXX: OFF
+        - CC_NAME: Visual Studio 12 2013 Win64
+          CC_SHORTNAME: vs2013-x64
+          MAKE: msbuild open62541.sln /m
+          FORCE_CXX: OFF
+
 cache:
   - '%CYG_CACHE%'
 
-#
-# Initialisation prior to pulling the Mono repository
-# Attempt to ensure we don't try to convert line endings to Win32 CRLF as this will cause build to fail
-#
 init:
-  - git config --global core.autocrlf input
-
+  - git config --global core.autocrlf input # Attempt to ensure we don't try to convert line endings to Win32 CRLF as this will cause build to fail
 
-#
 # Install needed build dependencies
-#
 install:
   - if not exist "%CYG_ROOT%" mkdir "%CYG_ROOT%"
-  - ps:  echo "Installing Cygwin from $env:CYG_SETUP_URL to $env:CYG_ROOT/setup-x86.exe"
+  - ps: echo "Installing Cygwin from $env:CYG_SETUP_URL to $env:CYG_ROOT/setup-x86.exe"
   - appveyor DownloadFile %CYG_SETUP_URL% -FileName %CYG_ROOT%/setup-x86.exe
-  - ps:  echo "Downloaded. Now ready to install."
-  - cmd: '"%CYG_ROOT%/setup-x86.exe" --quiet-mode --no-shortcuts --only-site -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" --packages cmake,gcc-core,make,python'
+  - ps: echo "Downloaded. Now ready to install."
+  - cmd: '"%CYG_ROOT%/setup-x86.exe" --quiet-mode --no-shortcuts --only-site -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" --packages cmake,python'
   - cmd: '%CYG_BASH% -lc "cygcheck -dc cygwin"'
 
-
 before_build:
   # Workaround for CMake not wanting sh.exe on PATH for MinGW
   - set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
@@ -46,54 +54,18 @@ build_script:
   - cd c:\projects\open62541
   - md build
   - cd build
-  # cygwin cmake stopped working on 05.07.2016 -- commented out until a fix appears
-  #- echo "Testing cygwin"
-  #- '%CYG_BASH% --login -lc "/usr/bin/cmake.exe --version"'
-  #- '%CYG_BASH% --login -lc "cd /cygdrive/c/projects/open62541/build; cmake -DUA_BUILD_EXAMPLES:BOOL=ON -G\"Unix Makefiles\" .."'
-  #- '%CYG_BASH% --login -lc "cd /cygdrive/c/projects/open62541/build; make -j"'
+  - echo "Testing %CC_NAME%"
+  - cmake -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_COMPILE_AS_CXX:BOOL=%FORCE_CXX% -G"%CC_NAME%" ..
+  - '%MAKE%'
   - cd ..
   - rd /s /q build
   - md build
   - cd build
-  - echo "Testing MinGW32"
-  - cmake -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_BUILD_SELFSIGNED_CERTIFICATE:BOOL=ON -G"MinGW Makefiles" ..
-  - mingw32-make
-  - cd ..
-  - rd /s /q build
-  - md build
-  - cd build
-  - echo "Testing MinGW32 with amalgamation"
-  - cmake -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_BUILD_SELFSIGNED_CERTIFICATE:BOOL=ON -DUA_ENABLE_AMALGAMATION:BOOL=ON -G"MinGW Makefiles" ..
-  - mingw32-make
-  - cd ..
-  - rd /s /q build
-  - md build
-  - cd build
-  - cmake -DUA_BUILD_EXAMPLES:BOOL=ON -G"Visual Studio 12 2013" ..
-  - msbuild open62541.sln /m
-  - echo "Testing amalgamation"
-  - cd ..
-  - rd /s /q build
-  - md build
-  - cd build
-  - cmake -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_BUILD_SELFSIGNED_CERTIFICATE:BOOL=ON -DUA_ENABLE_AMALGAMATION:BOOL=ON -G"Visual Studio 12 2013" ..
-  - msbuild open62541.sln /m
-  - copy C:\projects\open62541\build\open62541.c C:\projects\open62541\build\Debug\open62541.c
-  - copy C:\projects\open62541\build\open62541.h C:\projects\open62541\build\Debug\open62541.h
-  - copy C:\projects\open62541\build\examples\server_cert.der C:\projects\open62541\build\Debug\server_cert.der
-  - cd ..
-  - echo "Win 64 build"
-  - md build64
-  - cd build64
-  - cmake -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_BUILD_SELFSIGNED_CERTIFICATE:BOOL=ON -DUA_ENABLE_AMALGAMATION:BOOL=ON -G"Visual Studio 12 2013 Win64" ..
-  - msbuild open62541.sln /m
-  - copy C:\projects\open62541\build64\open62541.c C:\projects\open62541\build64\Debug\open62541.c
-  - copy C:\projects\open62541\build64\open62541.h C:\projects\open62541\build64\Debug\open62541.h
-  - copy C:\projects\open62541\build64\examples\server_cert.der C:\projects\open62541\build64\Debug\server_cert.der
+  - echo "Testing %CC_NAME% with amalgamation"
+  - cmake -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_ENABLE_AMALGAMATION:BOOL=ON -DUA_COMPILE_AS_CXX:BOOL=%FORCE_CXX% -G"%CC_NAME%" ..
+  - '%MAKE%'
   - cd ..
 
 after_build:
-  - 7z a open62541-win32.zip %APPVEYOR_BUILD_FOLDER%\build\Debug\* %APPVEYOR_BUILD_FOLDER%\build\examples\Debug\*
-  - 7z a open62541-win64.zip %APPVEYOR_BUILD_FOLDER%\build64\Debug\* %APPVEYOR_BUILD_FOLDER%\build64\examples\Debug\*
-  - appveyor PushArtifact open62541-win32.zip
-  - appveyor PushArtifact open62541-win64.zip
+  - 7z a open62541-%CC_SHORTNAME%.zip %APPVEYOR_BUILD_FOLDER%\build*
+  - appveyor PushArtifact open62541-%CC_SHORTNAME%.zip