Commit 65d2f1f4 authored by liedtkeInTUM's avatar liedtkeInTUM Committed by Luca Boccassi

Problem: if IPC enabled libzmq does not compile when in uwp build (#3747)

* Problem: if IPC enabled libzmq does not compile when in uwp build

* Problem 10.0.##### can be valid windows target versions

* Problem: No builds are triggered on uwp platform

* Problem: epoll is set before UWP platform is checked

* Problem: used wrong CMAKE_SYSTEM_NAME specifier

* Problem: build tests fails during cmake configure

* Use Win32 build step for Win32-uwp platform

* Disable compile options that produce warnings that leads to a ci fail

* winnt version is set by cmake, no need for redefinition in windows.hpp

* Eliminate all warning according Incremental and opt:icf are specified

* Prefer to disable opt flags in debug config rather than incremental linking

* CMAKE_GENERATOR should not include uwp definition

* Add release build with uwp configuration

* Problem: pointer potentially uninitialized
parent 51bf2aff
......@@ -199,6 +199,16 @@ set(POLLER "" CACHE STRING "Choose polling system for I/O threads. valid values
kqueue, epoll, devpoll, pollset, poll or select [default=autodetect]")
if (WIN32)
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND CMAKE_SYSTEM_VERSION MATCHES "^10.0")
set(ZMQ_HAVE_WINDOWS_UWP ON)
set(ZMQ_HAVE_IPC OFF)
# to remove compile warninging "D9002 ignoring unknown option"
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} CACHE STRING "" FORCE)
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} CACHE STRING "" FORCE)
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
endif()
# from https://stackoverflow.com/a/40217291/2019765
macro(get_WIN32_WINNT version)
if (CMAKE_SYSTEM_VERSION)
......@@ -238,12 +248,12 @@ if (WIN32)
set(ZMQ_WIN32_WINNT "${ZMQ_WIN32_WINNT_DEFAULT}" CACHE STRING "Value to set _WIN32_WINNT to for building [default=autodetect from build environment]")
# On Windows Vista or greater, with MSVC 2013 or greater, default to epoll (which is required on Win 10 for ipc support)
if (ZMQ_WIN32_WINNT GREATER "0x05FF" AND MSVC_VERSION GREATER 1799 AND POLLER STREQUAL "")
set(POLLER "epoll")
endif()
# On Windows Vista or greater, with MSVC 2013 or greater, default to epoll (which is required on Win 10 for ipc support)
if (ZMQ_WIN32_WINNT GREATER "0x05FF" AND MSVC_VERSION GREATER 1799 AND POLLER STREQUAL "" AND NOT ZMQ_HAVE_WINDOWS_UWP)
set(POLLER "epoll")
endif()
add_definitions(-D_WIN32_WINNT=${ZMQ_WIN32_WINNT})
add_definitions(-D_WIN32_WINNT=${ZMQ_WIN32_WINNT})
endif(WIN32)
if(NOT MSVC)
......@@ -389,9 +399,6 @@ else()
endif()
###################### END condition_variable_t selection
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND CMAKE_SYSTEM_VERSION STREQUAL "10.0")
set(ZMQ_HAVE_WINDOWS_UWP ON)
endif()
if(NOT MSVC)
check_include_files(ifaddrs.h ZMQ_HAVE_IFADDRS)
check_include_files(sys/uio.h ZMQ_HAVE_UIO)
......@@ -1186,6 +1193,9 @@ if(MSVC)
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
COMPILE_DEFINITIONS "DLL_EXPORT"
OUTPUT_NAME "lib${ZMQ_OUTPUT_BASENAME}")
if(ZMQ_HAVE_WINDOWS_UWP)
set_target_properties(libzmq PROPERTIES LINK_FLAGS_DEBUG "/OPT:NOICF /OPT:NOREF")
endif()
endif()
if(BUILD_STATIC)
......@@ -1379,6 +1389,9 @@ if(BUILD_SHARED)
RUNTIME DESTINATION bin
COMPONENT PerfTools)
endif()
if(ZMQ_HAVE_WINDOWS_UWP)
set_target_properties(${perf-tool} PROPERTIES LINK_FLAGS_DEBUG "/OPT:NOICF /OPT:NOREF")
endif()
endforeach()
if(BUILD_STATIC)
......@@ -1387,6 +1400,9 @@ if(BUILD_SHARED)
target_include_directories(benchmark_radix_tree
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/src")
if(ZMQ_HAVE_WINDOWS_UWP)
set_target_properties(benchmark_radix_tree PROPERTIES LINK_FLAGS_DEBUG "/OPT:NOICF /OPT:NOREF")
endif()
endif()
endif()
......
......@@ -110,6 +110,30 @@ environment:
ENABLE_CURVE: ON
CMAKE_GENERATOR: "MSYS Makefiles"
ARTIFACT_NAME: mingw64
- platform: Win32-uwp
configuration: Debug
WITH_LIBSODIUM: OFF
ENABLE_CURVE: OFF
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_GENERATOR: "Visual Studio 15 2017"
MSVCVERSION: "v141"
MSVCYEAR: "vs2017"
ARTIFACT_NAME: v141-gd-uwp
CMAKE_SYSTEM_NAME: WindowsStore
CMAKE_SYSTEM_VERSION: 10.0.18362
EXTRA_FLAGS: -DCMAKE_SYSTEM_NAME=%CMAKE_SYSTEM_NAME% -DCMAKE_SYSTEM_VERSION=%CMAKE_SYSTEM_VERSION% -DBUILD_TESTS=OFF
- platform: Win32-uwp
configuration: Release
WITH_LIBSODIUM: OFF
ENABLE_CURVE: OFF
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_GENERATOR: "Visual Studio 15 2017"
MSVCVERSION: "v141"
MSVCYEAR: "vs2017"
ARTIFACT_NAME: v141-uwp
CMAKE_SYSTEM_NAME: WindowsStore
CMAKE_SYSTEM_VERSION: 10.0.18362
EXTRA_FLAGS: -DCMAKE_SYSTEM_NAME=%CMAKE_SYSTEM_NAME% -DCMAKE_SYSTEM_VERSION=%CMAKE_SYSTEM_VERSION% -DBUILD_TESTS=OFF
matrix:
fast_finish: false
......@@ -180,7 +204,7 @@ build_script:
- cmd: if "%MSVCYEAR%"=="vs2008" set verbosity=Normal
- cmd: if "%MSVCYEAR%"=="vs2008" set path=C:\Windows\Microsoft.NET\Framework\v3.5;%path%
- cmd: cd "%LIBZMQ_BUILDDIR%"
- cmd: if "%PLATFORM%" == "Win32" (
- cmd: if "%PLATFORM:~0,5%" == "Win32" (
if "%MSVCYEAR%"=="vs2008" (
cmake --build %LIBZMQ_BUILDDIR% --config %configuration% --target install
) else (
......
......@@ -43,10 +43,6 @@
#define _WIN32_WINNT 0x0600
#endif
#if defined ZMQ_HAVE_WINDOWS_UWP
#define _WIN32_WINNT _WIN32_WINNT_WIN10
#endif
#ifdef __MINGW32__
// Require Windows XP or higher with MinGW for getaddrinfo().
#if (_WIN32_WINNT >= 0x0501)
......
......@@ -383,7 +383,7 @@ void expect_new_client_bounce_fail (char *my_endpoint_,
int expected_client_event_,
int expected_client_value_)
{
void *my_client_mon;
void *my_client_mon = NULL;
TEST_ASSERT_TRUE (client_mon_ == NULL || expected_client_event_ == 0);
if (expected_client_event_ != 0)
client_mon_ = &my_client_mon;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment