Adding appveyor integration
- Make required changes in CMake module files. - Add supporting batch scripts to build. - Modify C++ code to be compatible with VS2015 capabilities.
This commit is contained in:
parent
7f74f27510
commit
ca500b0b25
26
appveyor.yml
Normal file
26
appveyor.yml
Normal file
@ -0,0 +1,26 @@
|
||||
# can use variables like {build} and {branch}
|
||||
version: 1.0.0
|
||||
|
||||
image: Visual Studio 2015
|
||||
|
||||
environment:
|
||||
BUILD_DIR: "%APPVEYOR_BUILD_FOLDER%/build"
|
||||
|
||||
platform:
|
||||
- x86
|
||||
- x64
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
|
||||
before_build:
|
||||
- deps.bat
|
||||
- cd %BUILD_DIR%
|
||||
- cmake .. -G"%CMAKE_GENERATOR_NAME%"
|
||||
|
||||
build:
|
||||
parallel: true
|
||||
project: "%BUILD_DIR%/uvw.sln"
|
||||
verbosity: minimal
|
||||
|
||||
test_script: "%BUILD_DIR%/runtests.bat"
|
||||
@ -30,24 +30,28 @@ find_path(
|
||||
find_library(
|
||||
GOOGLETEST_LIBRARY NAMES gtest
|
||||
PATHS ${BUILD_DEPS_DIR}/${GOOGLETEST_DEPS_DIR}/build/googlemock/gtest/
|
||||
PATH_SUFFIXES Release
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_library(
|
||||
GOOGLETEST_MAIN_LIBRARY NAMES gtest_main
|
||||
PATHS ${BUILD_DEPS_DIR}/${GOOGLETEST_DEPS_DIR}/build/googlemock/gtest/
|
||||
PATH_SUFFIXES Release
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_library(
|
||||
GOOGLEMOCK_LIBRARY NAMES gmock
|
||||
PATHS ${BUILD_DEPS_DIR}/${GOOGLETEST_DEPS_DIR}/build/googlemock/
|
||||
PATH_SUFFIXES Release
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_library(
|
||||
GOOGLEMOCK_MAIN_LIBRARY NAMES gmock_main
|
||||
PATHS ${BUILD_DEPS_DIR}/${GOOGLETEST_DEPS_DIR}/build/googlemock/
|
||||
PATH_SUFFIXES Release
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
|
||||
@ -22,14 +22,16 @@ find_path(
|
||||
)
|
||||
|
||||
find_library(
|
||||
UV_STATIC_LIBRARY NAMES libuv.a
|
||||
PATHS ${BUILD_DEPS_DIR}/${UV_DEPS_DIR}/.libs/
|
||||
UV_STATIC_LIBRARY NAMES libuv
|
||||
PATHS ${BUILD_DEPS_DIR}/${UV_DEPS_DIR}
|
||||
PATH_SUFFIXES .libs Release
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_library(
|
||||
UV_SHARED_LIBRARY NAMES uv
|
||||
PATHS ${BUILD_DEPS_DIR}/${UV_DEPS_DIR}/.libs/
|
||||
UV_SHARED_LIBRARY NAMES uv libuv
|
||||
PATHS ${BUILD_DEPS_DIR}/${UV_DEPS_DIR}
|
||||
PATH_SUFFIXES .libs Release
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
|
||||
36
deps.bat
Normal file
36
deps.bat
Normal file
@ -0,0 +1,36 @@
|
||||
@echo off
|
||||
|
||||
set SRC_DIR=%~dp0
|
||||
|
||||
if not defined platform set platform=x86
|
||||
|
||||
@rem init/update submodules
|
||||
cd %SRC_DIR%
|
||||
git submodule update --init
|
||||
|
||||
@rem compile dependencies
|
||||
|
||||
@rem uv first because vcbuild.bat gives us good things like:
|
||||
@rem - msbuild in PATH
|
||||
@rem - variables like config, msbuild_platform
|
||||
|
||||
cd %SRC_DIR%deps\libuv
|
||||
@rem the arguments to vcbuild make all the difference to further builds
|
||||
call vcbuild.bat release %platform% shared
|
||||
|
||||
if "%msbuild_platform%"=="x64" (
|
||||
set CMAKE_GENERATOR_NAME=Visual Studio 14 2015 Win64
|
||||
) else (
|
||||
set CMAKE_GENERATOR_NAME=Visual Studio 14 2015
|
||||
)
|
||||
|
||||
set GTEST_BUILD_DIR=%SRC_DIR%deps\googletest\build
|
||||
if exist %GTEST_BUILD_DIR%\NUL rd /s /q %GTEST_BUILD_DIR%
|
||||
md %GTEST_BUILD_DIR%
|
||||
cd %GTEST_BUILD_DIR%
|
||||
cmake .. -Dgtest_force_shared_crt=ON -G"%CMAKE_GENERATOR_NAME%"
|
||||
msbuild googlemock\gmock.sln /p:Configuration=%config% /p:Platform="%msbuild_platform%" /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo /m
|
||||
msbuild googlemock\gtest\gtest.sln /p:Configuration=%config% /p:Platform="%msbuild_platform%" /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo /m
|
||||
|
||||
@rem go back home
|
||||
cd %SRC_DIR%
|
||||
23
runtests.bat
Normal file
23
runtests.bat
Normal file
@ -0,0 +1,23 @@
|
||||
@echo off
|
||||
|
||||
set SRC_DIR=%~dp0
|
||||
set BUILD_DIR=%SRC_DIR%build\
|
||||
if not defined config set config=Release
|
||||
|
||||
cd %BUILD_DIR%
|
||||
|
||||
if defined APPVEYOR if "%APPVEYOR%" == "True" goto skip-build
|
||||
|
||||
@rem Now to build the tests
|
||||
cmake .. -G"%CMAKE_GENERATOR_NAME%"
|
||||
msbuild uvw.sln /p:Configuration=%config% /p:Platform="%msbuild_platform%" /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo /m
|
||||
|
||||
:skip-build
|
||||
@rem one more thing before running the tests, the executables need `libuv.dll`
|
||||
@rem in the loader path. The easiest is in the same directory.
|
||||
copy %SRC_DIR%deps\libuv\%config%\libuv.dll %BUILD_DIR%test\bin\%config%
|
||||
|
||||
@rem run the tests now
|
||||
msbuild RUN_TESTS.vcxproj /p:Configuration=%config% /p:Platform="%msbuild_platform%" /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo /m
|
||||
|
||||
cd %SRC_DIR%
|
||||
@ -1,5 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <ciso646>
|
||||
#endif
|
||||
|
||||
#include <new>
|
||||
#include <memory>
|
||||
|
||||
@ -28,7 +28,7 @@ enum class UVProcessFlags: std::underlying_type_t<uv_process_flags> {
|
||||
|
||||
|
||||
enum class UVStdIOFlags: std::underlying_type_t<uv_stdio_flags> {
|
||||
IGNORE = UV_IGNORE,
|
||||
IO_IGNORE = UV_IGNORE,
|
||||
CREATE_PIPE = UV_CREATE_PIPE,
|
||||
INHERIT_FD = UV_INHERIT_FD,
|
||||
INHERIT_STREAM = UV_INHERIT_STREAM,
|
||||
|
||||
@ -171,7 +171,9 @@ class StreamHandle: public Handle<T, U> {
|
||||
}
|
||||
|
||||
protected:
|
||||
using Handle<T, U>::Handle;
|
||||
StreamHandle(std::shared_ptr<Loop> ref) noexcept
|
||||
: Handle{std::move(ref)}
|
||||
{ }
|
||||
|
||||
public:
|
||||
/**
|
||||
|
||||
@ -246,13 +246,13 @@ public:
|
||||
* * `UDPHandle::Membership::JOIN_GROUP`
|
||||
*
|
||||
* @param multicast Multicast address to set membership for.
|
||||
* @param interface Interface address.
|
||||
* @param interface_addr Interface address.
|
||||
* @param membership Action to be performed.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
template<typename I = IPv4>
|
||||
bool multicastMembership(std::string multicast, std::string interface, Membership membership) {
|
||||
return (0 == uv_udp_set_membership(get<uv_udp_t>(), multicast.data(), interface.data(), static_cast<uv_membership>(membership)));
|
||||
bool multicastMembership(std::string multicast, std::string interface_addr, Membership membership) {
|
||||
return (0 == uv_udp_set_membership(get<uv_udp_t>(), multicast.data(), interface_addr.data(), static_cast<uv_membership>(membership)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -278,12 +278,12 @@ public:
|
||||
|
||||
/**
|
||||
* @brief Sets the multicast interface to send or receive data on.
|
||||
* @param interface Interface address.
|
||||
* @param interface_addr Interface address.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
template<typename I = IPv4>
|
||||
bool multicastInterface(std::string interface) {
|
||||
return (0 == uv_udp_set_multicast_interface(get<uv_udp_t>(), interface.data()));
|
||||
bool multicastInterface(std::string interface_addr) {
|
||||
return (0 == uv_udp_set_multicast_interface(get<uv_udp_t>(), interface_addr.data()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -11,6 +11,12 @@
|
||||
#include <array>
|
||||
#include <uv.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
// MSVC doesn't have C++14 relaxed constexpr support yet. Hence the jugglery.
|
||||
#define R_CONSTEXPR
|
||||
#else
|
||||
#define R_CONSTEXPR constexpr
|
||||
#endif
|
||||
|
||||
namespace uvw {
|
||||
|
||||
@ -97,12 +103,12 @@ public:
|
||||
|
||||
~Flags() noexcept { static_assert(std::is_enum<E>::value, "!"); }
|
||||
|
||||
constexpr Flags& operator=(const Flags &f) noexcept {
|
||||
R_CONSTEXPR Flags& operator=(const Flags &f) noexcept {
|
||||
flags = f.flags;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr Flags& operator=(Flags &&f) noexcept {
|
||||
R_CONSTEXPR Flags& operator=(Flags &&f) noexcept {
|
||||
flags = std::move(f.flags);
|
||||
return *this;
|
||||
}
|
||||
@ -314,7 +320,7 @@ Addr address(F &&f, const H *handle) noexcept {
|
||||
template<typename F, typename... Args>
|
||||
std::string path(F &&f, Args... args) noexcept {
|
||||
std::size_t size = DEFAULT_SIZE;
|
||||
char buf[size];
|
||||
char buf[DEFAULT_SIZE];
|
||||
std::string str{};
|
||||
auto err = std::forward<F>(f)(args..., buf, &size);
|
||||
|
||||
@ -507,21 +513,21 @@ struct Utilities {
|
||||
|
||||
if(0 == uv_interface_addresses(&ifaces, &count)) {
|
||||
std::for_each(ifaces, ifaces+count, [&interfaces](const auto &iface) {
|
||||
InterfaceAddress interface;
|
||||
InterfaceAddress tInterface;
|
||||
|
||||
interface.name = iface.name;
|
||||
interface.physical = iface.phys_addr;
|
||||
interface.internal = iface.is_internal;
|
||||
tInterface.name = iface.name;
|
||||
tInterface.physical = iface.phys_addr;
|
||||
tInterface.internal = iface.is_internal;
|
||||
|
||||
if(iface.address.address4.sin_family == AF_INET) {
|
||||
interface.address = details::address<IPv4>(&iface.address.address4);
|
||||
interface.netmask = details::address<IPv4>(&iface.netmask.netmask4);
|
||||
tInterface.address = details::address<IPv4>(&iface.address.address4);
|
||||
tInterface.netmask = details::address<IPv4>(&iface.netmask.netmask4);
|
||||
} else if(iface.address.address4.sin_family == AF_INET6) {
|
||||
interface.address = details::address<IPv6>(&iface.address.address6);
|
||||
interface.netmask = details::address<IPv6>(&iface.netmask.netmask6);
|
||||
tInterface.address = details::address<IPv6>(&iface.address.address6);
|
||||
tInterface.netmask = details::address<IPv6>(&iface.netmask.netmask6);
|
||||
}
|
||||
|
||||
interfaces.push_back(std::move(interface));
|
||||
interfaces.push_back(std::move(tInterface));
|
||||
});
|
||||
|
||||
uv_free_interface_addresses(ifaces, count);
|
||||
|
||||
@ -22,6 +22,10 @@ if(${LIBRT_FOUND})
|
||||
list(APPEND COMMON_LINK_LIBS ${LIBRT_LIBRARIES})
|
||||
endif(${LIBRT_FOUND})
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND COMMON_LINK_LIBS ws2_32)
|
||||
endif(WIN32)
|
||||
|
||||
add_library(odr OBJECT odr.cpp)
|
||||
target_include_directories(odr PRIVATE ${COMMON_INCLUDE_DIRS})
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user